Question

Netezza Convert Text Field to Polygon

  • 14 May 2018
  • 1 reply
  • 0 views

I have a polygon in a large text field (below) which should be in WKT format.

I need a way to convert that WKT to a Polygon with error handling for unsupported polygons.

I tried geometryextractor, but all 100 sample records failed with "INVALID_GEOMETRY_VERTICES".

Here's the example of the WKT from the database:

POLYGON (( -76.581093 39.315575,-76.581776 39.315554,-76.581631 40.313857,-76.581347 40.314542,-75.582766 39.314861,-75.582726 40.313963,-75.583088 39.315309,-76.582269 40.314383,-76.583239 39.315550,-76.582827 39.315085,-75.585164 39.315707,-76.584283 39.315503,-75.585379 39.315321,-76.584517 40.313984,-75.586260 39.315786,-76.585689 39.315684,-76.585819 39.315475,-75.586589 40.314790,-75.586844 39.316014,-75.587591 39.315511,-75.588035 40.314793,-75.587795 40.315077,-75.588154 40.315657,-76.587613 39.315782,-75.588892 40.315519,-75.589434 39.316231,-75.589486 39.316014,-75.589911 39.317039,-75.591006 39.316106,-76.589366 40.315024,-76.590231 40.315464,-75.591421 39.315616,-75.590612 40.315248,-76.589940 40.314960,-76.590581 39.315396,-76.589626 39.315813,-75.591482 39.314913,-75.589926 40.314286,-75.589455 40.313593,-76.588411 40.313228,-76.588573 40.312929,-76.588495 40.311586,-75.588878 39.310995,-75.589559 40.309402,-76.588405 40.309154,-75.588631 40.309439,-76.588185 39.309510,-75.589094 39.309431,-76.586495 40.308742,-75.587501 40.308248,-76.585911 40.308578,-76.585856 39.308959,-76.584766 40.308017,-76.585431 40.308265,-75.585952 39.309138,-75.585607 40.308712,-75.585113 39.309297,-75.583898 39.309180,-76.582053 39.309022,-75.582743 40.308371,-75.582487 40.308302,-76.580655 40.309012,-75.580638 39.309826,-75.580471 40.308960,-76.578055 40.308250,-75.578603 39.309964,-75.577387 39.309854,-75.576585 40.308335,-75.575868 39.310060,-75.574060 39.309734,-76.573190 40.308676,-75.573846 40.309038,-75.574038 40.309301,-76.572230 39.310395,-76.572183 39.311225,-76.572905 39.312262,-75.574053 39.312875,-76.572683 39.313288,-75.573839 40.313572,-76.573305 40.313406,-75.574405 40.313693,-75.575768 39.315166,-75.575955 40.314027,-76.577382 40.314115,-75.581201 39.314289,-76.581273 40.313618,-75.583014 39.314527,-75.583157 39.314381,-75.581883 40.314175,-76.581093 39.315575))


1 reply

Additional comments: I know that certain rows are valid, and now I've discovered that certain rows are invalid. the ST_GEOMFROMTEXT() function can pull certain IDs, but not others:

 

 

(ADMIN)=> select inza..st_geometrytype(inza..st_geomfromtext(pol))from POLYGONS_VARCHAR where sid = 255; ST_GEOMETRYTYPE----------------- ST_POLYGON(1 row)

 

(ADMIN)=> select inza..st_issimple(inza..st_geomfromtext(pol)) from POLYGONS_VARCHAR where sid = 254;ERROR: Geometry unsupported

 

 

So I guess I'm looking for a better way of doing error handling of unsupported geometry types!

Reply