On Monday 13 February 2006 16:18, Xiaonan Zhang wrote: > Hi all, > > anyone know how to delete a selected feature from a layer? > > regards > > Jonathan
Hi there, If you are dealing with esri shape layers (shp+shx+dbf), I think there isn't any easy way to delete a shape, as Steve noted a few weeks ago. I don't know for other kind of data format. For esri shape files, the trick is to copy all your shapes except the one to be deleted, to a new temporary shape file, and same for the datas (dbf). And then to rename your temporaries shp and dbf files to the name of your original files. If you're dealing with a very large number of shapes, you can speed up the process by deleting the right record in the dbf file. This is possible, on the opposite as for the shp file. But read carefully the dbase doc, I think you have to use the "pack" or something command after deleting a dbf record to really update your dbf file. All this done with php_mapscript or maybe another scripting language, of course. Post more if you don't get it. Blaise
