Skip to main content

read_shapefile

Function read_shapefile 

Source
pub fn read_shapefile(
    shp: &[u8],
    dbf: Option<Vec<u8>>,
    options: JsValue,
) -> Result<JsValue, JsValue>
Expand description

Reads a shapefile back into a GeoJSON FeatureCollection.

The .shx is not needed; the .shp is walked sequentially. Polygon rings are re-nested — each hole is matched to the smallest ring containing it — and rewound to RFC 7946 winding order.

§Arguments

  • shp - Contents of the .shp.
  • dbf - Contents of the .dbf. Optional: without it, features come back with empty properties, which is still useful for inspecting geometry.
  • options - A read::ReadOptions object, or null/undefined.

§Errors

Returns a JavaScript Error when the .shp is truncated or malformed, or holds a shape type this reader does not understand.