react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

What is currently the best way to add a GeoJson polygon to the map?

Open ganesh-sankey opened this issue 8 years ago • 10 comments

I am aware the currently there is not API available to access data. I am looking for what are the other ways to add geoJSON to google map using this library. I have looked into previous raised issues but no luck

ganesh-sankey avatar Sep 08 '18 10:09 ganesh-sankey

Parse your geoJSON polygons into coordinates a Google Map polygon can render

milieu avatar Sep 10 '18 05:09 milieu

@milieu what about If I want add geojson not geojson polygon. any geojson. what could be the solution in that case. any idea implementation? without forking and modifying existing library and then use.

ganesh-sankey avatar Sep 10 '18 08:09 ganesh-sankey

Oh... just properly looked at http://geojson.org/

Uh, access the geojson's geometry key and grab the coordinates and pass it to the path attribute of Google Map's Polygons?

milieu avatar Sep 12 '18 03:09 milieu

Thnks man @milieu. anyway I got work around. I tried to load geoJSON on data layer and then attach that data layer to map.

ganesh-sankey avatar Sep 18 '18 12:09 ganesh-sankey

@milieu Do you have any idea about how to export(get) geoJSON from map. It should able to get updated geoJSON i.e. added markers by users to map should be there in the definition.

ganesh-sankey avatar Sep 18 '18 12:09 ganesh-sankey

?? From map?

Um, without seeing a gist I really can't say how you can do it... it sounds like you want to register something that on marker creation whatever geoJSON you're tracking in state gets updated.

milieu avatar Oct 02 '18 01:10 milieu

finally, I was able to add markers to map and able to export updated geoJson from map. for that I relied on DataLayer since react-google-maps dont have support API to access map.data yet.

ganesh-sankey avatar Oct 03 '18 06:10 ganesh-sankey

I think this issue can be closed

milieu avatar Oct 08 '18 02:10 milieu

Yes, it can be closed now.

ganesh-sankey avatar Oct 08 '18 06:10 ganesh-sankey

The power is yours (and probably the maintainer's...)

milieu avatar Nov 20 '18 02:11 milieu