wasm-spatial-core
    Preparing search index...

    Function geoJsonFromCoords

    • Generate a standard GeoJSON Feature string from coordinate buffer and geometry type.

      Arguments

      • coords — Flat Float64Array [lng0, lat0, lng1, lat1, …]
      • geometry_type — One of: "Point", "LineString", "Polygon", "MultiPoint"

      Returns

      A JSON string representing a GeoJSON Feature.

      Example (JS)

      const coords = new Float64Array([116.404, 39.915]);
      const json = core.geoJsonFromCoords(coords, "Point");
      // json = '{"type":"Feature","geometry":{"type":"Point","coordinates":[116.404,39.915]},"properties":{}}'

      Parameters

      • coords: Float64Array
      • geometry_type: string

      Returns string