Skip to content

Commit

Permalink
Fix #35 - Add parquet support
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Jul 24, 2023
1 parent 88ec574 commit 5c9c49f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
GADM = "a8dd9ffe-31dc-4cf5-a379-ea69100a8233"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
GeoParquet = "e99870d8-ce00-4fdd-aeee-e09192881159"
Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Expand Down
11 changes: 7 additions & 4 deletions src/GeoTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import Tables
import Meshes

import GADM
import GeoJSON as GJS
import Shapefile as SHP
import GeoJSON as GJS
import GeoParquet as GPQ
import ArchGDAL as AG
import GeoInterface as GI

Expand All @@ -27,9 +28,8 @@ Load geospatial table from file `fname` and convert the
Optionally, specify the `layer` of geometries to read
within the file and keyword arguments `kwargs` accepted
by `Shapefile.Table`, `GeoJSON.read` and `ArchGDAL.read`.
For example, use `numbertype = Float64` to read `.geojson`
geometries with `Float64` precision.
by `Shapefile.Table`, `GeoJSON.read` `GeoParquet.read` and
`ArchGDAL.read`.
The option `lazy` can be used to convert geometries on
the fly instead of converting them immediately.
Expand All @@ -38,6 +38,7 @@ the fly instead of converting them immediately.
- `*.shp` via Shapefile.jl
- `*.geojson` via GeoJSON.jl
- `*.parquet` via GeoParquet.jl
- Other formats via ArchGDAL.jl
"""
function load(fname; layer=0, lazy=false, kwargs...)
Expand All @@ -46,6 +47,8 @@ function load(fname; layer=0, lazy=false, kwargs...)
elseif endswith(fname, ".geojson")
data = Base.read(fname)
table = GJS.read(data; kwargs...)
elseif endswith(fname, ".parquet")
table = GPQ.read(fname)
else # fallback to GDAL
data = AG.read(fname; kwargs...)
table = AG.getlayer(data, layer)
Expand Down
Binary file added test/data/example.parquet
Binary file not shown.

0 comments on commit 5c9c49f

Please sign in to comment.