-
Reading over the API documentation, official docs, and the issue list, it is unclear to me how to generate a GeoShapeQuery from GeoJSON. You can very nearly directly insert GeoJSON into an index, but it appears to want a completely different format for a query. Can someone provide an example of turning GeoJSON into a valid GeoShapeQuery? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@cramey apologies for the delayed response. thanks! |
Beta Was this translation helpful? Give feedback.
-
I picked that test since it pointed to a function which unmarshaled strings with GeoJSON into valid geoshape queries. Great to see that found the answer, closing this as resolved. |
Beta Was this translation helpful? Give feedback.
What that testing function does is unmarshal several GeoShapeQuerys to compare expected results with output. It's not a complete answer because it uses query.ParseQuery() and expects JSON compatible with a GeoShapeQuery, which includes GeoJSON, but isn't exclusively GeoJSON. It did lead me around to geo.ParseGeoJSONShape(), which can be used to Unmarshal GeoJSON into struct compatible with a GeoShapeQuery. Here's my code: