Skip to content

Commit

Permalink
Document new interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Jun 23, 2022
1 parent 424d0b7 commit ff27288
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions docs/src/tutorials/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

2 comments on commit ff27288

@evetion
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/62940

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" ff27288d09b8c2ce9065c501dea22796601f0285
git push origin v0.3.0

Please sign in to comment.