diff --git a/README.md b/README.md index 90ace4e..8e4e911 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,18 @@ df = DataFrame(geom=createpoint.(coords), name="test"); GDF.write("test_points.shp", df) ``` -You can also set options such as the layername or crs. +You can also set options such as the layer_name, coordinate reference system, the [driver](https://gdal.org/drivers/vector/) and its options: ```julia import GeoFormatTypes as GFT -GDF.write("test_points.shp", df; layer_name="data", geom_column=:geom, crs=GFT.EPSG(4326)) +GDF.write("test_points.shp", df; layer_name="data", crs=GFT.EPSG(4326), driver="FlatGeoBuf", options=Dict("SPATIAL_INDEX"=>"YES")) +``` + +Note that any Tables.jl compatible table with GeoInterface.jl compatible geometries can be written by GeoDataFrames. You might want +to pass which column(s) contain geometries, or by defining `GeoInterface.geometrycolumns` on your table. Multiple geometry columns, +when enabled by the driver, can be provided in this way. +```julia +table = [(; geom=AG.createpoint(1.0, 2.0), name="test")] +GDF.write(tfn, table; geom_columns=(:geom),) ``` ## Operations diff --git a/docs/src/tutorials/usage.md b/docs/src/tutorials/usage.md index 02860f4..0985177 100644 --- a/docs/src/tutorials/usage.md +++ b/docs/src/tutorials/usage.md @@ -53,15 +53,15 @@ df = DataFrame(geom=createpoint.(coords), name="test"); GDF.write("test_points.shp", df) ``` -You can also set options such as the layername, or crs. +You can also set options such as the layer_name, coordinate reference system. ```julia import GeoFormatTypes as GFT -GDF.write("test_points.shp", df; layer_name="data", geom_column=:geom, crs=GFT.EPSG(4326)) +GDF.write("test_points.shp", df; layer_name="data", crs=GFT.EPSG(4326)) ``` The most common file extensions are recognized, but you can override this or write uncommon files by setting the driver option. See [here](https://gdal.org/drivers/vector/index.html) for a list of (short) driver names. ```julia -GDF.write("test_points.fgb", df; driver="FlatGeobuf") +GDF.write("test_points.fgb", df; driver="FlatGeobuf", options=Dict("SPATIAL_INDEX"=>"YES")) ``` The following extensions are automatically recognized: @@ -75,3 +75,13 @@ The following extensions are automatically recognized: ".gml" => "GML" ".nc" => "netCDF" ``` + +Note that any Tables.jl compatible table with GeoInterface.jl compatible geometries can be written by GeoDataFrames. You might want +to pass which column(s) contain geometries, or by defining `GeoInterface.geometrycolumns` on your table. Multiple geometry columns, +when enabled by the driver, can be provided in this way. +```julia +table = [(; geom=AG.createpoint(1.0, 2.0), name="test")] +GDF.write(tfn, table; geom_columns=(:geom),) +``` +Toggle all file notes +Toggle all file annotations \ No newline at end of file