2

The query:

select st_astext(dn_geom), st_isvalid(dn_geom), st_area(dn_geom) from t$table

Generates an incorrect WKT from a geometry apparently valid:

POLYGON((-2.96954161967213 41.4400844183428,-2.96950750532419 41.4400910442377,-2.96948715573845 41.4400950097163,-2.96947554344911 41.4400972585811,-2.96945962202308 41.4401003615618,-2.96944369975887 41.4401034653807,-2.96931177530061 41.4401290989185,-2.96917985084235 41.4401547332945,-2.96894920348446 41.4401995069094,-2.96894868296824 41.4401996074922,-2.96894798391747 41.4401997432791,-2.96875630570613 41.4402369522258,-2.96823832585221 41.4405354988708,-2.96817342393389 41.4405729601129,-2.96800387311005 41.4406706403037,-2.96798005173981 41.4406-2.96677786044197 41.4413995549544,-2.96640414237032 41.4416216636671,-2.96485357903934 41.4425433067817,-2.96146167994807 41.4445593909843,-2.96040869240291 41.445169481254,-2.95974632336177 41.4455532550955,-2.9590077862856 41.4459811278086,-2.95850920048038 41.4462699707237,-2.95870152158374 41.4461585534309,-2.96146164642046 41.4445593658386,-2.96365168949003 41.4432575782467,-2.96640407531509 41.4416215044109,-2.96727982247799 41.4411009580181,-2.96800385634624 41.4406706067761,-2.9682383266904 41.4405354980326,-2.96875630570613 41.4402369513876,-2.96894798475566 41.4401997424409,-2.96894920264627 41.4401995069094,-2.96917441014867 41.4401557500194,-2.96933617586039 41.4401243203952,-2.96944371736087 41.4401034477787,-2.96948797465044 41.4400948135798,-2.96950750448599 41.4400910408849,-2.96954161967213 41.4400844183428)) | t | 1.01378542099019e-09 (1 row)

This is incorrect: ,-2.96798005173981 41.4406-2.96677786044197 41.4413995549544,

The WKT is missing a coma or ????

The tool i used to get the result of the query is "psql".

How can I repair those geometries? Or locate them at least

I want to load it from arcgis/oracle. They don't load all the geometries but no generate error. I think that fixing this problem i fix the other...

select dn_geom from table :

0103000020A2100000010000002A0000003DD264099FC107C07D21ACAF54B844405AC0A4268DC107C0B42141E754B84440484F5E7B82C107C0A2EE840855B84440FE15CB647CC107C01B55621B55B84440A50DDB0B74C107C0CFEE693555B844407F38CEB26BC107C05055734F55B84440BC59348826C107C0C0EF7A2656B84440F77A9A5DE1C007C0FD5684FD56B84440A59BA37068C007C00FF21A7558B8444092CEC62A68C007C00FF2F27558B84440009BF3CC67C007C0AA8B167758B84440B469564E03C007C07C2638AF59B84440F02642BCF3BE07C045309C7763B844401C3845B5D1BE07C0E597DBB164B844409D458BD078BE07C0B23442E567B844401F394B536CBE07C0F601965C68B844408B34EBBD67BE07C02202648868B84440A22CEBD45FBE07C03ACF35D368B84440D5C2E807F6BB07C0C87FD6C77FB844407E98511832BB07C0DC53050F87B844405B383B2705B807C076D85242A5B844409FDF3DD212B107C01FB47652E7B844402751A5C0EAA440DFA535460CAC07C01C49DBE815B94440ACD327DF06AB07C0F9B8D85F1FB94440E89E0EB46BAB07C086E835B91BB944409BDFBDCD12B107C01FB44052E7B8444037C258048FB507C0102311AABCB844407698510F32BB07C0DA53AF0D87B8444034FD1C34FDBC07C0FF7506FF75B844409A454BCE78BE07C0B234FAE467B84440BCF35EBCF3BE07C077639A7763B84440B469564E03C007C0AF5936AF59B84440CD6710CD67C007C0DEBE147758B84440D7CE867068C007C00FF21A7558B844404FAB5D83DEC007C06CBD0B0657B844405333315333C107C0CB2265FE55B844404E052BB56BC107C082884D4F55B8444050E947E982C107C06DBBDF0655B844408DF387268DC107C081EE39E754B844403DD264099FC107C07D21ACAF54B84440

  • 2
    Probably GIGO -- The original geometry was loaded with Z and M values on that coordinste, but only on that one coordinate. To repair you should fix the load process. – Vince Dec 20 '17 at 11:59
  • For locating select the id of the feature as well. – user30184 Dec 20 '17 at 12:09
  • Nah, this looks like a output formatting issue. What did you use to get the text? Are you 100% certain that the tool you used to get the result of the query did not "squeeze" the text into its output width? – bugmenot123 Dec 20 '17 at 12:13
  • 1
    Vince is right, seems that there is one coordinate with Z value. Using ST_Force_2D before ST_AsText should do the trick. – cag Dec 20 '17 at 13:03
  • 1
    Assuming that's actually the full hex (can you paste it back into your terminal and get a geometry from it? I cannot) it points to internal corruption somewhere, since it's not a valid output ERROR: WKB structure does not match expected size! LINE 1: select st_astext('0103000020A2100000010000002A0000003DD26409... – Paul Ramsey Dec 20 '17 at 14:27
3

Seems that there is one coordinate with Z value. Using ST_Force_2D before ST_AsText should do the trick

SELECT ST_Astext(ST_Force_2D(dn_geom)) generates a correct polygon

POLYGON((-2.96954161967213 41.4400844183428,-2.96950750532419 41.4400910442377,-2.96948715573845 41.4400950097163,-2.96947554344911 41.4400972585811,-2.96945962202308 41.4401003615618,-2.96944369975887 41.4401034653807,-2.96931177530061 41.4401290989185,-2.96917985084235 41.4401547332945,-2.96894920348446 41.4401995069094,-2.96894868296824 41.4401996074922,-2.96894798391747 41.4401997432791,-2.96875630570613 41.4402369522258,-2.96823832585221 41.4405354988708,-2.96817342393389 41.4405729601129,-2.96800387311005 41.4406706403037,-2.96798005173981 41.4406848652324,-2.96797130941429 41.4406900871584,-2.96795622198768 41.4406990063421,-2.96677786044197 41.4413995549544,-2.96640414237032 41.44167903934 41.4425433067817,-2.96146167994807 41.4445593909843,-2.96040869240291 41.445169481254,-2.95974632336177 41.4455532550955,-2.9590077862856 41.4459811278086,-2.95850920048038 41.4462699707237,-2.95870152158374 41.4461585534309,-2.96146164642046 41.4445593658386,-2.96365168949003 41.4432575782467,-2.96640407531509 41.4416215044109,-2.96727982247799 41.4411009580181,-2.96800385634624 41.4406706067761,-2.9682383266904 41.4405354980326,-2.96875630570613 41.4402369513876,-2.96894798475566 41.4401997424409,-2.96894920264627 41.4401995069094,-2.96917441014867 41.4401557500194,-2.96933617586039 41.4401243203952,-2.96944371736087 41.4401034477787,-2.96948797465044 41.4400948135798,-2.96950750448599 41.4400910408849,-2.96954161967213 41.4400844183428))

Correction: My fault. This isn't a correct geometry..

  • 1
    Mark the answer as accepted. :) – cag Dec 20 '17 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.