https://github.com/glennsl/rescript-geojson
Simple GeoJSON decoder library for ReScript based on @glennsl/rescript-json-combinators.
https://github.com/glennsl/rescript-geojson
geojson rescript
Last synced: about 2 months ago
JSON representation
Simple GeoJSON decoder library for ReScript based on @glennsl/rescript-json-combinators.
- Host: GitHub
- URL: https://github.com/glennsl/rescript-geojson
- Owner: glennsl
- License: mpl-2.0
- Created: 2023-05-27T20:35:27.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T13:01:55.000Z (6 months ago)
- Last Synced: 2025-02-23T04:46:31.523Z (2 months ago)
- Topics: geojson, rescript
- Language: ReScript
- Homepage:
- Size: 20.5 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rescript-geojson
Simple GeoJSON decoder library for ReScript based on @glennsl/rescript-json-combinators.
## Example
```rescript
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
```sh
npm install --save @glennsl/rescript-geojson
```Then add `@glennsl/rescript-geosjon` to `bs-dependencies` in your `bsconfig.json`:
```diff
{
"bs-dependencies": [
+ "@glennsl/rescript-geojson"
]
}
```## License
This work is dual-licensed under [LGPL 3.0](https://choosealicense.com/licenses/lgpl-3.0/) and
[MPL 2.0](https://choosealicense.com/licenses/mpl-2.0/). You can choose between one of them if you use this work.Please see [LICENSE.LGPL-3.0](https://github.com/glennsl/rescript-json-combinators/blob/master/LICENSE.LGPL-3.0) and
[LICENSE.MPL-2.0](https://github.com/glennsl/rescript-json-combinators/blob/master/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