This repository was archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Extrusions example #86
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,9 @@ - (void)viewDidLoad { | |
MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:[MGLStyle lightStyleURLWithVersion:9]]; | ||
|
||
// Center the map on the Colosseum in Rome, Italy. | ||
[mapView setCenterCoordinate:CLLocationCoordinate2DMake(41.8902, 12.4922)]; | ||
|
||
// Set the map view camera's pitch and distance. | ||
mapView.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:mapView.centerCoordinate fromDistance:600 pitch:60 heading:0]; | ||
// Center the map view on the Colosseum in Rome, Italy and set the camera's pitch and distance. | ||
mapView.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:CLLocationCoordinate2DMake(41.8902, 12.4922) fromDistance:600 pitch:60 heading:0]; | ||
mapView.delegate = self; | ||
|
||
[self.view addSubview:mapView]; | ||
|
@@ -41,14 +40,14 @@ - (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style { | |
layer.sourceLayerIdentifier = @"building"; | ||
|
||
// Filter out buildings that should not extrude. | ||
layer.predicate = [NSPredicate predicateWithFormat:@"extrude != false AND height >=0"]; | ||
layer.predicate = [NSPredicate predicateWithFormat:@"height >= 0"]; | ||
|
||
// Set the fill extrusion height to the value for the building height attribute. | ||
layer.fillExtrusionHeight = [MGLStyleValue valueWithInterpolationMode:MGLInterpolationModeIdentity sourceStops:nil attributeName:@"height" options:nil]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to set |
||
layer.fillExtrusionOpacity = [MGLStyleValue valueWithRawValue:@0.75]; | ||
layer.fillExtrusionColor = [MGLStyleValue valueWithRawValue:[UIColor whiteColor]]; | ||
|
||
// Insert the fill extrusion layer below a POI label layer. Use the `layers` property on a style to verify built-in layer identifiers. | ||
// Insert the fill extrusion layer below a POI label layer. If you aren’t sure what the layer is called, you can view the style in Mapbox Studio or iterate over the style’s layers property, printing out each layer’s identifier. | ||
MGLStyleLayer *symbolLayer = [style layerWithIdentifier:@"poi-scalerank3"]; | ||
[style insertLayer:layer belowLayer:symbolLayer]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do want to extrude. #86 was a suggestion to change this to
extrude = true
, not to remove the condition. By removing the condition, buildings like the Eiffel Tower will get extruded quite humorously.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I just edited it. Was running into issues because of mapbox/mapbox-gl-native#9056