Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plain GeoJSON geometry and GeoJSON features behave differently with INTERSECTS CIRCLE #529

Closed
spierepf opened this issue Feb 6, 2020 · 3 comments

Comments

@spierepf
Copy link

spierepf commented Feb 6, 2020

To Reproduce
When I SET a plain GeoJson object, then INTERSECTS CIRCLE works as expected:

127.0.0.1:9851> SET key id OBJECT {"type":"LineString", "coordinates":[[0,0], [0,1]]}
{"ok":true,"elapsed":"119.742µs"}
127.0.0.1:9851> INTERSECTS key CIRCLE 0 0 5000
{"ok":true,"objects":[{"id":"id","object":{"type":"LineString","coordinates":[[0,0],[0,1]]}}],"count":1,"cursor":0,"elapsed":"120.72µs"}
127.0.0.1:9851> INTERSECTS key CIRCLE 1 0 5000
{"ok":true,"objects":[{"id":"id","object":{"type":"LineString","coordinates":[[0,0],[0,1]]}}],"count":1,"cursor":0,"elapsed":"91.406µs"}
127.0.0.1:9851> INTERSECTS key CIRCLE 0.5 0 5000
{"ok":true,"objects":[{"id":"id","object":{"type":"LineString","coordinates":[[0,0],[0,1]]}}],"count":1,"cursor":0,"elapsed":"143.802µs"}

However when I SET a GeoJson feature with the same geometry:

127.0.0.1:9851> SET key id OBJECT {"type":"Feature", "geometry":{"type":"LineString", "coordinates":[[0,0], [0,1]]}, "properties":{}}
{"ok":true,"elapsed":"52.473µs"}

The endpoints are matched by an INTERSECTS CIRCLE:

127.0.0.1:9851> INTERSECTS key CIRCLE 0 0 5000
{"ok":true,"objects":[{"id":"id","object":{"type":"Feature","geometry":{"type":"LineString","coordinates":[[0,0],[0,1]]},"properties":{}}}],"count":1,"cursor":0,"elapsed":"89.127µs"}
127.0.0.1:9851> INTERSECTS key CIRCLE 1 0 5000
{"ok":true,"objects":[{"id":"id","object":{"type":"Feature","geometry":{"type":"LineString","coordinates":[[0,0],[0,1]]},"properties":{}}}],"count":1,"cursor":0,"elapsed":"91.617µs"}

But an arbitrary point on the geometry does not:

127.0.0.1:9851> INTERSECTS key CIRCLE 0.5 0 5000
{"ok":true,"objects":[],"count":0,"cursor":0,"elapsed":"53.844µs"}

Expected behavior
I'd expect that plain geometry and features with that geometry should be indistinguishable in terms of matching predicates like INTERSECTS CIRCLE

Operating System (please complete the following information):
RedHat Enterprise Linux 7
Running in tile38/tile38 docker container

@tidwall
Copy link
Owner

tidwall commented Feb 10, 2020

Thanks for reporting. I found this issue and pushed a fix. I'll be releasing a new version today.

@spierepf
Copy link
Author

I really appreciate how quickly you respond to issues. Has this fix made it into the docker image?

@tidwall
Copy link
Owner

tidwall commented Feb 11, 2020

I did push to docker yesterday but the change didn't stick because I forgot a step. 🤦‍♂️
I made a hotfix moments ago and double checked it. You should be good to go now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants