geodaisy icon indicating copy to clipboard operation
geodaisy copied to clipboard

getting 'is not a wkt string' but works fine with shapely

Open mmc1718 opened this issue 4 years ago • 0 comments

Hi, I am using geodaisy to convert wkt that I am getting from an api into geojson to use as part of a webapp. The response strings I get from the api are not recognised as valid wkt strings by geodaisy, but work fine using Shapely. Because of this I am instead loading the string using shapely, and then using geodaisy to convert the shapely object into geojson. I thought I would share in case there is an easy answer to this.

(sorry it's quite long) but below is an example of a response from the api that I am getting a 'not valid wkt string' error for. I wonder if there is something small in the formatting that geodaisy doesn't like.

POLYGON((-0.669431 51.433307,-0.670149 51.433757,-0.670149 51.435554,-0.668714 51.436453,-0.668714 51.437352,-0.667279 51.438251,-0.667279 51.440049,-0.667996 51.440498,-0.668714 51.440049,-0.668714 51.43915,-0.669431 51.4387,-0.670149 51.43915,-0.670149 51.440049,-0.668714 51.440947,-0.670149 51.441846,-0.670149 51.442745,-0.668714 51.443644,-0.668714 51.444543,-0.667996 51.444992,-0.666561 51.444992,-0.665844 51.445442,-0.665844 51.447239,-0.664409 51.448138,-0.664409 51.449936,-0.662256 51.451284,-0.661539 51.450835,-0.661539 51.449936,-0.656516 51.44679,-0.653646 51.44679,-0.652929 51.447239,-0.652929 51.449936,-0.654364 51.450835,-0.654364 51.451733,-0.655081 51.452183,-0.656516 51.452183,-0.657951 51.451284,-0.659386 51.451284,-0.660104 51.451733,-0.660104 51.453531,-0.661539 51.45443,-0.661539 51.457126,-0.660821 51.457576,-0.659386 51.457576,-0.658669 51.458025,-0.660104 51.458924,-0.655081 51.46207,-0.653646 51.46207,-0.652929 51.461621,-0.652929 51.460722,-0.652211 51.460272,-0.650776 51.461171,-0.649341 51.461171,-0.648624 51.461621,-0.648624 51.463418,-0.650059 51.464317,-0.650059 51.465216,-0.648624 51.466115,-0.648624 51.467014,-0.650776 51.468362,-0.652211 51.468362,-0.653646 51.467463,-0.654364 51.467913,-0.654364 51.468811,-0.655799 51.46971,-0.654364 51.470609,-0.654364 51.471508,-0.652929 51.472407,-0.652929 51.476901,-0.655799 51.478699,-0.652211 51.480946,-0.650776 51.480946,-0.650059 51.481395,-0.650059 51.482294,-0.648624 51.483193,-0.648624 51.485889,-0.646471 51.487238,-0.642166 51.487238,-0.641449 51.487687,-0.641449 51.488586,-0.640731 51.489035,-0.639296 51.489035,-0.637861 51.489934,-0.636426 51.489934,-0.634991 51.490833,-0.632121 51.490833,-0.631404 51.491282,-0.632121 51.491732,-0.636426 51.491732,-0.637144 51.492181,-0.637144 51.49308,-0.635709 51.493979,-0.635709 51.496675,-0.634991 51.497125,-0.634274 51.496675,-0.634274 51.495776,-0.633556 51.495327,-0.632839 51.495776,-0.632839 51.496675,-0.632121 51.497125,-0.630686 51.497125,-0.629251 51.496226,-0.627099 51.497574,-0.627099 51.499372,-0.626381 51.499821,-0.622076 51.499821,-0.620641 51.50072,-0.619206 51.50072,-0.618489 51.500271,-0.618489 51.499372,-0.617054 51.498473,-0.617054 51.497574,-0.616336 51.497125,-0.615619 51.497574,-0.615619 51.498473,-0.614901 51.498922,-0.613466 51.498922,-0.612749 51.499372,-0.614184 51.500271,-0.613466 51.50072,-0.612031 51.50072,-0.611314 51.50117,-0.611314 51.502068,-0.610596 51.502518,-0.609161 51.502518,-0.607726 51.503417,-0.606291 51.502518,-0.603421 51.502518,-0.602704 51.502967,-0.602704 51.503866,-0.603421 51.504315,-0.604856 51.504315,-0.605574 51.504765,-0.605574 51.506563,-0.604856 51.507012,-0.601986 51.507012,-0.600551 51.507911,-0.599116 51.507911,-0.594811 51.510607,-0.593376 51.509708,-0.590506 51.509708,-0.589071 51.50881,-0.587636 51.509708,-0.586201 51.509708,-0.584766 51.510607,-0.583331 51.510607,-0.581896 51.511506,-0.579026 51.511506,-0.578308 51.511057,-0.578308 51.510158,-0.577591 51.509708,-0.574721 51.509708,-0.574003 51.510158,-0.574003 51.511956,-0.573286 51.512405,-0.567546 51.512405,-0.566111 51.513304,-0.564676 51.513304,-0.563241 51.514203,-0.561806 51.514203,-0.561088 51.514652,-0.561088 51.515551,-0.559653 51.51645,-0.561088 51.517349,-0.560371 51.517798,-0.557501 51.517798,-0.556066 51.516899,-0.555348 51.517349,-0.555348 51.518247,-0.554631 51.518697,-0.553196 51.518697,-0.552478 51.518247,-0.552478 51.51645,-0.551761 51.516,-0.551043 51.51645,-0.551043 51.517349,-0.548173 51.519146,-0.548173 51.520045,-0.547456 51.520495,-0.546738 51.520045,-0.546738 51.518247,-0.544586 51.516899,-0.543868 51.517349,-0.543868 51.520045,-0.541716 51.521393,-0.537411 51.521393,-0.536693 51.521843,-0.536693 51.522742,-0.535976 51.523191,-0.533106 51.521393,-0.530236 51.521393,-0.529518 51.521843,-0.529518 51.522742,-0.527366 51.52409,-0.526648 51.52364,-0.526648 51.521843,-0.525931 51.521393,-0.523061 51.521393,-0.521626 51.522292,-0.520191 51.521393,-0.518756 51.521393,-0.517321 51.520495,-0.515886 51.520495,-0.515168 51.520045,-0.515886 51.519596,-0.517321 51.519596,-0.518038 51.519146,-0.518038 51.518247,-0.517321 51.517798,-0.514451 51.517798,-0.513733 51.517349,-0.513733 51.513753,-0.51158 51.512405,-0.50871 51.512405,-0.507275 51.511506,-0.506558 51.511956,-0.506558 51.513753,-0.504405 51.515102,-0.498665 51.515102,-0.49723 51.516,-0.49436 51.516,-0.493643 51.515551,-0.493643 51.514652,-0.492925 51.514203,-0.49149 51.514203,-0.490773 51.514652,-0.490773 51.51645,-0.492208 51.517349,-0.49149 51.517798,-0.48862 51.517798,-0.487185 51.516899,-0.48575 51.516899,-0.485033 51.517349,-0.485033 51.518247,-0.486468 51.519146,-0.483598 51.520944,-0.483598 51.521843,-0.481445 51.523191,-0.48001 51.522292,-0.478575 51.522292,-0.475705 51.52409,-0.473553 51.522742,-0.473553 51.520944,-0.472835 51.520495,-0.470683 51.521843,-0.470683 51.522742,-0.469965 51.523191,-0.469248 51.522742,-0.469248 51.521843,-0.46853 51.521393,-0.467095 51.522292,-0.461355 51.518697,-0.45992 51.518697,-0.459203 51.518247,-0.459203 51.517349,-0.458485 51.516899,-0.452745 51.516899,-0.452028 51.51645,-0.452028 51.515551,-0.452745 51.515102,-0.45418 51.515102,-0.456333 51.513753,-0.455615 51.513304,-0.452745 51.513304,-0.45131 51.514203,-0.449158 51.512854,-0.449158 51.50836,-0.44557 51.506113,-0.4427 51.506113,-0.441265 51.505214,-0.43983 51.505214,-0.438395 51.504315,-0.43409 51.504315,-0.433373 51.503866,-0.433373 51.502967,-0.431938 51.502068,-0.433373 51.50117,-0.433373 51.500271,-0.432655 51.499821,-0.43122 51.499821,-0.42835 51.498024,-0.426915 51.498024,-0.426197 51.497574,-0.427632 51.496675,-0.427632 51.495776,-0.426197 51.494878,-0.426197 51.493979,-0.424762 51.49308,-0.424762 51.491282,-0.423327 51.490383,-0.423327 51.489485,-0.42261 51.489035,-0.421892 51.489485,-0.421892 51.490383,-0.420457 51.491282,-0.420457 51.492181,-0.41974 51.492631,-0.41687 51.492631,-0.415435 51.493529,-0.414 51.492631,-0.413282 51.49308,-0.413282 51.495776,-0.410412 51.497574,-0.410412 51.498473,-0.409695 51.498922,-0.408977 51.498473,-0.408977 51.494878,-0.40826 51.494428,-0.406825 51.494428,-0.403955 51.496226,-0.40252 51.495327,-0.401085 51.495327,-0.400367 51.495776,-0.401802 51.496675,-0.401802 51.497574,-0.401085 51.498024,-0.39965 51.498024,-0.397497 51.496675,-0.398932 51.495776,-0.397497 51.494878,-0.397497 51.493979,-0.394627 51.492181,-0.394627 51.489485,-0.39104 51.487238,-0.383865 51.487238,-0.381712 51.488586,-0.381712 51.489485,-0.380995 51.489934,-0.37956 51.489035,-0.378125 51.489035,-0.377407 51.488586,-0.377407 51.487687,-0.373102 51.48499,-0.373102 51.483193,-0.372385 51.482743,-0.369515 51.482743,-0.36808 51.481844,-0.366645 51.481844,-0.365927 51.481395,-0.365927 51.480496,-0.36521 51.480047,-0.363775 51.480047,-0.363057 51.479597,-0.363057 51.478699,-0.364492 51.4778,-0.364492 51.475103,-0.36234 51.473755,-0.360905 51.473755,-0.358035 51.471957,-0.355165 51.471957,-0.353012 51.470609,-0.354447 51.46971,-0.354447 51.467913,-0.355882 51.467014,-0.355882 51.464317,-0.358752 51.462519,-0.358752 51.460722,-0.36234 51.458475,-0.363775 51.459374,-0.36808 51.459374,-0.368797 51.458924,-0.367362 51.458025,-0.367362 51.45443,-0.366645 51.453981,-0.363775 51.453981,-0.361622 51.452632,-0.361622 51.451733,-0.363775 51.450385,-0.36521 51.450385,-0.365927 51.449936,-0.365927 51.449037,-0.363057 51.447239,-0.363057 51.44634,-0.36234 51.445891,-0.360905 51.445891,-0.358752 51.444543,-0.360187 51.443644,-0.360187 51.440947,-0.35947 51.440498,-0.3566 51.440498,-0.355882 51.440049,-0.358752 51.438251,-0.358752 51.436453,-0.360187 51.435554,-0.360187 51.433757,-0.357317 51.431959,-0.357317 51.43106,-0.35947 51.429712,-0.360905 51.429712,-0.361622 51.429262,-0.360187 51.428364,-0.360187 51.427465,-0.363057 51.425667,-0.363057 51.424768,-0.36234 51.424319,-0.360905 51.424319,-0.35947 51.425218,-0.358035 51.425218,-0.355882 51.423869,-0.3566 51.42342,-0.358035 51.42342,-0.358752 51.422971,-0.358752 51.422072,-0.357317 51.421173,-0.357317 51.420274,-0.355882 51.419375,-0.355882 51.417578,-0.354447 51.416679,-0.355882 51.41578,-0.355882 51.413982,-0.35373 51.412634,-0.352295 51.412634,-0.350142 51.411286,-0.352295 51.409937,-0.355165 51.409937,-0.358035 51.411735,-0.366645 51.411735,-0.36808 51.410836,-0.369515 51.410836,-0.372385 51.409039,-0.37382 51.409039,-0.375255 51.40814,-0.37669 51.409039,-0.37956 51.407241,-0.380995 51.40814,-0.38243 51.40814,-0.383865 51.409039,-0.3853 51.409039,-0.386735 51.40814,-0.38817 51.40814,-0.389605 51.409039,-0.39104 51.409039,-0.391757 51.408589,-0.391757 51.40769,-0.392475 51.407241,-0.39391 51.407241,-0.395345 51.40814,-0.39678 51.40814,-0.398215 51.407241,-0.39965 51.407241,-0.403955 51.404544,-0.40539 51.405443,-0.406107 51.404994,-0.406107 51.404095,-0.403955 51.402747,-0.40252 51.402747,-0.401085 51.401848,-0.39965 51.402747,-0.398215 51.402747,-0.39678 51.403646,-0.395345 51.403646,-0.393192 51.402297,-0.394627 51.401398,-0.394627 51.399601,-0.39391 51.399151,-0.392475 51.399151,-0.391757 51.398702,-0.391757 51.396904,-0.392475 51.396455,-0.393192 51.396904,-0.393192 51.397803,-0.395345 51.399151,-0.396062 51.398702,-0.396062 51.394208,-0.39678 51.393758,-0.397497 51.394208,-0.397497 51.395107,-0.398215 51.395556,-0.39965 51.395556,-0.400367 51.395107,-0.400367 51.393309,-0.398932 51.39241,-0.398932 51.391511,-0.398215 51.391062,-0.39678 51.391062,-0.395345 51.390163,-0.39391 51.390163,-0.393192 51.389714,-0.393192 51.388815,-0.394627 51.387916,-0.394627 51.386118,-0.397497 51.384321,-0.397497 51.383422,-0.39678 51.382972,-0.395345 51.382972,-0.394627 51.383422,-0.394627 51.384321,-0.39391 51.38477,-0.392475 51.38477,-0.391757 51.384321,-0.391757 51.380725,-0.393192 51.379826,-0.393192 51.378928,-0.391757 51.378029,-0.391757 51.37713,-0.392475 51.37668,-0.39391 51.37668,-0.394627 51.376231,-0.394627 51.375332,-0.397497 51.373535,-0.397497 51.372636,-0.396062 51.371737,-0.396062 51.370838,-0.394627 51.369939,-0.39678 51.368591,-0.398215 51.36949,-0.40252 51.36949,-0.403237 51.36904,-0.401802 51.368141,-0.401802 51.367243,-0.40252 51.366793,-0.40539 51.366793,-0.406825 51.365894,-0.412565 51.365894,-0.413282 51.366344,-0.413282 51.367243,-0.414 51.367692,-0.416152 51.366344,-0.416152 51.365445,-0.418305 51.364097,-0.421175 51.364097,-0.421892 51.363647,-0.421892 51.362748,-0.424045 51.3614,-0.42548 51.3614,-0.426197 51.360951,-0.426197 51.360052,-0.426915 51.359603,-0.42835 51.359603,-0.429068 51.359153,-0.429068 51.358254,-0.432655 51.356007,-0.438395 51.356007,-0.440548 51.354659,-0.440548 51.35376,-0.4427 51.352412,-0.444135 51.352412,-0.44557 51.353311,-0.447005 51.353311,-0.449158 51.351962,-0.449158 51.350165,-0.447723 51.349266,-0.447723 51.348367,-0.447005 51.347918,-0.44557 51.347918,-0.444853 51.347468,-0.447005 51.34612,-0.449875 51.34612,-0.45131 51.345221,-0.45418 51.347019,-0.455615 51.347019,-0.456333 51.346569,-0.456333 51.345671,-0.45705 51.345221,-0.45992 51.345221,-0.461355 51.344322,-0.46279 51.344322,-0.463508 51.344772,-0.463508 51.345671,-0.46566 51.347019,-0.46853 51.347019,-0.469248 51.346569,-0.469248 51.345671,-0.470683 51.344772,-0.470683 51.343873,-0.469248 51.342974,-0.470683 51.342075,-0.470683 51.340278,-0.4714 51.339828,-0.472835 51.339828,-0.47427 51.338929,-0.474988 51.339379,-0.474988 51.340278,-0.475705 51.340727,-0.478575 51.340727,-0.48001 51.339828,-0.481445 51.339828,-0.48288 51.338929,-0.483598 51.339379,-0.483598 51.341176,-0.484315 51.341626,-0.485033 51.341176,-0.485033 51.337581,-0.48575 51.337132,-0.487185 51.337132,-0.490055 51.338929,-0.49149 51.338929,-0.492208 51.339379,-0.492208 51.340278,-0.49149 51.340727,-0.490055 51.340727,-0.489338 51.341176,-0.489338 51.342075,-0.48862 51.342525,-0.487185 51.342525,-0.486468 51.342974,-0.486468 51.346569,-0.487185 51.347019,-0.48862 51.34612,-0.490055 51.34612,-0.49149 51.345221,-0.492925 51.345221,-0.49723 51.342525,-0.498665 51.342525,-0.5001 51.341626,-0.50297 51.343423,-0.50871 51.343423,-0.510145 51.342525,-0.51158 51.342525,-0.513015 51.343423,-0.514451 51.342525,-0.515168 51.342974,-0.515168 51.344772,-0.515886 51.345221,-0.517321 51.345221,-0.520191 51.343423,-0.521626 51.344322,-0.525931 51.344322,-0.527366 51.343423,-0.528801 51.344322,-0.530236 51.344322,-0.531671 51.345221,-0.533106 51.345221,-0.535976 51.347019,-0.537411 51.347019,-0.539563 51.345671,-0.539563 51.343873,-0.538128 51.342974,-0.539563 51.342075,-0.539563 51.341176,-0.540281 51.340727,-0.541716 51.341626,-0.543151 51.341626,-0.545303 51.342974,-0.545303 51.344772,-0.543868 51.345671,-0.543868 51.347468,-0.544586 51.347918,-0.546021 51.347918,-0.546738 51.348367,-0.546738 51.349266,-0.549608 51.351064,-0.549608 51.352861,-0.550326 51.353311,-0.553196 51.353311,-0.555348 51.351962,-0.555348 51.351064,-0.557501 51.349715,-0.560371 51.349715,-0.561806 51.350614,-0.563241 51.350614,-0.564676 51.349715,-0.566828 51.351064,-0.565393 51.351962,-0.565393 51.352861,-0.566111 51.353311,-0.567546 51.353311,-0.568263 51.35376,-0.568263 51.358254,-0.568981 51.358704,-0.571133 51.357355,-0.571133 51.356457,-0.571851 51.356007,-0.573286 51.356007,-0.574721 51.356906,-0.575438 51.356457,-0.575438 51.35376,-0.576156 51.353311,-0.576873 51.35376,-0.576873 51.354659,-0.577591 51.355108,-0.581896 51.355108,-0.584048 51.356457,-0.584048 51.357355,-0.587636 51.359603,-0.589071 51.358704,-0.591941 51.358704,-0.594811 51.356906,-0.596246 51.356906,-0.597681 51.357805,-0.599116 51.357805,-0.600551 51.358704,-0.601986 51.358704,-0.602704 51.358254,-0.602704 51.357355,-0.604856 51.356007,-0.606291 51.356906,-0.607726 51.356007,-0.611314 51.358254,-0.611314 51.360052,-0.609879 51.360951,-0.613466 51.363198,-0.614901 51.363198,-0.616336 51.364097,-0.620641 51.364097,-0.622076 51.364996,-0.624946 51.364996,-0.626381 51.365894,-0.627816 51.364996,-0.628534 51.365445,-0.627099 51.366344,-0.628534 51.367243,-0.627099 51.368141,-0.627099 51.369939,-0.627816 51.370389,-0.630686 51.370389,-0.632121 51.36949,-0.632839 51.369939,-0.631404 51.370838,-0.632839 51.371737,-0.632839 51.373535,-0.634274 51.374433,-0.633556 51.374883,-0.632121 51.373984,-0.631404 51.374433,-0.631404 51.375332,-0.629969 51.376231,-0.629969 51.37713,-0.631404 51.378029,-0.631404 51.378928,-0.632121 51.379377,-0.633556 51.379377,-0.634274 51.378928,-0.634274 51.378029,-0.634991 51.377579,-0.636426 51.377579,-0.640014 51.379826,-0.640014 51.380725,-0.640731 51.381175,-0.642166 51.381175,-0.644319 51.382523,-0.644319 51.384321,-0.645036 51.38477,-0.645754 51.384321,-0.645754 51.383422,-0.646471 51.382972,-0.647906 51.382972,-0.649341 51.383871,-0.650776 51.383871,-0.651494 51.384321,-0.648624 51.386118,-0.648624 51.388815,-0.649341 51.389264,-0.650776 51.389264,-0.651494 51.389714,-0.647189 51.39241,-0.647189 51.393309,-0.647906 51.393758,-0.649341 51.39286,-0.650776 51.39286,-0.651494 51.393309,-0.650059 51.394208,-0.650059 51.395107,-0.652929 51.396904,-0.651494 51.397803,-0.651494 51.398702,-0.653646 51.40005,-0.655081 51.40005,-0.656516 51.399151,-0.657234 51.399601,-0.657234 51.4005,-0.657951 51.400949,-0.660821 51.400949,-0.661539 51.401398,-0.661539 51.404095,-0.660104 51.404994,-0.660104 51.40769,-0.660821 51.40814,-0.662256 51.40814,-0.662974 51.408589,-0.662974 51.409488,-0.662256 51.409937,-0.660821 51.409937,-0.658669 51.411286,-0.660104 51.412185,-0.660104 51.413083,-0.660821 51.413533,-0.662256 51.413533,-0.662974 51.413982,-0.662256 51.414432,-0.659386 51.414432,-0.657951 51.41533,-0.656516 51.414432,-0.655799 51.414881,-0.655799 51.416679,-0.656516 51.417128,-0.657951 51.416229,-0.658669 51.416679,-0.658669 51.418476,-0.660104 51.419375,-0.658669 51.420274,-0.658669 51.421173,-0.655799 51.422971,-0.655799 51.425667,-0.657951 51.427015,-0.660821 51.427015,-0.661539 51.427465,-0.661539 51.428364,-0.662256 51.428813,-0.663691 51.428813,-0.666561 51.427015,-0.667279 51.427465,-0.667279 51.428364,-0.668714 51.429262,-0.668714 51.432858,-0.669431 51.433307))

Thanks!

mmc1718 avatar Aug 30 '20 20:08 mmc1718