1

I have Well Known Text (WKT) string with geometry. Now I want to create Oracle Mapviewer SdoGeometry, which needs sdo_elem_info array as one of arguments which is an array of doubles.

How can I extract elem_info array from WKT String? I've read that geometry into Geometry object from Vivid Solutions JTS library, but I can't find a way to get elem_info from that either.

Anyone can help?

1 Answer 1

3

You can use the com.vividsolutions.jts.io.oracle.ORAWriter constructor. It "translates a JTS Geometry into an Oracle STRUCT representing an MDSYS.GEOMETRY object.". But for this you need an OracleConnection. It's required by that constructor. Using this kind of implementation you don't have to worry how the several attributes from the SDO_GEOMETRY object are constructed.

Another approach is taken by the gt-jdbc-oracle extension from the GeoTools project: although they depended heavely on the JTS library, the ORAWriter isn't used because it needed to introduce a direct dependency on the OJDBC driver (oracle.jdbc.OracleConnection and others) classes.

I think the Oracle Spatial Java API (sdoapi.jar, sdoutl.jar) already have such facilities: read/write from/to WKT/JGeometry. But you will not be able to work with JTSGeometry..I think. This Java API has the same license as Oracle Locator.

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.