[gdal-dev] [OGR]Add a vertex to a feature

Even Rouault even.rouault at mines-paris.org
Fri Mar 11 08:51:02 EST 2011


Selon Mohamed Saâd HESSANE <saad.hessane at gmail.com>:

> Thank's for your suggestion.
> I test the OGRLayer::SetFeature() method, but it don't write the file after
> that. I think the reason is what say Chaitanya (thank you) about the driver
> which don't write until the handle is closed.

You can try the OGRLayer::SyncToDisk() method that should write the updated
headers to disk.

> I think the best way is to write a CSV/VRT file.

I doubt it will work as you expect. The CSV driver is an append-only driver. You
cannot delete or update existing features.

> I'm trying now.
>
>
> 2011/3/11 Even Rouault <even.rouault at mines-paris.org>
>
> > Selon Mohamed Saād HESSANE <saad.hessane at gmail.com>:
> >
> > Mohamed,
> >
> > you can also use the OGRLayer::SetFeature() method to update an existing
> > feature
> > from a shapefile. But be aware that if you expand the geometry, its binary
> > size
> > will increase, so when you ask the geometry to be written by SetFeature(),
> > the
> > shape driver will write it at the end of the .shp file, so you might end up
> > losing a lot of space. The same also applies to your current method of
> > deleting
> > and recreating a new feature.
> >
> > Best regards,
> >
> > Even
> >
> > > Hy list,
> > > I' m trying to add on the fly points comming from GPS to a shapefile.
> > > But the only way i find is to delete the feature from the shapefille, and
> > > create a new feature with the added point. There's another way?
> > > Thank you
> > >
> >
> >
> >
>




More information about the gdal-dev mailing list