Changes between Initial Version and Version 1 of Ticket #4585, comment 2


Ignore:
Timestamp:
Nov 19, 2019, 6:49:17 AM (4 years ago)
Author:
furstenheim

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4585, comment 2

    initial v1  
    1 Hi, st_astwkb is not returning a valid geometry. As an example:
     1Indeed, I think the problem was that the code was not in a code block. I meant:
     2   
     3{{{
     4select 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}}}
    26
    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
     8So 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{{{
     11select 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
     14Is 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