Simple GeoJSON decoder library for ReScript based on @glennsl/rescript-json-combinators.
Example
let json = %raw(`{ type: 'Feature', geometry: { type: 'Polygon', coordinates: [ [ [-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0], ], ], }, properties: null, }`) switch json->Json.decode(GeoJSON.Decode.object) { | Ok(Feature({geometry: Polygon({coordinates})})) => Js.log2("Polygon coordinates: ", coordinates) | Ok(_) => Js.log("not a feature with polygon?!") | Error(err) => Js.log(err) }
Installation
npm install --save @glennsl/rescript-geojson
Then add @glennsl/rescript-geosjon to bs-dependencies in your bsconfig.json:
{
"bs-dependencies": [
+ "@glennsl/rescript-geojson"
]
}License
This work is dual-licensed under LGPL 3.0 and MPL 2.0. You can choose between one of them if you use this work.
Please see LICENSE.LGPL-3.0 and LICENSE.MPL-2.0 for the full text of each license.
SPDX-License-Identifier: LGPL-3.0 OR MPL-2.0
Changes
1.0.0
Initial release