Re: [cx-oracle-users] Fetching Coordinates by using SDO_UTIL.GETVERTICES
Brought to you by:
atuining
|
From: Moritz L. <mor...@go...> - 2016-08-17 19:16:37
|
I have used the reading of geometry directly in python.
For example with a sql query I fetched my geomeetries and then I build my
JSON:
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)
But it took a longt time in my case so I wanna try new ways to fetch the
coordinates...
2016-08-17 13:58 GMT+02:00 Jani Tiainen <re...@gm...>:
> Hi,
>
> Is there a reason you use GETVERTICES-utility instead of reading geometry
> directly in Python?
> cx_Oracle have had that feature for a good while.
>
>
> On 16.08.2016 13:33, Moritz Liebelt wrote:
>
> Hi,
>
> I want to fetch coordinates from my Oracle database (11g Locator). I will
> try it with the intern function SDO_UTIL.GETVERTICES().
>
> *My sql query looks like:*
> *"""SELECT a.id <http://a.id> , t.x, t.y, t.z, d.Classname FROM building
> a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c,
> TABLE(SDO_UTIL.GETVERTICES(c.geometry))t, OBJECTCLASS d WHERE
> a.grid_id_500 = 2728 AND a.id <http://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""")*
>
> Afterwards I create the json:
>
> * for id,x,y,z, classname in cursor: result.append({
> "building_nr":id,"geometry": { "type":"polygon","coordinates":[x,y,z],},
> "polygon_typ":classname,}) *
>
> * But of course I get only one Point:*
>
> [{'building_nr': 1314867, 'geometry': {'type': 'polygon', 'coordinates':
> [(3500936.67, 5394350.72, 439.17400000000004)]}, 'polygon_typ':
> 'BuildingWallSurface'}, ...
>
>
>
> The problem is I get only one point geometry.
>
> But for example there exists 5 points for this wall surface. I need all
> points with the same building_nr (id)!
>
> Can I iterate over x,y,z ?
>
>
>
> --
> *Moritz Liebelt, B. Sc.*
>
> Murgstraße 19
> 76437 Rastatt
> E-Mail: mor...@go...
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> cx-oracle-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>
> --
> Jani Tiainen
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>
--
*Moritz Liebelt, B. Sc.*
Murgstraße 19
76437 Rastatt
E-Mail: mor...@go...
|