[gdal-dev] How to use TransformPoints in python?

Christopher Barker Chris.Barker at noaa.gov
Tue Jan 20 15:04:55 EST 2009


This doesn't address the issue, but:

>>     x = numpy.array( [p[0] for p in polygon] )
>>     y = numpy.array( [p[1] for p in polygon] )
>>     z = numpy.array( [p[2] for p in polygon] )

these list comprehensions are unnecessary -- numpy understands nested lists:

poly_array = numpy.array(polygon)

x = poly_array[:,0]
y = poly_array[:,1]
z = poly_array[:,2]

It would be nice if the gdal bindings understood NX3 numpy arrays 
directly. If the C code can accept a C NX3 *double, then the numpy.i 
swig interface files that come with numpy would make it easy to do. Some 
day!

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the gdal-dev mailing list