Hi,
I am using the unreleased version of cx_Oracle to handle cx_Oracle.OBJECTS.
Our aim is to fetch 3D data from a geodatabase.
Furthermore I have created a little webserver with web.py and cx_Oracle.
All of my buildings in the databse are structured in a grid and now I will fetch all buildings in 400m tile and all buildings in a 500m tile
Here you can see my python code:
import cx_Oracle
import json
import web
urls = (
"/", "index",
"/grid", "grid",
)
app = web.application(urls, globals(), web.profiler)
web.config.debug = True
connection = cx_Oracle.Connection("TEST_3D/+++@10.40.33.160:1521/sdetest")
typeObj = connection.gettype("MDSYS.SDO_GEOMETRY")
class grid:
def GET(self):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
web.header('Content-Type', 'application/json')
cursor = connection.cursor()
cursor.arraysize = 100000 # default = 50
cursor.execute( """SELECT a.id , c.geometry, d.Classname FROM building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d WHERE a.grid_id_500 = 2728 AND a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID""")
result = []
for id, geometry, classname in cursor:
result.append({
"building_nr": id, "geometry": {
"type": "polygon",
"coordinates": zip(*[iter(geometry.SDO_ORDINATES.aslist())] * 3),
}, "polygon_typ": classname,
})
return json.dumps(result)
if __name__ == "__main__":
app.run(web.profiler)
My result:
400m | 500m |
---|
23.707 points | 35.727 points |
0.26s | 14s |
Why they are so high differences regarding runtime?
If I didn´t create the geometry ("coordinates": zip(*[iter(geometry.SDO_ORDINATES.aslist())] * 3), ) the runtime is about 0.3s!!!
Of course the 500m tile will need more time because the number of output rows are higher but this is to high I guess!
So does anybody know why this needs so much time?
Does it depends on the unreleased version of cx_Oracle