Closed sckott closed 8 years ago
Some possible WKT validation errors (I am not super-familiar with the WKT spec, so don't know if these should be failing or not). They are all to do with extra whitespaces:
The starting point, which validates as TRUE:
wellknown::lint("POLYGON((154 -43.74, 154 -9, 112.9 -9, 112.9 -43.74, 154 -43.74))")
And variants thereon:
## whitespace before commas
wellknown::lint("POLYGON((154 -43.74 , 154 -9, 112.9 -9, 112.9 -43.74, 154 -43.74))")
## whitespace after ((
wellknown::lint("POLYGON(( 154 -43.74, 154 -9, 112.9 -9, 112.9 -43.74, 154 -43.74))")
## whitespace before ))
wellknown::lint("POLYGON((154 -43.74, 154 -9, 112.9 -9, 112.9 -43.74, 154 -43.74 ))")
These all fail validation (wellknown v0.1.0). FWIW these three are accepted by rgeos::readWKT (rgeos v 0.3-8).
thanks, i'll have a look
okay, try reinstalling, should work now. devtools::install_github("ropensci/wellknown")
Yup, those pass now. Thanks
great!
@raymondben keep in mind that this wkt linter is just R regex, so it is lightweight, and avoids requiring GDAL/GEOS - thanks for helping make it better
No good solution right now for validating wkt strings. Could use geos C library, but way to heavy just for validating. There doesn't seem to be any web APIs for this. The Python client
geomet
simply throws an error if the string doesn't parse.Could work on a R validator - then reimplement in C if super slow.