Tarantool/GIS is a full-featured geospatial extension for Tarantool Database. It's like PostGIS, but for Tarantool.
Point
, LineString
, Polygon
, MultiPoint
, GeometryCollection
and
other geometric primitives.Overlaps
, Contains
, Touches
, Distance
, Length
, Area
and other
geometric functions.Tarantool/GIS is in an alpha stage. All feautures are documented and fully covered by unit and functional tests.
[] (https://travis-ci.org/tarantool/gis)
Here is an example how to work with geometric primitives in Tarantool:
gis = require('gis')
gis.install() -- create system tables
-- https://source.opennews.org/en-US/learning/choosing-right-map-projection/
wgs84 = 4326 -- WGS84 World-wide Projection (Lon/Lat)
nationalmap = 2163 -- US National Atlas Equal Area projection (meters)
calif5 = 2770 -- California zone 5 projection (meters)
nevada = gis.Polygon({{
{-120.000000, 42.000000};
{-114.000000, 42.000000};
{-114.000000, 34.687427};
{-120.000000, 39.000000};
{-120.000000, 42.000000};
}}, wgs84)
nevada:wkt()
=> "POLYGON ((-120 42, -114 42, -114 34.687427, -120 39, -120 42))"
lasvegas = gis.Point({-115.136389, 36.175}, wgs84)
losangeles = gis.Point({-118.25, 34.05}, wgs84)
nevada:contains(lasvegas)
=> true
nevada:contains(losangeles)
=> false
line = gis.LineString({lasvegas, losangeles}, wgs84)
line:transform(calif5):length()
=> 368.94277529796 - km
nevada:transform(nationalmap):area() * 1e-6
=> 293496.74070953 -- km^2
Tarantool/GIS allows to store any kinds of geometric objects in Lua table and Tarantool spaces, perform kNN, OVERLAPS and other queries using the high-speed in-memory indexes.
Please follow Getting Started guide for further instructions.
Tarantool/GIS - manage geographics primitives as a professional with the speed of Tarantool!