- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView
{
[self.mapView setStyleURL:[MGLStyle darkStyleURLWithVersion:9]];
NSURL *url = [[NSURL alloc] initWithString:@"mapbox://mapbox.mapbox-terrain-v2"];
MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithSourceIdentifier:@"terrain-data" URL:url];
[self.mapView.style addSource:vectorSource];
MGLBackgroundStyleLayer *backgroundLayer = [[MGLBackgroundStyleLayer alloc] initWithLayerIdentifier:@"background"];
backgroundLayer.backgroundColor = [UIColor blackColor];
[self.mapView.style addLayer:backgroundLayer];
MGLLineStyleLayer *lineLayer = [[MGLLineStyleLayer alloc] initWithLayerIdentifier:@"terrain-data" source:vectorSource sourceLayer:@"contour"];
NSUInteger lineJoineValue = (NSUInteger)MGLLineStyleLayerLineJoinRound;
[lineLayer setLineJoin:[NSValue value:&lineJoineValue withObjCType:@encode(MGLLineStyleLayerLineJoin)]];
NSUInteger lineCapValue = (NSUInteger)MGLLineStyleLayerLineCapRound;
[lineLayer setLineCap:[NSValue value:&lineCapValue withObjCType:@encode(MGLLineStyleLayerLineCap)]];
[lineLayer setLineColor:[UIColor greenColor]];
[self.mapView.style addLayer:lineLayer];
}
Created
September 7, 2016 18:08
-
-
Save boundsj/168eb88eb8808edb2c10ae210ccb95f6 to your computer and use it in GitHub Desktop.
style_vector_layer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment