Open banesullivan opened 3 years ago
I don't know the merits of the different wkt libraries, but a quick look also shows https://github.com/Esri/terraformer-wkt-parser. That project has been more active recently and appears to have more use.
I think the right way to do this is probably to create a wktReader
analog to the geojsonReader
. We also want to make sure there are convenience functions exposed for converting between the two so that using them with, for instance, annotations would be something like geojson_to_wkt(annotationLayer.geojson())
or annotationLayer.geojson(wkt_to_geojson(wkt))
(or whatever the functions are called).
terraformer could be another good one, I have looked into it as well. Having some capabilities in geojs to read wkt would be nice even if it call a third party library to do the job so perhaps option 2 or 3 might be optimal
WKT projection strings are supported in https://github.com/proj4js/wkt-parser but geometry are not.
This (seemingly no longer maintained) project has support for converting WKT geometry to GeoJSON: https://github.com/mapbox/wellknown.
I see a few potential ways to use this existing tool to support WKT in GeoJS:
mapbox/wellknown
appears to be an old project and has a permissive license, we could adopt some of the code to create our own WKT reader directly in GeoJS.geojsonReader
in GeoJS (not affecting the GeoJS code base at all)Thoughts on a path forward for supporting WKT? I understand introducing a new dependency is something to approach with caution.
Example data: