On Thu, 25 Aug 2011, Karl Ove Hufthammer wrote:

Dear list members,

Is it possible to define which FID values should be used when saving a SpatialPointsDataFrame to a GML files using writeOGR (rgdal package)?

The FID values are stored as <ogr:layername fid="F0"> (and F1, F2, …). If I insert a new row in the SPDF, most features change their FID, which creates much unneccessary noise in our VCS,
so I would like to use an already existing ID as the FID.

I have tried change both the row.names and adding columns named
‘fid’ and ‘gml_id’, the writeOGR still only uses F0, F1, … as the FIDs.

No FID is set in writeOGR() in the underlying C++ function writeOGR(). One could be set, but only as unique integers >= 0, not as the row.names() which are strings. The result is that default FID are written. It would be possible to modify the function to add integer FID, I think, but they would have to be valid unique integers. I think that what gets written from there depends on the driver internals, which the function does not reach. Would this help? Patches welcome!

Best wishes,

Roger


--
Karl Ove Hufthammer

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to