-
I am trying to load geoJSON, but there's no exported
But this too isn't working...what's the official GEOJson support method? I have these types of features in my dataset:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
We currently don't have that as an exported component, but you can copy (or be inspired by) the react-google-maps/examples/geometry/src/components/polygon.tsx Lines 72 to 78 in d2de370 We'll be adding 'official' polygon etc. components soon(ish), and I'll keep this question in mind for the final architecture. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response. I have been able to load the GRA on with
the required format The polygon example requires. However, it seems to not
draw it the same as the original Geo JSON. There are errors about points
not closing. I Feel confident in the GeoJSON Because I’m using the same
data in my native mobile app with no issues.
Additionally, I need to fill in the colors of certain polygons based on app
and user state. I’m not sure how to achieve this in your current component
Do you have any ideas on this?
…On Thu, Mar 6, 2025 at 4:26 AM Martin Schuhfuss ***@***.***> wrote:
We currently don't have that as an exported component, but you can copy
(or be inspired by) the Polygon component
<https://github.com/visgl/react-google-maps/blob/main/examples/geometry/src/components/polygon.tsx>
from our geometry example
<https://visgl.github.io/react-google-maps/examples/geometry>. That
component doesn't currently support GeoJSON, but this can easily be added
here instead of using the encodedPath prop:
https://github.com/visgl/react-google-maps/blob/d2de370d4c938293b24b662bb333b2db40e14923/examples/geometry/src/components/polygon.tsx#L72-L78
We'll be adding 'official' polygon etc. components soon(ish), and I'll
keep this question in mind for the final architecture.
—
Reply to this email directly, view it on GitHub
<#701 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADTVWOLFE6U3UYJ33V7T7J32TAWGFAVCNFSM6AAAAABYNHPKLWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENBRGMYDCNQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
ahha! |
Beta Was this translation helpful? Give feedback.
ahha!
map.data.addGeoJson(geoJson);