JGeometry to json

المشرف العام

Administrator
طاقم الإدارة
I am working on an application which will query the spatial data in the oracle spatial, and I use mybatis at the moment(I can not use JPA), which means I have to convert the object of oracle.sql.STRUCT to something can be recolonized by the application and the client.

First I found the oracle.spatial.JGeometry:

https://docs.oracle.com/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html

This is how I use it:

JGeometry geo = JGeometry.load((oracle.sql.STRUCT)restulSet.getObject(0));However I have to sent it to the client using json, so I need to parse it:

private JsonObject convertToGeometry(JGeometry jGeometry) { JsonObject json = null; switch (jGeometry.getType()) { case JGeometry.GTYPE_POINT: double[] xy=jGeometry.getPoint(); json.coords=new JsonArray(..); break; case JGeometry.GTYPE_CURVE: // have no idea how to retrieve the geometry information break; } return json;}As I commented, I have no idea how to get the geometry information for the curve,polyogn and etc.

BTW, does Line is a subset of JGeometry.GTYPE_CURVE?



أكثر...
 
أعلى