Thursday, 18 July 2019

enterprise geodatabase - Get XML from Oracle sde.st_geometry SHAPE column using SQL


How can I access the XML contents of the SHAPE column of a feature class in sde.st_geometry/Oracle? I want to access the XML using SQL so that I can ultimately directly query the vertices that make up the geometry.


This page says that the POINTS attribute of ST_GEOMETRY is stored as a BLOB, which "contains the byte stream of the point coordinates that define the geometry". But I haven't found much more info than that. And it doesn't tell me how the SHAPE column is stored as a whole.


The XML Schema of the Geodatabase white paper talks about the XML of the geometry/SHAPE column on pages 44-46, 49-50 and in Apendix A. But there's nothing related to accessing it in the database.



Answer



There is no XML within SDE.ST_GEOMETRY. Furthermore, neither the SDE.ST_GEOMETRY type nor the underlying st_geometry DLL, which implements that custom type, nor even the SgShape library beneath that supports a method for XML conversion. XML Workspace generation is a capability of ArcObjects.


The binary POINTS BLOB is partially documemted (all except the CAD object array) in earlier media kits and in documentation on the web (though the conversion from 32-bit to 64-bit base integers with HIGH precision may take a little reverse engineering/experimentation).


PostGIS has an ST_Dump method to generate tuples from higher order objects, but that's not part of the type specification to which Esri's implementation adheres, and I'm not even sure if it's possible in Oracle.



I'd recommend you convert to point (multipoint, really), generate well-known text, and parse the comma-delimited array of X{space}Y pairs.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...