One of my WMS layer is not loading the image tiles. See the code:
See the image:
I get an error:
msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings.
Instead if change it as a mapserver layer,
var mslayer = new OpenLayers.Layer.MapServer ( "MapServer Layer",
"http://localhost/cgi-bin/mapserv?map=/var/www/osm-demo/mapserver-utils-svn/osm-google_test.map&",
{'layers': "land0 borders0 places0 land1 borders1 places1 land2 borders2 places2 land3 borders3 places3 land4 landuse4 transport_areas4 waterarea4 borders4 places4 land5 landuse5 transport_areas5 waterarea5 roads5 borders5 places5 land6 landuse6 transport_areas6 waterarea6 waterways6 roads6 borders6 places6 land7 landuse7 transport_areas7 waterarea7 waterways7 roads7 borders7 places7 land8 landuse8 transport_areas8 waterarea8 waterways8 railways8 roads8 borders8 places8 land9 landuse9 transport_areas9 waterarea9 waterways9 railways9 roads9 borders9 places9 land10 landuse10 transport_areas10 waterarea10 waterways10 railways10 roads10 aeroways10 borders10 places10 land11 landuse11 transport_areas11 waterarea11 waterways11 railways11 roads11 aeroways11 borders11 places11 land12 landuse12 transport_areas12 waterarea12 waterways12 railways12 roads12 aeroways12 borders12 places12 land13 landuse13 transport_areas13 waterarea13 waterways13 railways13 roads13 aeroways13 borders13 places13 land14 landuse14 transport_areas14 waterarea14 waterways14 railways14 roads14 aeroways14 borders14 places14 land15 landuse15 transport_areas15 waterarea15 waterways15 railways15 roads15 aeroways15 borders15 places15 land16 landuse16 transport_areas16 waterarea16 waterways16 railways16 roads16 aeroways16 borders16 places16 land17 landuse17 transport_areas17 waterarea17 waterways17 railways17 roads17 aeroways17 borders17 places17 land18 landuse18 transport_areas18 waterarea18 waterways18 railways18 roads18 aeroways18 borders18 places18"}
);
it works and I get tiles for both the layers. Why is it not when both are WMS layers?
In my osm-google_test.map file the WEB portion is like this:
WEB
#IMAGEPATH "/tmp/ms_tmp/"
#IMAGEURL "/ms_tmp/"
IMAGEPATH '/opt/fgs/tmp/ms_tmp/'
IMAGEURL '/ms_tmp/'
TEMPLATE '/var/www/mstest/templatesample.html'
#labelcache_map_edge_buffer "10"
METADATA
"wms_enable_request" "*"
#"ows_enable_request" "*"
"wms_srs" "EPSG:900913 EPSG:4326 EPSG:3857 EPSG:2154 EPSG:310642901 EPSG:4171 EPSG:310024802 EPSG:310915814 EPSG:310486805 EPSG:310702807 EPSG:310700806 EPSG:310547809 EPSG:310706808 EPSG:310642810 EPSG:310642801 EPSG:310642812 EPSG:310032811 EPSG:310642813 EPSG:2986"
"labelcache_map_edge_buffer" "-10"
"wms_title" "osm france"
END
END
Answer
Your layer names specification is wrong, try it this way:
var mslayer = new OpenLayers.Layer.MapServer (
"MapServer Layer",
"http://localhost/cgi-bin/mapserv?map=/var/www/osm-demo/mapserver-utils-svn/osm-google_test.map&",
{'layers': ["land0","borders0","places0","land1"]}
);
Basically it is an array of strings, not a single string. In your particular example just add there all other of your layers names.
No comments:
Post a Comment