Coder Social home page Coder Social logo

Comments (6)

rbastian avatar rbastian commented on May 16, 2024 1

NEARBY with a distance of 0 also works:

NEARBY cities POINT 33.4255 -111.94 0
{"ok":true,"objects":[{"id":"tempe","object":{"type":"Polygon","coordinates":[[[-111.9787,33.4411],[-111.8902,33.4377],[-111.895,33.2892],[-111.9739,33.2932],[-111.9787,33.4411]]]}}],"count":1,"cursor":0,"elapsed":"10.386782ms"}

from tile38.

tidwall avatar tidwall commented on May 16, 2024 1

I finally got around to fixing this issue. You can now issue an INTERSECTS on a point:

INTERSECTS cities OBJECT { "type": "Point", "coordinates": [ -111.9400, 33.4255] }

Though it's not possible to do a WITHIN because a within search find all objects that are fully contained inside of an object. And in your case that a Polygon cannot be fully inside a Point.

Let me know if you run into any problems and thanks for finding this bug.

from tile38.

tidwall avatar tidwall commented on May 16, 2024 1

@windrunner99

In 1.19.3 the behavior of the tile38-cli was changed in order to fix a bug. 66af8ab

It now requires that when an arguments has a space, like the geojson in your example, it must be encapsulated in quotes.

INTERSECTS cities OBJECT '{ "type": "Point", "coordinates": [ -111.9400, 33.4255] }'

from tile38.

tidwall avatar tidwall commented on May 16, 2024

WITHIN and INTERSECTS cannot be used with points, only polygons or boundaries. This is a limitation of Tile38. But there are workarounds.

It is possible to use your point if it's represented as a polygon:

INTERSECTS cities OBJECT { "type": "Polygon", "coordinates": [[[ -111.9400,33.4255],[ -111.9400,33.4255],[ -111.9400,33.4255],[ -111.9400,33.4255]]] }

Or you can use the BOUNDS keyword:

INTERSECTS cities BOUNDS 33.4411 -111.9787 33.4411 -111.9787

Finally you can use NEARBY and provide a small sub-meter value:

NEARBY cities POINT 33.4411 -111.9787 0.0001

Tile38 should support the Point type for INTERSECTS and WITHIN. I filed a bug #26.

Thanks for reporting this.

from tile38.

tidwall avatar tidwall commented on May 16, 2024

Well that's even better. Thanks for the tip and for reporting this issue.

from tile38.

icemau avatar icemau commented on May 16, 2024

This does not seem to work anymore. Running this result in:

INTERSECTS cities OBJECT { "type": "Point", "coordinates": [ -111.9400, 33.4255] }
(error) invalid data

Was this revered in a following release?

from tile38.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.