#geographic #geospatial #geojson

shapefile-to-geojson

shapefile convert to geojson

5 releases

0.1.4 Sep 9, 2024
0.1.3 Sep 9, 2024
0.1.2 Sep 9, 2024
0.1.1 Sep 9, 2024
0.1.0 Aug 20, 2024

#170 in Geospatial

Download history 151/week @ 2024-08-19 3/week @ 2024-08-26 378/week @ 2024-09-09 55/week @ 2024-09-16 1/week @ 2024-09-23 51/week @ 2024-09-30 2/week @ 2024-10-07

53 downloads per month

MIT license

10KB
196 lines

Shapefile to GeoJSON Converter

This is a Rust library that provides a function to convert a shapefile (a common geospatial data format) to a GeoJSON file. GeoJSON is a lightweight, text-based format for representing geographic data, which is useful for a variety of mapping and data visualization applications.

Example

This is a sample repository of how to use this library. https://github.com/Tomoro0726/shapefile-to-geojson-ex

Usage

To use this library, you can call the convert_shapefile_to_geojson function, providing the input Shapefile path and the output GeoJSON file path:

use shapefile_to_geojson::convert_shapefile_to_geojson;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    convert_shapefile_to_geojson("input.shp", "output.geojson").await?;
    Ok(())
}

This function will read the Shapefile, process the geometric data, and write the resulting GeoJSON to the specified output file.

Installation

To use this crate in your Rust project, add the following to your Cargo.toml file:

[dependencies]
shapefile-to-geojson = "*"

Then, import the crate in your Rust code:

use shapefile_to_geojson::convert_shapefile_to_geojson;

Contributing

Contributions to this project are welcome! If you find any issues or have ideas for improvements, please feel free to open an issue or submit a pull request. We appreciate your help in making this crate better.

Dependencies

~10–21MB
~288K SLoC