[Gdal-dev] Accessing polygon data through the scripting interface

Ari Jolma ari.jolma at tkk.fi
Mon Sep 5 02:00:54 EDT 2005


Hello,

I saw some discussion on this subject earlier on this list 
(http://lists.maptools.org/pipermail/gdal-dev/2005-February/005109.html) 
but I think it's still impossible(?) to access the polygon data (rings 
and then vertices) through the scripting interface.

I see that the OO interface for scripting languages is done using the C 
(not C++) api (ogr_api.h etc). The interface is rewritten into C++ in 
ogr.i but without subclasses of OGRGeometry like OGRPolygon. Some of the 
subclass methods are written into the C API but not all. Shouldn't also 
the OGRPolygon methods Get*Ring be wrapped into OGRGeometry? In fact I 
tried this and with these in place one is able to do things like this 
(in Perl but the small changes I had to make were not Perl specific):

$geom = $feature->GetGeometryRef();
$ring = $geom->GetExteriorRing(); # assuming geom is polygon...
$ring->GetX(10);

Methods GetPoint(int) and GetPoints would be useful also.

These may be implemented in ogr_api.cpp (then they are available in the 
C interface) or in ogr.i. GetPoint(int) is in ogr_api.cpp but not in ogr.i.

Ari




More information about the Gdal-dev mailing list