[Gdal-dev] Layer Coordinate Transformation

ibrahim Z. HIDIR hipoxi at gmail.com
Fri Mar 16 02:10:22 EDT 2007


Hi

 

When i connect a data source ( with ogr ) i am getting the a layer  first,
then i am putting the layer in a loop and transforming  coordinates all the
features one bye one,

 

(i am using python )

 

 

import ogr

import osr

dss = ogr.Open('OCI:user/pass at db_name')

sqls = 'select * from schema.table'

layer = dss.ExecuteSQL( sqls )

 

feature = graphics.GetNextFeature()

 

while feature is not None:

            geom = feature.GetGeometryRef()

 

            ref       = osr.SpatialReference()

            out_ref = osr.SpatialReference()

            ref.ImportFromWkt( source_coor )      #source coordinate
definition wkt format

            out_ref.ImportFromWkt( base_coor )  # the coordinate system whic
i want to transfom the features in wkt format

            geom.AssignSpatialReference( ref )

            geom.TransformTo(out_ref)

 

feature = graphics.GetNextFeature()

 

it's working fine, but takes long time when i got a huge data, i couldn't
find a way to transform all layer on one time without a python loop. is
there a way to do it?

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070316/1608e6bf/attachment.html


More information about the Gdal-dev mailing list