wip: map snapshotter - #266
Conversation
|
Thanks for this! Currently planning on reviewing next week or so. |
|
Thank you for your review, I fixed all the things you mentioned. |
westnordost
left a comment
There was a problem hiding this comment.
👍
Super clean implementation
Appreciate your review! Did you test it on iOS? As I mentioned, I didn't, because I don't have a Mac right now. I will probably get one in a couple of weeks, so if there is any problem, I can fix it. |
|
I didn't test anything, just read the code. |
|
That's... possible? after all, with tilt or camera rotation , the displayed area is not a bbox anymore. I'd presume that if a camera position is specified, at least if it has any rotation or tilt, the camera position takes precedence and the bbox is discarded(?)
El 24 de mayo de 2025 23:09:05 CEST, "Michał Gwóźdź" ***@***.***> escribió:
…michalgwo left a comment (maplibre/maplibre-compose#266)
> That sounds like a good use case for a sealed interface!
I can imagine a scenario when someone wants to set both `cameraPosition` and `region`, for example, when they have a BoundingBox of the region, but want it rotated/tilted, which needs to be set with `cameraPosition`.
--
Reply to this email directly or view it on GitHub:
#266 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
According to the documentation, when I just tested setting |
Perhaps our parameters should be bounding box or position/zoom, with optional bearing and tilt? |
|
This, plus the attribution state stuff, is making me think the style URL and style composition should be something passed into the style state rather than into the map. And then, the user can initialize a camera + style state however they wish, and pass those two into either a map, or a snapshotter, or both |
|
Relevant comment at #374 (comment) My suggestion to support StyleState with programmatic styling is possible in Android I'll take this PR to the finish line |
|
Ah nope I was wrong; programmatic styling is available in iOS: #374 (comment) So yeah, back to the original plan to land this after our style state refactor so we can use it here. |
|
thanks for taking a swing at this, and sorry it got stuck for so long! |
Fixes #28
I implemented snapshot functionality for Android and iOS. There is no snapshotter in the MapLibre GL JS library, so I left it empty.
I also created a demo presenting snapshot functionality.
As for iOS, as I already mentioned in my previous PRs, I don't have a Mac, so I couldn't run it, but this time I tried my best to implement it for iOS as well, but as it's not tested, and I don't have any experience with iOS, it may not work 😅 Let me know if you are not interested in fixing it, so I will remove the iOS part, and leave only Android implementation.
A few remarks about the iOS implementation:
CameraPosition.toMLNCamera(), so I took my shot and used the same as the size of the snapshotcameraPositionparam for snapshotter options is nullable, but on iOS it's not, I'm not sure if it's the best solution, but I made it nullable in common code and on iOS created a new emptyMLNMapCamera()whencameraPositionisnullStringreturned on Android andNSErrorreturned on iOS. I also failed to make the snapshotter return error, so I have no idea what kind of error is there.