Le lundi 30 septembre 2013 23:12:30, federico a écrit : > Dear all, i'm trying buffer some geometries with GDAL. I have success with > poligons and lines but i can't create the buffer when i try to do the same > procedure with an OGRPoint. > > Here is a screenshot with the buffer http://i.imgur.com/rRQuooc.jpg > > I'm using the Buffer function from OGRGeometry Class in a map with WGS 84 > coordinates reference system. > > Anyone know what could be wrong?
This should work. Make sure your target layer can contain polygons. Your code sample isn't sufficient to detect what might go wrong in your case. Just a few remarks : you are going to suffer from 3 memory leaks in your code sample (if it isn't an extract of your real code) : * Buffer() returns a new geometry object. So use SetGeometryDirectly() so that it is owned by pnewfeature * you should delete pnewfeature after having passed it to CreateFeature() * you should delete pfeature when it is no longer used > > Code example > > OGRFeature *pfeature = player->GetNextFeature(); // Apunta al primer > feature > while (pfeature) { > OGRFeature* pnewfeature = pfeature->Clone(); > > pnewfeature->SetGeometry(pnewfeature->GetGeometryRef()->Buffer(bufferdist)) > ; pdestlayer->CreateFeature(pnewfeature); > pfeature = player->GetNextFeature(); > } > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/Buffering-geometries-tp5081031.html > Sent from the GDAL - Dev mailing list archive at Nabble.com. > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Geospatial professional services http://even.rouault.free.fr/services.html _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev