Balázs Bámer wrote: > Hi Andreas, > >> no need to remove, destroy and re-add the layer. If your WMS URL stays >> the same, all you need to do is > > I need to do this because the URL changes. Here the ***** value > changes, the 'shapefile.map' part changes when someone wants to upload > a new shapefile. > > var shapefile_wms = new OpenLayers.Layer.WMS("shapefile [name from PHP var]", > "http://att-it.homelinux.net:22080/cgi-bin/ms-5.4.1/mapserv", > { > layers: 'shapefile', > ****** map: '/var/lib/mapserver-5.4.1/blokknez/shapefile/shapefile.map', > transparent: "true" > },
In that case, you also do not need to destroy and re-add the layer. Instead of layer.reload(true); all you need to do is layer.mergeNewParams({map: '/your/mapfile'}); The layer will reload immediately. But in the meantime, I have another suspicion: can it be that you request the layer with the new mapfile before the upload is processed on the server? You should do the reload in a success callback of your upload request. Regards, Andreas. > { > > scales:[2000000,1500000,1000000,750000,500000,300000,200000,150000,100000,75000,50000,30000,20000,15000,10000,7500,5000,3000,2000,1500,1000], > isBaseLayer:false, > visibility:true > }); > > The constructed URL looks like > > http://att-it.homelinux.net:22080/cgi-bin/ms-5.4.1/mapserv?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&map=/var/lib/mapserver-5.4.1/blokknez/shapefile/shapefile.map&layers=shapefile&srs=epsg:23700&BBOX=420000,40000,950000,370000&WIDTH=938&HEIGHT=591&FORMAT=image/png > > the above 'shapefile.map' part specifies which uploaded shapefile to > display. Meanwhile I somewhat rewrote the stuff to allow several users > use independent shapefiles and mapfiles, and it works now: > http://att-it.homelinux.net:22080/blokknez/tobbfelhaszn.php > > Thank you, best regards: Balázs -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users