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".
2
  • I am not very into JDBC, but if there is a way to read/write custom "object types" in Oracle, and you want to spend some time studying the ST_Geometry spec, then perhaps this link helps: help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//…
    – Oyvind
    Commented Aug 19, 2013 at 21:18
  • thx @Oyvind, but sounds like a lot of effort :( Commented Aug 19, 2013 at 21:52

3 Answers 3

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.

5
  • or you could use the GeoTools Oracle module to read/write directly docs.geotools.org/latest/userguide/library/jdbc/oracle.html
    – Ian Turton
    Commented Aug 20, 2013 at 7:59
  • did you try this? As much I can see, this is only working with SDO_GEOMETRY, but not ST_GEOMETRY. Commented Aug 20, 2013 at 9:15
  • shouldn't be a hard change to make - feel free to submit a patch
    – Ian Turton
    Commented Aug 20, 2013 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
    Commented Aug 20, 2013 at 18:41
  • 1
    Is it possible to access esri ST_GEOMETRY using Hibernate?
    – Smalis
    Commented Oct 30, 2014 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.

2
  • 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 (?). Commented Aug 20, 2013 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. Commented Aug 26, 2013 at 17:57
0

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

Hibernate uses WKB/WKT representation to update geometry data.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.