Get the "real" geometry with ST_ASTEXT?

3674
5
06-16-2016 12:25 AM
MartinAmeskamp
Occasional Contributor II

Hi, we've been trying to identify some line features with duplicate vertices recently (this is ArcGIS 10.2.1 with ST_GEOMETRY on Oracle 11.2), and one obvious way seemed to be to output the geometry as OGC WKT using the ST_GEOMETRY function ST_ASTEXT. I noticed, however, that line features are always output as LINESTRING, i.e. with straight line segments, even though the real geometry (as seen in the edit vertices window in ArcMap) has circular segments as well. Also, my duplicate vertices don't show up in the WKT LINESTRING either

Is there a way of exporting the "real" geometry as text, especially the location of all vertices?

Thanks, Martin

PS We're using Data Reviewer 10.3 right now, but installing that at a customer site otherwise running 10.2.1 is a bit of a hassle...

0 Kudos
5 Replies
ChristianWells
Esri Regular Contributor

Hi Martin,

I'm looking into the SQL ST functions for curved data. In the immediate, can you use the JSON via the da.SearchCursor?

for row in arcpy.da.SearchCursor("SDE.ST_LINES", ["SHAPE@"]):
     print row[0].JSON

Output:

{"curvePaths":[[[-43050711.692462206,8862199.7932373881],[6561666.6665721536,39487124.706322819],{"c":[[99048939.903926104,89099503.065357178],[43156100.269598193,82281334.322446659]]}]],"spatialReference":{"wkid":102645,"latestWkid":2229}}
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Not to nitpick, but I think it is an important difference, the JSON property of ArcPy Geometry objects returns the "Esri JSON representation" and not GeoJSON.  (Edited)

0 Kudos
ChristianWells
Esri Regular Contributor

Edited

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I can't speak to ST_AsText, but the ArcPy Geometry documention states for the WKT property that "Any true curves in the geometry will be densified into approximate curves in the WKT string."  It could be a similar situation is occurring here.

0 Kudos
MartinAmeskamp
Occasional Contributor II

Hi Joshua and Christian,

thanks for your replies! It very much looks like the ST_GEOMETRY WKT functionality works the same as the Python WKT property (tech support should know for sure), and I wasn't aware of the JSON property of the python geometry type - this has the real geometry and can be parsed to identifiy duplicate vertices.

However, this seems to be new with 10.3 as well (like the Data Reviewer checks we're suing now), so it does look like there is no out-of-the-box functionality for identifying duplicate vertices in 10.2.1.

Thanks again, Martin

0 Kudos