mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
467 stars 150 forks source link

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

Open Gnative opened 3 days ago

Gnative commented 3 days ago

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

astojilj commented 2 days ago

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

Gnative commented 2 days ago

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

astojilj commented 2 days ago

@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"}
    }
],
Gnative commented 2 days ago

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 ?

astojilj commented 2 days ago

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?

Gnative commented 2 days ago

@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 ?