[gdal-dev] Buffering geometries
Federico Jurio
federicojurio at suremptec.com.ar
Tue Oct 1 13:18:52 PDT 2013
Thank you again, regards!
On Tue, Oct 1, 2013 at 5:16 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:
> Le mardi 01 octobre 2013 22:05:55, Federico Jurio a écrit :
> > Thank you for your advice Even, it works perfectly!
> > i have another issue, what is the unit of dfDist from
> > Buffer<
> http://www.gdal.org/ogr/classOGRGeometry.html#ab34b27e2c8812a0fc1dcc
> > f055b11d1a2> ?
>
> The same unit as the coordinates of your geometries : degrees if your
> coordinates are in degrees, meters if they are in meters, etc...
>
> >
> >
> > On Tue, Oct 1, 2013 at 4:02 PM, Even Rouault
> >
> > <even.rouault at mines-paris.org>wrote:
> > > 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 at lists.osgeo.org
> > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > >
> > > --
> > > Geospatial professional services
> > > http://even.rouault.free.fr/services.html
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>
--
Federico Jurio
SUR Emprendimientos Tecnológicos
Perú 345 Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
federicojurio at suremptec.com.ar
www.suremptec.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131001/99c68c6d/attachment-0001.html>
More information about the gdal-dev
mailing list