[Gdal-dev] OGRGeometry::Distance

Matthew Perry perrygeo at gmail.com
Sun Sep 18 01:50:00 EDT 2005


Hi folks,

I'm new to the list so I'll just introduce myself real quick. I've been 
doing GIS and cartography for 4 years at Humboldt State University as a 
Natural Resources major and, although it's not my background per se, I've 
been getting heavily into programming these past few months. Most of my web 
mapping stuff is PHP/Mapscript but I've begun really like python/OGR/GDAL 
for doing my data processing.

Anyways, I've run into a bit of an issue with the OGRGeometry::Distance 
method. Check out the following script:

import ogr
# Create some test geometries
wkt = 'POINT(1 1)'
g1 = ogr.CreateGeometryFromWkt(wkt)
wkt = 'POINT(2 1)'
g2 = ogr.CreateGeometryFromWkt(wkt)

b = g1.Buffer(2)
# Works fine so we know geos is enabled

d = g1.Distance(g2)
# fails ... "Attribute Error: Geometry instance has no attribute 'Distance'"

According to the docs at
http://gdal.maptools.org/ogr/classOGRGeometry.htmlthis should work,
right? Or have there been recent changes that break this
method? Are there any updated docs anywhere? I'm using gdal 1.3.0 packaged 
with FWTools 0.9.9 on ubuntu linux.

Thanks for helping me out.

-- 
Matt Perry
perrygeo at gmail.com
http://www.perrygeo.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20050917/2d4cf9c3/attachment.html


More information about the Gdal-dev mailing list