PreparedStatement ps = connection.prepareStatement("insert into states values(?)");
//convert JGeometry instance to DB STRUCT
STRUCT obj = JGeometry.store(mypoly, connection);
The SDO_GEOMETRY I want to insert is of SDO_GTYPE 2007 (collection of polygons) [in the example below, 2]
I can see in the sample code where to put the SRID (8307), but nowhere in the code, and nowhere in the Geometry class where I can create a multipolygon.
Anyone care to help with this?
As a secondary question: Some of the sites I'm updating have a boundary delineated by one polygon, some by more than one - can SDO_GTYPE 2007 be used for all, regardless of how many there are?
UPDATE LOC SET SITE_BOUNDARY=MDSYS.SDO_GEOMETRY(
SDO_POINT_TYPE(60.49772542, -1.452049075, NULL),
MDSYS.SDO_ORDINATE_ARRAY(50.49678550013553,-7.217321117344117, ... <trimmed, you don't want to see it all>...)
This didn't work for me, but it got me close. I kept getting a null pointer exception on JGeometry.closeCoord when I used Object. Didn't matter if I made sure to close my rings or not. (The API docs suggest it will do this for you.)
Are you sure this creates a multi polygon? Using the same version 11g I get this when I try your example. This says that it created a polygon with a void that is outside of the original polygon. I am still trying to find the answer to this. Any ideas?
Also check out the following code, it contains valuable examples (GNU Lesser General Public License) for working with JGeometry: http://opensourcejavaphp.net/java/deegree/org/deegree/io/datastore/sql/oracle/JGeometryAdapter.java.html