I'm building a React app which allows users to define plots through a Google Maps component by drawing overlay polygons. I'd like to push a GeoJSON up every time that the user draws a polygon.
The documentation is vague on this point. I'm using this sort of function:
onPolygonComplete={polygon => {
console.log(JSON.stringify(polygon.getPaths().b[0].b));
}}
...which produces this sort of thing:
[{"lat":32.22020791674245,"lng":35.22491455078125},{"lat":31.98754909816049,"lng":35.20294189453125},{"lat":32.0201569982896,"lng":35.43365478515625},{"lat":32.22485504316297,"lng":35.30731201171875}]
A good start-but is there anything built in that will produce an actual GeoJSON?
I can always use .map to go through this array and vivsect an GeoJSON object out of it...but wanted to ask if anyone knew of something already baked into the API.