[Gdal-dev] ogr / geos scripting question
Ari Jolma
ari.jolma at tkk.fi
Fri Sep 14 12:21:09 EDT 2007
Brian Hamlin kirjoitti:
> actually, the convexHull can be a linestring in a special case, but is
> more likely
> type 3, Polygon.. (I printed the WKT form..)
>
> I now see that you can getNumPoints(), and getPoint( index ) in C++
> from a LineString
> but, Polygon does not have this?
http://map.hut.fi/doc/Geo-GDAL/html/annotated.html or if that does not
give good enough answer then I surf to
http://www.gdal.org/ogr/annotated.html
Polygon is functionally a collection, the outer ring is the first
geometry in it and the rest, if there are such, are inner rings (holes),
to loop through a collection use:
if ($geom->GetGeometryCount) {
for (0..$geom->GetGeometryCount-1) {
}
}
To look at the vertices use (only if GeometryCount is zero):
for my $i (0..$geom->GetPointCount-1) {
my $x = $geom->GetX($i);
my $y = $geom->GetY($i);
my $z = $geom->GetZ($i);
}
Ari
>
> thanks for your patience, starting out is the hardest
> best regards
> -Brian
>
--
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka / Geoinformation and positioning
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma
More information about the Gdal-dev
mailing list