Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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