Re: [cx-oracle-users] Differences in runtime
Brought to you by:
atuining
From: Moritz L. <mor...@go...> - 2016-08-03 09:26:17
|
import cx_Oracle import json import web urls = ( "/", "index", "/grid", "grid", ) app = web.application(urls, globals()) web.config.debug = True connection = cx_Oracle.Connection("TEST_3D/limo1013@10.40.33.160:1521/sdetest") typeObj = connection.gettype("MDSYS.SDO_GEOMETRY") class index: def GET(self): return "hallo moritz " 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 = 4158 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""")# 400m """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""")# 500m def geometry_to_points(obj): return zip(*[iter(obj.SDO_ORDINATES.aslist())] * 3) result = [] for id, geometry, classname in cursor: mo = geometry.SDO_ORDINATES.aslist() result.append({ "building_nr":id,"geometry": { "type":"polygon","coordinates":zip(*[iter(mo)] * 3),}, "polygon_typ":classname,}) return json.dumps(result) if __name__ == "__main__": app.run(web.profiler) |