GeoDataFrames.jl

Simple geographical vector interaction built on top of ArchGDAL
Author evetion
Popularity
15 Stars
Updated Last
1 Year Ago
Started In
December 2020

GeoDataFrames

Stable Dev Build Status

Simple geographical vector interaction built on top of ArchGDAL. Inspiration from geopandas.

** this is a beta, it needs polishing **

Installation

]add GeoDataFrame

Usage

Writing

using GeoDataFrames; const GDF=GeoDataFrames
using DataFrames

coords = zip(rand(10), rand(10))
df = DataFrame(geom=createpoint.(coords), name="test");
GDF.write("test_points.shp", df)

You can also set options such as the layername or crs.

using GeoFormatTypes; const GFT = GeoFormatTypes
GDF.write("test_points.shp", df; layer_name="data", geom_column=:geom, crs=GFT.EPSG(4326))

Reading

df = GDF.read("test_points.shp")
10×2 DataFrame
 Row │ name    geom
     │ String  IGeometr…
─────┼───────────────────────────────────────────
   1 │ test    Geometry: POINT (0.23609264003532 │ test    Geometry: POINT (0.24456194534603 │ test    Geometry: POINT (0.45046634683714 │ test    Geometry: POINT (0.08869898555865 │ test    Geometry: POINT (0.03233449386066 │ test    Geometry: POINT (0.15742329856967 │ test    Geometry: POINT (0.96771529487768 │ test    Geometry: POINT (0.00473289467159 │ test    Geometry: POINT (0.738924186291710 │ test    Geometry: POINT (0.1207370929831

You can also specify the layer index or layer name in opening, useful if there are multiple layers:

GDF.read("test_points.shp", 0)
GDF.read("test_points.shp", "test_points")

Any keywords arguments are passed on to the underlying ArchGDAL read function:

GDF.read("test.csv", options=["GEOM_POSSIBLE_NAMES=point,linestring", "KEEP_GEOM_COLUMNS=NO"])

Geometric operations

df.geom = buffer(df.geom, 10);
df
10×2 DataFrame
 Row │ name    geom
     │ String  IGeometr…
─────┼───────────────────────────────────────────
   1 │ test    Geometry: POLYGON ((20.6382877172 │ test    Geometry: POLYGON ((20.8853748283 │ test    Geometry: POLYGON ((20.2708968314 │ test    Geometry: POLYGON ((20.0237995915 │ test    Geometry: POLYGON ((20.8020423716 │ test    Geometry: POLYGON ((20.6955736467 │ test    Geometry: POLYGON ((20.9021890408 │ test    Geometry: POLYGON ((20.1145542579 │ test    Geometry: POLYGON ((20.59924297110 │ test    Geometry: POLYGON ((20.937183925

Reprojection

using GeoFormatTypes; const GFT=GeoFormatTypes
df.geom = reproject(df.geom, GFT.EPSG(4326), GFT.EPSG(28992))
df
10×2 DataFrame
 Row │ geom                               name
     │ IGeometr…                          String
─────┼───────────────────────────────────────────
   1 │ Geometry: POLYGON ((-461372.5299…  test
   2 │ Geometry: POLYGON ((-405767.2483…  test
   3 │ Geometry: POLYGON ((-423945.8813…  test
   4 │ Geometry: POLYGON ((-426947.9961…  test
   5 │ Geometry: POLYGON ((-424503.7859…  test
   6 │ Geometry: POLYGON ((-412986.0226…  test
   7 │ Geometry: POLYGON ((-453290.1043…  test
   8 │ Geometry: POLYGON ((-480255.6989…  test
   9 │ Geometry: POLYGON ((-418753.1604…  test
  10 │ Geometry: POLYGON ((-435978.6036…  test

Plotting

using Plots
plot(df.geom)

image

TODO

  • Prepared geometry, spatial indices (LibGEOS) (probably can't be done as GDAL OGR is not directly compatible)
  • IGeometry should be IGeometry{WKBType} for easy Schema detection, fix upstream
  • Empty geom column name fix should be moved upstream
  • More drivers selected on extension
  • CRS stored in metadata
  • Work on Geointerface integration
  • Work on spatial joins/filters
  • Override showing of WKT geometry on print for performance

Used By Packages

No packages found.