Getting Started¶
Please jump to Using the Software section if you are familiar with Tarantool.
Prerequisites¶
This software is a module for Tarantool Database. Tarantool 1.6.8 or newer is recommended.
Tarantool/GIS depends on the following third-party libraries:
Installing GEOS and PROJ.4¶
Use the following command on Debian-based distros:
sudo apt-get instal libgeos-dev libproj-dev # Debian/Ubuntu
Use the following command on RPM-based distros:
sudo yum install geos-devel proj-devel # Fedora/RHEL/CentOS
Installing Tarantool and Tarantool/GIS¶
Please install Tarantool using packages for your distribution from http://tarantool.org/.
Tarantool/GIS also can be installed from the same repositories using
tarantool-gis
name.
sudo apt-get install tarantool-gis # Debian/Ubuntu
sudo yum install tarantool-gis # Fedora/RHEL/CentOS
Using the Software¶
Ensure that freshly installed Tarantool works:
$ tarantool
tarantool: version 1.6.8-701-g599ddf2
type 'help' for interactive help
tarantool> box.cfg({ logger = 'tarantool.log' })
[CUT]
tarantool> gis = require('gis')
---
...
tarantool> gis.install()
---
...
gis.install()
function will create spatial_ref_sys and other system
tables in Tarantool.
Now you can use Tarantool/GIS:
tarantool> point = gis.Point({37.17284, 55.74495}, 4326)
tarantool> point
---
- POINT (37.17284 55.74495) # WKT (for humans)
...
tarantool> point:hex()
---
- 010100000067B8019F1F964240DE9387855ADF4B40 # WKB HEX (for PostGIS users)
...
tarantool> point:table()
---
- [37.17284, 55.74495] # Lua Tables
- 4326
...
tarantool> box.space.spatial_ref_sys:get(4326)[4]
---
- GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
...