[Mapserver-users] Re: delete shape

blaise bpicinbono at worldonline.fr
Fri Jun 4 14:48:28 PDT 2004


 > How can i delete from the shape files ? and for the mapinfo files, i
 > cannot use the mitab.dll, i just can't get the exported functions...
 > Sylvain.

Are you using php-mapscript ?
With php-mapscript, you can easily add shapes to esri shapefiles or even 
mapinfo tables.
I have not heard of any -delete- function for shapefiles with mapscript, 
but maybe I missed something, can anyone tell ?

To delete a shape from a shape file, this is what I am doing :
1-- add, to a new empty temp shapefile, all the shapes except the one to 
delete.
2-- same for the dbf table, or better, use the dbase_delete_record call 
and don't forget the dbase_pack !
3-- rename your tmp shapefile to the name of the real one (thus deleting 
the old shapefile with the shape to delete).
4-- rename the tmp dbf file if you have created one.

Of course, this is a bit time consuming for large shapefiles, as the 
process copy all the shapes. I made a quick test on a tens of thousands 
shapes test shapefile, it seemed ok.

You can have a look at a demo allowing shape deletion and more exciting 
shape updating tools over here :
http://webmaps.ouvaton.org
(link java-tool demo and turn off the java mode (green switch left of 
the scale bar) to have all the updating tool available) sorry, it's a 
bit out of date, I will redesign the whole site when I'll be over with 
the new FlashMapServer demo.)
Blaise



More information about the MapServer-users mailing list