I used an UIImage
to initialize an MGLImageSource
. Then I use the MGLImageSource
to initialize a MGLRasterStyleLayer
and I add the layer to a MGLMapView
. It turned out that the image is too big to fit entirely into the map view. How do I tell MGLMapview
to scale an image automatically so that the image fits entirely into the view like the 'scale to fit
' in iOS ? thanks !
Here is how I add the image into the map view:
UIImage *radarImage = [UIImage imageNamed:@"radar.png"];
MGLImageSource *source = [[MGLImageSource alloc] initWithIdentifier:@"radar" coordinateQuad:coordinates image:radarImage];
[style addSource:source];
MGLRasterStyleLayer *radarLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"radar-layer" source:source];
[style addLayer: radarLayer];