GeoTables.jl
Load geospatial tables from known file formats and convert the geometries to Meshes.jl geometries that are compatible with the GeoStats.jl ecosystem.
Geometries are loaded from disk in pure Julia whenever possible using packages such as Shapefile.jl and GeoJSON.jl, or (down)loaded from the internet using the GADM.jl package.
Usage
Loading/saving data from/to disk
The load
and save
functions are self-explanatory:
using GeoTables
table = GeoTables.load("file.shp")
GeoTables.save("file.geojson", table)
Additional keyword arguments can be passed to load
and save
functions. Valid
arguments are those accepted by GeoJSON.read
, GeoJSON.write
, Shapefile.Table
,
Shapefile.write
and ArchGDAL.read
. See below some examples:
# read `.geojson` geometries with Float64 precision
table = GeoTables.load("file.geojson", numbertype = Float64)
# force writing on existing `.shp` file
GeoTables.save("file.shp", table, force = true)
Loading data from GADM
The gadm
function (down)loads data from the GADM dataset:
julia> GeoTables.gadm("BRA", depth = 1)
Please read the docstring for more details.
Performance tips
The result can be easily converted into any other geotable type
to avoid converting the geometries every time the underlying
domain is queried. For example, assuming that table
has been
loaded with the functions above, the following code can be used
to convert the table to pure Julia geometries:
using GeoStats
table |> GeoData
Asking for help
If you have any questions, please contact our community.