[FWTools] Python API
Ryan, Adam
ARyan at co.linn.or.us
Tue Feb 1 21:03:54 EST 2005
Hi. I've been using the ogr API reference on the web and trying to learn
how to use ogr.py and gdal.py. I've got a few simple questions.
1. It seems like all these classes have only functions and no properties.
Is that just the way it is and I should just get used to it?
2. I want to set the value of the xcoord field to the X value of the point
features of a shapefile:
To get the X value, geomRef.GetX() doesn't work (too few arguments) so I
have to use geomRef.GetX(0). Is this because in ogr.py there is only a
geometry class and not a point class?
GetX isn't in the Class Members reference documents but it shows up if I do
a dir(geomRef).
3. To set the value, I do:
feature.SetField(xcoordi,geomRef.GetX(0))
src_layer.SetFeature(feature)
Which works but there are no values beyond the decimal place and there are
if I print out geomRef.GetX(0). So I tried this but it didn't seem to work:
feature.SetField(coordXfldi,fpformat.fix(geomRef.GetX(0),4))
Any hints would be great.
So far, this stuff is the bomb and the documentation is great. Cheers,
Adam
More information about the FWTools
mailing list