1 | | Hi, st_astwkb is not returning a valid geometry. As an example: |
| 1 | Indeed, I think the problem was that the code was not in a code block. I meant: |
| 2 | |
| 3 | {{{ |
| 4 | select st_isvalidreason(st_geomfromtwkb(st_astwkb(st_geomfromgeojson('{"type": "Polygon","coordinates": [[[2.1776390993201,41.3722988965004],[2.17763909886103,41.37229889631543],[2.17763909900003,41.3722988970001],[2.1820804568871637,41.37027921005133],[2.18208045654673,41.3702792096251],[2.1776390993201,41.3722988965004]]]}')))) |
| 5 | }}} |
3 | | select st_isvalidreason(st_geomfromtwkb(st_astwkb(st_geomfromgeojson('{"type": "Polygon", "coordinates": [2.1776390993201,41.3722988965004], [2.17763909886103,41.37229889631543],[2.17763909900003,41.3722988970001], [2.1820804568871637,41.37027921005133],[2.18208045654673,41.3702792096251], [2.1776390993201,41.3722988965004]}')))) |
| 7 | |
| 8 | So basically there is no guarantee that st_astwkb returns a valid geometry out of a valid geometry, which it is since the following is true: |
| 9 | |
| 10 | {{{ |
| 11 | select st_isvalid(st_geomfromgeojson('{"type": "Polygon","coordinates": [[[2.1776390993201,41.3722988965004],[2.17763909886103,41.37229889631543],[2.17763909900003,41.3722988970001],[2.1820804568871637,41.37027921005133],[2.18208045654673,41.3702792096251],[2.1776390993201,41.3722988965004]]]}')) |
| 12 | }}} |
| 13 | |
| 14 | Is it possible to at least make twkb return a point instead of invalid geometry? With that one would be able to filter out them using st_extractcollect for example. |
| 15 | |
| 16 | |