This extension will provide a GEO
type for DuckDB and enable basic GIS data analysis in it. It is currently a work-in-progress.
It only support geography types and operations.
Actually the geo is build with the version v0.6.2-dev1218.
Be sure to have a compiler and git client installed.
Clone into a folder.
$ git clone ...
$ cd geo
Build it with the command make
At the end of compilation you should have a new build directory present.
$ ls
CMakeLists.txt README.md duckdb geo
Makefile build examples test
Copy the geo duckdb extension to the extensions directory of DuckDB.
cp build/release/extension/geo/geo.duckdb_extension ~/.duckdb/extensions/e2dfc274b0/osx_arm64
note : adapt to your OS and duckdb build
Launch duckdb with unsigned parameter.
duckdb -unsigned
v0.6.2-dev1218 e2dfc274b0
Enter ".help" for usage hints.
D LOAD geo;
D SELECT ST_MAKEPOINT(52.347113,4.869454);
┌────────────────────────────────────────────┐
│ st_makepoint(52.347113, 4.869454) │
│ geography │
├────────────────────────────────────────────┤
│ 01010000001B82E3326E2C4A406B813D26527A1340 │
Install the master version of DuckDB.
$ python
>>> import duckdb
>>> con = duckdb.connect(config={'allow_unsigned_extensions' : 'true'})
>>> con.load('geo')
>>> result = con.execute("SELECT ST_MAKEPOINT(52.347113,4.869454);")
>>> print(result.fetchall())
[(b'\x01\x01\x00\x00\x00\x1b\x82\xe32n,J@k\x81=&Rz\x13@',)]
Constructors (3)
ST_MAKEPOINT
(Alias: ST_GEOGPOINT
)ST_MAKELINE
ST_MAKEPOLYGON
Formatters (4)
ST_ASBINARY
ST_ASGEOJSON
ST_ASTEXT
ST_GEOHASH
Parsers (5)
ST_GEOGFROM
ST_GEOGFROMGEOJSON
ST_GEOGFROMTEXT
ST_GEOGFROMWKB
ST_GEOGPOINTFROMGEOHASH
Accessors (15):
ST_DIMENSION
ST_DUMP
ST_ENDPOINT
ST_GEOMETRYTYPE
ST_ISCLOSED
ST_ISCOLLECTION
ST_ISEMPTY
ST_ISRING
ST_NPOINTS
ST_NUMGEOMETRIES
ST_NUMPOINTS
ST_POINTN
ST_STARTPOINT
ST_X
ST_Y
Transformations (10):
ST_BOUNDARY
ST_BUFFER
ST_CENTROID
ST_CLOSESTPOINT
ST_CONVEXHULL
ST_DIFFERENCE
ST_INTERSECTION
ST_SIMPLIFY
ST_SNAPTOGRID
ST_UNION
Predicates (9)
ST_CONTAINS
ST_COVEREDBY
ST_COVERS
ST_DISJOINT
ST_DWITHIN
ST_EQUALS
ST_INTERSECTS
ST_TOUCHES
ST_WITHIN
Measures (9):
ST_ANGLE
ST_AREA
ST_AZIMUTH
ST_BOUNDINGBOX
(alias: ST_ENVELOPE
)ST_DISTANCE
ST_EXTENT
ST_LENGTH
ST_MAXDISTANCE
ST_PERIMETER
Other (1)
ST_CLUSTERDBSCAN