File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,43 @@ const { s2 } = require('s2js')
3434 </script >
3535```
3636
37+ ### GeoJSON support
38+
39+ The supplementary ` geojson ` module provides convenience functions for working with GeoJSON data in S2:
40+
41+ ``` js
42+ import { geojson } from ' s2js'
43+
44+ const s2Polyline = geojson .fromGeoJSON ({
45+ type: ' LineString' ,
46+ coordinates: [
47+ [102.0 , 0.0 ],
48+ [103.0 , 1.0 ],
49+ [104.0 , 0.0 ],
50+ [105.0 , 1.0 ]
51+ ]
52+ })
53+ ```
54+
55+ The ` RegionCoverer ` supports all geometry types including multi-geometries:
56+
57+ ``` js
58+ const coverer = new geojson.RegionCoverer ({ maxCells: 30 })
59+
60+ const union = coverer .covering ({
61+ type: ' Polygon' ,
62+ coordinates: [
63+ [
64+ [100.0 , 0.0 ],
65+ [101.0 , 0.0 ],
66+ [101.0 , 1.0 ],
67+ [100.0 , 1.0 ],
68+ [100.0 , 0.0 ]
69+ ]
70+ ]
71+ })
72+ ```
73+
3774### Contributing
3875
3976If you'd like to contribute a module please open an Issue to discuss.
You can’t perform that action at this time.
0 commit comments