Re: [cx-oracle-users] Re: SDO_GEOMETRY data type
Brought to you by:
atuining
|
From: Mikel L. <mla...@co...> - 2005-07-05 07:42:26
|
Mikel Larreategi wrote:
> >>> import cx_Oracle as db
> >>> con = cb.connect('user', 'mysecretpassword')
> >>> cur = con.cursor()
> >>> cur.execute('select a.GEOM_WGS84.GET_WKT(), a.id_postal from
> n_edifgen_3d a where id_postal between 10000 and 10005')
> [<CLOBVar object at 0x40167930>, <NumberVar object at 0x4016a0b0>]
> >>> cur.description
> [('A.GEOM_WGS84.GET_WKT()', <type 'CLOBVar'>, -1, 4000, 0, 0, 1),
> ('ID_POSTAL', <type 'NumberVar'>, 127, 22, 0, -127, 1)]
> >>> b = cur.fetchone()
> >>> b
> (<ExternalLobVar object at 0x40162060>, 10000.0)
> >>> b[0].read()
> 'POINT (-2.35566829112215 43.2908549259473)'
I can also get the info in this way:
>>> cur.execute('select a.geom_wgs84.sdo_point.X,
a.geom_wgs84.sdo_point.Y from n_edifgen_3d a where id_postal between
10000 and 10005')
[<NumberVar object at 0x4016a140>, <NumberVar object at 0x4016a188>]
>>> cur.fetchone()
(-2.35566829112215, 43.290854925947293)
--
Mikel Larreategi
mla...@co...
CodeSyntax
Azitaingo Industrialdea 3 K
E-20600 Eibar
Tel: (+34) 943 82 17 80
|