2

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".
1

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.

  • or you could use the GeoTools Oracle module to read/write directly docs.geotools.org/latest/userguide/library/jdbc/oracle.html – Ian Turton Aug 20 '13 at 7:59
  • did you try this? As much I can see, this is only working with SDO_GEOMETRY, but not ST_GEOMETRY. – fischermatte Aug 20 '13 at 9:15
  • shouldn't be a hard change to make - feel free to submit a patch – Ian Turton Aug 20 '13 at 10:36
  • 1
    I have found that well known binary easier to deal with than well known text. Depending on you connection settings, WKT can sometime loose precision. – travis Aug 20 '13 at 18:41
  • 1
    Is it possible to access esri ST_GEOMETRY using Hibernate? – Smalis Oct 30 '14 at 15:36
1

Oracle SDO_GEOMETRY comes with a full java API that essentially maps the database-side type (SDO_GEOMETRY) into a java type (JGeometry).

Without such an API, you need to deal with raw STRUCTs that you then need to decode and encode. The java API for SDO_GEOMETRY takes care of that. I am not aware of an equivalent for ESRI's ST_GEOMETRY.

Note also that Oracle provides an implementation of the OGC types and functions (STGeometry, etc) on top of SDO_GEOMETRY.

  • In case of using SDO Geometry along with SDE in a Java/Hibernate Project - would you still use JGeometry? I ask because, it seems Hibernate Spatial supports an Oracle Dialect to map SDO_GEOMETRY. So there is no need for JGeometry if you don't use spatial functions etc. of oracle spatial (?). – fischermatte Aug 20 '13 at 18:25
  • I guess that depends on what you are doing with the geometries you read and write. I imagine that you read them for some purpose, for which you will need to get them into a structure you can process. So if Hibernate Spatial can do that (i.e. convert them in some easy to use Java object) then you should be fine without using JGeometry. – Albert Godfrind Aug 26 '13 at 17:57
0

Take a look at this code: http://bitbucket.schuller.lu/hibernatestgeometry

Hibernate uses WKB/WKT representation to update geometry data.

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.