Best practice to store a feature in a GeoJSON with accurate geometry #5726
Unanswered
BenOnTrack
asked this question in
Q&A
Replies: 1 comment 4 replies
-
I would recommend getting the geometry from a backend server instead of relying on the rendered geometry as it is meant for rendering of the base map and not for rendering a "place". |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Maplibre team,
I've been struggling over the past few months on a recurrent issue, regarding geometry of VectorTile features stored and then displayed as a GeoJSON, having discrepancies with the "original" vectorTile feature (white on the picture) versus the "stored" one (purple on the picture), at high zoom level.
I've found a few similar topics, where people are wondering what's best between using
queryRenderedFeatures
orquerySourceFeatures
. I believe this topic is to make sure I understand correctly what's happening and that there might be no solution to my issue.Objective
The User clicks on a feature rendered on the Map.
The App stores that feature, update a reactive GeoJSON source Rune (svelte5), that is displayed on the map.
Small comment on the rationale of using an additional GeoJSON:
Initially I only stored the
id
of the feature "clicked", had a duplicate of my feature VectorLayer, and had a reactive filter on those ids. It worked "OK", but :For those reasons I've switched to GeoJSON.
The Issue
When doing so, I have discrepancies between my GeoJSON feature and my "original" VectorTile feature. Why ? My understanding (and this is where I'd love to make sure I'm understanding it properly) is:
Hence, since today I perform a
queryRenderedFeatures
on my "original" feature, I actually store "a" geometry of my feature. Geometry that would be rendered differently at different zoom levels hence explaining the discrepancy between both the "original" data and the "stored geojson" data.The Question
Is there actually a solution to this problem ? If not, what would be the best workaround ?
Thank so much for taking the time and for your feedbacks.
Beta Was this translation helpful? Give feedback.
All reactions