
Tile38 – Realtime geofencing and geospatial index, v1.11.0 - tidwall
http://github.com/tidwall/tile38
======
tidwall
To anyone coming here wondering WTF is Tile38? First I'll tell you what it's
not. It's not a replacement for PostGIS, and it's not built on top of Redis.

In my opinion PostGIS is the Swiss Army Knife of spatial data management. It's
awesome! Especially for large datasets and complex queries. I use it all the
time.

Tile38 uses the Redis protocol for network transport. There're some commands
that loosely resemble Redis like SET and GET, but it's otherwise a completely
different project. I originally forked Redis and built the functionality on
top of the C codebase. [https://github.com/tidwall/redis-
gis](https://github.com/tidwall/redis-gis), but scrapped that project.

What Tile38 is good for is very dynamic datasets where the application needs
fast and simple point-in-polygon queries and streaming geofence notifications.
Like vehicle pickup services, bus route services, proximity social apps, etc.

------
ldng
Inevitably this will be compared to PostGIS so maybe you could put a paragraph
in the README on how it compares to it what is the usecase where Tile38 would
serve you better. I must admit I don't see one for my own needs.

------
billylindeman
I've been following tile38 on github for quite awhile and it looks pretty
awesome, but I haven't had a chance to build anything with it.

Has anyone here built any user-facing applications on top of it?

~~~
allan_s
shameless plug

at [https://www.weenect.com](https://www.weenect.com) we're currently
experimenting with it in order to replace our mongodb, I think I will go with
this and a mix of postgresql for historical data.

the realtime geofencing capabilities will be a very good plus for us, as
that's one of the main feature of our products, i.e being able to know when
your cats or dog is going too far.

~~~
billylindeman
very cool! I built a small gsm/gps tracker for my motorcycle a few years ago.
Its an interesting space.

------
johneth
This looks really useful.

I've been using a similar geometry library 'S2'[1], by Google. It's mainly
used for fast spatial indexing and comparison functionality, albeit more
'approximate'[2] than Tile38 seems to be.

[1] [http://s2geometry.io/](http://s2geometry.io/)

[2] Approximate = not absolutely exact shapes when geofencing, for example.

~~~
tidwall
I believe indexing with S2 can be made absolute if a polygon's boundary
coverage cells contain a slice of the original shape. It's a bit more
expensive on memory and insert times. But very fast and accurate queries. I've
been experimenting with this method.

~~~
gfrangakis
S2 can also output interior coverings, which will return only the cells in a
covering that are fully contained in a polygon. So if you encounter a point
(or any cell) whose parent is in an interior covering, you don't have to do
any additional checks to produce an exact result (whereas on the boundary, you
may want to do a point-in-polygon test to be exact).

~~~
tidwall
Right! I forgot to mention that. You can totally skip the entire point-in-
polygon for interior cells. So good.

------
guessmyname
Some people may not read the link because it appears grayed out in some
browsers _(the link has been posted before and so it appears in the browser
history as visited)_. Maybe it's better to link to the changelog page, since
this was reposted because a new version has been released [1].

[1]
[https://github.com/tidwall/tile38/releases/tag/1.11.0](https://github.com/tidwall/tile38/releases/tag/1.11.0)

------
cwt137
Is this built on top of Redis, or just use a Redis-like protocol?

~~~
tidwall
It just uses the protocol.

