Fast GIS data store, spatial index, and realtime geofence. (Please contribute your use case to https://github.com/tidwall/tile38)
@tidwall Would you happen to know if there is a faster way to check if a point is within an inserted multipolygon than running (*collection).Intersects and passing in the point?
The question is probably wishful thinking, though I’m trying to find the quickest way to group some points by country/state to sort with.
I am currently using https://github.com/busrapidohq/world-countries-boundaries/tree/master/geojson/10m and am getting back under 150 points per second when running the intersect queries in parallel (using the collection package)
I probably just need to lower the resolution, though this seemed slow to the point that I’m doing something inefficiently given how the intersects method works and I figured that I would ask.
@/all I just pushed some big changes to the master branch that affect concurrency and performance, in a good way.
Before:
PING: 106945.43 requests per second
SET (point): 36893.82 requests per second
SET (rect): 32290.12 requests per second
SET (string): 40745.98 requests per second
GET (point): 61959.93 requests per second
GET (rect): 49814.28 requests per second
GET (string): 70695.00 requests per second
SEARCH (nearby 1km): 28368.35 requests per second
SEARCH (nearby 10km): 19525.70 requests per second
SEARCH (nearby 100km): 2870.19 requests per second
After:
PING: 109488.29 requests per second
SET (point): 39637.93 requests per second
SET (rect): 35838.09 requests per second
SET (string): 44281.98 requests per second
GET (point): 86496.45 requests per second
GET (rect): 80139.81 requests per second
GET (string): 91467.89 requests per second
SEARCH (nearby 1km): 71347.51 requests per second
SEARCH (nearby 10km): 56508.02 requests per second
SEARCH (nearby 100km): 9779.66 requests per second
Testing and feedback is appreciated. Thanks!
@charlietango592 Hi Catalin and welcome! Only geofences created with a SETHOOK can provide additional information with each event such as the name of the hook. A geofence that is created without a SETHOOK, just a plain static NEARBY ... FENCE
events do not provide any extra information about the origin of the geofence.
Perhaps as a workaround, since you can only have one static geofence per client connection perhaps you can create a unique name for that client/geofence at the application level prior to issuing the NEARBY ... FENCE
command to the Tile38 server. Then when consuming the geofence events, modify the each event's JSON payload and add the client/geofence identifier before passing it on.
SET toto 123abc POINT 1.2 1.2
SET toto 456dce POINT 1.2 1.2
NEARBY toto POINT 1.2 1.2 123
{"ok":true,"objects":[{"id":"123abc","object":{"type":"Point","coordinates":[1.2,1.2]}},{"id":"456dce","object":{"type":"Point","coordinates":[1.2,1.2]}}],"count":2,"cursor":0,"elapsed":"148.979µs"}
a command to do a query that don't match the id 123abc ?NEARBY toto match !(123abc) POINT 1.2 1.2 123
{"ok":true,"objects":[],"count":0,"cursor":0,"elapsed":"44.404µs"}
hello, is there any way to find nearby for multiple points. For example, i have a list of station locations, I want to find all drivers NEARBY each station in 3km radius ?
Doing a loop of NEARBY command for each location is an option but I want a better way