I would like to load a GML3.2 string, parse it and then convert it into JGeometry before inserting the object in the database.
I am using Oracle 11g.
The GML3.2 string:
<gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2" gml:id="ID_5" xmlns="http://www.telespazio.com/IOP/schemas/feasibility" xmlns:IOPpp="http://www.telespazio.com/IOP/schemas/programming" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ns2="http://www.telespazio.com/IOP/schemas/subscription" xmlns:gml2="http://www.opengis.net/gml" xmlns:IOPcm="http://www.telespazio.com/IOP/schemas/common" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-8.016 -66.805 -4.172 -41.668 11.393 -39.031 10.358 -63.113 -8.016 -66.805</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
The code:
DOMParser parser = new DOMParser();
parser.parse(new java.io.ByteArrayInputStream(gmlString.getBytes()));
XMLDocument doc = parser.getDocument();
Node nodeGeom = doc.getFirstChild();
GML3g gml3g = new GML3g();
Properties prop=new Properties();
prop.setProperty("user", "dbuser");
prop.setProperty("password","dbpass");
gml3g.setConnection(DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", prop));
gml3g.setsrsNameSpace("ogc:def:crs:EPSG::4326");
JGeometry jgeom = gml3g.fromNodeToGeometry(nodeGeom);
The obtained exception:
(oracle.spatial.geometry.DataException) Message:GML has unregistered SrsNameSpace/SrsName
any suggestion is appriciated
thanks
Sarah