[Mapserver-users] adding objects

Lowell Filak lfilak at medinaco.org
Tue Dec 3 10:47:45 EST 2002


If by layer you mean shapefile:
To "add" features to an existing shapefile you need to actually create a new shapefile object and loop through each of the features in the existing shapefile and add them to the new shapefile.
Then before closing the shapefile object you can add new features to it and then overwrite the old shapefile with the new version.
Why?
There is more discussion in the archives regarding that but for the most part the original shapefile design (if I understand correctly) was for quick read access and not write access.
There is a PerlMapscript example towards the top of (look for "Does the shapefile already exist or is it yet to exist."):
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples35ex8
And, yes, we actually use that script to add features to a shapefile.
HTH
Lowell F.

The following message was sent by Sven Jacobi <jacobi at dfki.de> on Tue, 03 Dec 2002 11:48:31 +0100.

> Hi,
> 
> does anybody know whether it is possible to add objects to a certain layer?
> It would be great if an user would have the possibility to add an object to
> a map when he is sure that the map has to be "updated".
> 
> Any ideas or experiences?
> 
> Cheers,
> 
> Sven
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list