Skip to main content

Crate shapefile_wasm

Crate shapefile_wasm 

Source
Expand description

Reads and writes ESRI Shapefiles from GeoJSON, entirely in memory.

The public surface is deliberately small: hand it GeoJSON, get back the raw .shp / .shx / .dbf byte buffers — or hand it those bytes and get GeoJSON back. Zipping, projection files and anything browser-shaped is left to the TypeScript layer, which keeps the wasm binary small and this core usable from plain Rust too.

§Entry points

Modules§

error
geometry
Turns parsed GeoJSON geometries into concrete shapefile shapes.
input
Parsing of the GeoJSON that comes in from JavaScript.
read
Reads shapefile components back into GeoJSON.
schema
Derives a dBase table schema from GeoJSON properties.

Structs§

FieldReport
What one column became in the .dbf, so callers can report renames.
Options
Caller-tunable knobs. Every field is optional; the defaults suit most data.
ShapefileParts
The generated shapefile components, plus what was inferred along the way.

Functions§

read_shapefile
Reads a shapefile back into a GeoJSON FeatureCollection.
read_shapefile_to_json
Reads a shapefile and returns GeoJSON as a string.
set_panic_hook
Routes Rust panics to console.error with a readable message and stack.
write_shapefile
Builds a shapefile from a GeoJSON value passed straight across the wasm boundary.
write_shapefile_from_json
Builds a shapefile from a GeoJSON string.