mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

Prevent flatting of 3D Terrain Satellite map styles when pitching.

Open Gnative opened this issue 1 year ago • 6 comments

I updated my Satellite map style and I am using the 3D Terrain layer to display this. Now when I pitch to 0 (or viewing directly downward) the map does the flatting animation thing where the 3D Terrain layer is flattened.. I didn't set the map to do this and would prefer it wouldn't do this as, to me, it looks a little buggy and i like the original 3D perspective from above. Is this a new feature and if so can we have a setting to keep it so that the 3D perspective is kept ?

Thank you

Strangely the vector maps still have this 3D perspective on 0 pitch, its only applied to the satellite map style as you can see in this video.

https://github.com/user-attachments/assets/abfe5ff0-cbcf-4653-93fe-12d8088d4f13

https://github.com/user-attachments/assets/8404c7e8-9515-4d32-bfc3-f0f26a0ab183

Gnative avatar Sep 21 '24 16:09 Gnative

Could you please check if your style has the root-level property "camera"->"camera-projection" set to "perspective"? Flattening is related to "orthographic" "camera-projection" behavior. Standard style uses "orthographic".

E.g. style's json should not have "orthographic" here but "perspective".

image

astojilj avatar Sep 22 '24 16:09 astojilj

Hi @astojilj thanks for the reply.

No it looks like the root-level camera property is not set.. This is a fairly old base style that I have updated. I am not able to see where you would set this with in the style either. Sorry if this is obvious, it is just not to me at the moment.

style.json

Gnative avatar Sep 22 '24 17:09 Gnative

@Gnative

Your style now imports Standard Satellite style, and inherits the layers and settings from there, including camera-projection. The style.json you shared includes this:

"imports": [
    {
        "id": "basemap",
        "url": "mapbox://styles/mapbox/standard-satellite",
        "config": {"show3dObjects": false, "theme": "default"}
    }
],

So, you'd need to override this - add this e.g. just before "imports", the code should look like:

"camera": {
    "camera-projection": "orthographic"
},
"imports": [
    {
        "id": "basemap",
        "url": "mapbox://styles/mapbox/standard-satellite",
        "config": {"show3dObjects": false, "theme": "default"}
    }
],

astojilj avatar Sep 22 '24 17:09 astojilj

OK thank you so much. I don't see where to do this in the Style Studio. I guess I need to do this at app level ?

Gnative avatar Sep 22 '24 17:09 Gnative

Could you please try editing the style.json in a text editor (to add the aforementioned camera projection) and then importing the JSON file back into Studio?

astojilj avatar Sep 22 '24 18:09 astojilj

@astojilj Yes this works.. the camera-projection: perspective property does as I expect now. I also checked with the orthographic value and this brought back the flattening effect.

It must be when I updated a layer in the original style that this base default properties were then applied.

Is there a way to apply this to my original style as the style ID is coded into my IOS and Android apps ?

Gnative avatar Sep 22 '24 18:09 Gnative