Trouble with geo searching after 3.9

31 views
Skip to first unread message

Kevin Fricke

unread,
Jun 20, 2023, 1:59:45 PM6/20/23
to ArangoDB
The geospatial indexes have changed and we can't figure out what we need to do to fix our queries so that we can upgrade. Here is an example of a query that used to work:

FOR p IN Property
FILTER p.active == true
FILTER GEO_CONTAINS(GEO_POLYGON([[-97.0314584591387,32.7619063053385],[-97.0314781960238,32.760119703834],[-97.0327146084348,32.7601279191604],[-97.0331119467597,32.7600224056043],[-97.035187653344,32.7600361650632],[-97.0351550256345,32.761871612797],[-97.0346196494881,32.7618705257512],[-97.0340669484332,32.7618694009346],[-97.0334087833672,32.7618680585576],[-97.0327039059065,32.761866617221],[-97.0327041673162,32.761914581689],[-97.0314584591387,32.7619063053385]]), [p.lng, p.lat]) 

That would always work and return the properties that are in that polygon.

If we do this: 

RETURN GEO_POLYGON([[-97.0314584591387,32.7619063053385],[-97.0314781960238,32.760119703834],[-97.0327146084348,32.7601279191604],[-97.0331119467597,32.7600224056043],[-97.035187653344,32.7600361650632],[-97.0351550256345,32.761871612797],[-97.0346196494881,32.7618705257512],[-97.0340669484332,32.7618694009346],[-97.0334087833672,32.7618680585576],[-97.0327039059065,32.761866617221],[-97.0327041673162,32.761914581689],[-97.0314584591387,32.7619063053385]])

The web client returns a polygon.

when running this:

RETURN {"type":"Point","coordinates":[-106.84,40.49]}

the web client returns a point that is NOT in that polygon

however, that filter always is true and never is false. I'm sure that there is something small that we need to change but I have been unable to find it.

If anyone knows what we need to do that would be awesome :D

Kevin


Asif Kazi

unread,
Jun 23, 2023, 11:56:21 AM6/23/23
to ArangoDB
Hey Kevin,
I checked internally with some of the folks, the issue has to do with whether the polygon is CW (Clockwise) or CounterClockWise(CCW).
If you simply reverse your array,  you will get the intended results. Its not a bug but has to do with the GeoJSON specs.

Thanks,
Asif
Reply all
Reply to author
Forward
0 new messages