[gdal-dev] to find area of Shape File
SIVA RAMA KRISHNA
s.r.kriishna at gmail.com
Thu Jun 14 01:22:27 PDT 2012
i am Trying To Find Area of A Polygon
with the Following Code
int main() { OGRRegisterAll(); OGRLayer *poLayer;
OGRFeature *poFeature; OGRDataSource *poDS; poDS =
OGRSFDriverRegistrar::Open( "first.shp"); poLayer =
poDS->*GetLayerByName*( "first"); int
nCount=poDS->*GetLayerCount*(); printf("%d",nCount);
poLayer->*ResetReading*(); OGRGeometry *poGeometry;
OGRGeometryCollection *PoGC;
while((poFeature=poLayer->*GetNextFeature*())!=NULL) { int
nCnt=poFeature->GetFieldCount(); printf("\n %d",nCnt);
qDebug()<<"entered"; poGeometry=poFeature->GetGeometryRef();
if(poGeometry !=NULL &&
wkbFlatten(poGeometry->*getGeometryType*()) == wkbPolygon) {
PoGC->*addGeometry*(poGeometry); double area =
PoGC->*get_Area*() ; qDebug() << area ; } }
return 0;}
i am getting Error
With Regards
siva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120614/6cfc3d9c/attachment.html>
More information about the gdal-dev
mailing list