writeShapefile

fun GeoDataFrame<*>.writeShapefile(directoryPath: String)

Writes this GeoDataFrame into a Shapefile.

The shapefile is written into the specified directory. The resulting files use the directory name as the base file name. For example, writing to roads/ creates roads.shp, roads.shx, roads.dbf, and related files inside that directory.

Each feature in the resulting shapefile corresponds to a single row in this GeoDataFrame:

  • "geometry" value is taken from the geometry column.

  • other column values are written as feature attributes.

The CRS is written to the schema if it is defined in this GeoDataFrame. Otherwise, default CRS is used.

If the target directory does not exist, it is created automatically.

Parameters

directoryPath

a String path to a Shapefile directory


fun GeoDataFrame<*>.writeShapefile(directory: Path)

Writes this GeoDataFrame into a Shapefile.

The shapefile is written into the specified directory. The resulting files use the directory name as the base file name. For example, writing to roads/ creates roads.shp, roads.shx, roads.dbf, and related files inside that directory.

Each feature in the resulting shapefile corresponds to a single row in this GeoDataFrame:

  • "geometry" value is taken from the geometry column.

  • other column values are written as feature attributes.

The CRS is written to the schema if it is defined in this GeoDataFrame. Otherwise, default CRS is used.

If the target directory does not exist, it is created automatically.

Parameters

directory

a Path to a Shapefile directory


fun GeoDataFrame<*>.writeShapefile(directory: File)

Writes this GeoDataFrame into a Shapefile.

The shapefile is written into the specified directory. The resulting files use the directory name as the base file name. For example, writing to roads/ creates roads.shp, roads.shx, roads.dbf, and related files inside that directory.

Each feature in the resulting shapefile corresponds to a single row in this GeoDataFrame:

  • "geometry" value is taken from the geometry column.

  • other column values are written as feature attributes.

The CRS is written to the schema if it is defined in this GeoDataFrame. Otherwise, default CRS is used.

If the target directory does not exist, it is created automatically.

Parameters

directory

a Shapefile directory