[GIS] ArcSDE 10: How to read/write to Oracle with ST_GEOMETRY using Java

enterprise-geodatabaseesri-geodatabasejava

I found the following in the deprecation plan of ArcGIS 10.2:

ArcGIS 10.2 will be the last major release to support the ArcSDE SDK
with the ArcSDE C and Java APIs. Today many other options are
available for developers, including SQL, which is available as a
result of the widespread adoption of spatial types…

In our recent Java/Oracle project, we want to write/read Features to an Oracle DB, which uses ST_GEOMETRY instead of Oracle's SDO_GEOMETRY.

So my questions is:

  1. Is it a bad idea to use the Java SDE API when starting from scratch?
  2. If SQL is the alternative – how can I do this? Shouldn't there be JDBC Support for ST_GEOMETRY in Oracle? I could not find anything like that.
  3. If there is no JDBC Support – isn't the SDE API the only path to go currently? I don't see "many other options".

Best Answer

After posting also in ESRI user forum - one approach is to use Well Known Text in queries and inserts. E.g. like this:

ResultSet rs = stmt.executeQuery("SELECT sde.ST_AsText(shape) as wkt FROM EXAMPLE_POLYGON_TABLE"); 
String shapeAsWellKnownText =  rs.next().getString("wkt");
Geometry geometry = wktParser.parse(shapeAsWellKnownText );

As I imagine one can use geotools for parse the WKT and access the geometries properties.

Related Question