AW: [OpenLayers-Users] Canot Load WMS layer

Arnd Wippermann arnd.wippermann at web.de
Wed Sep 14 16:06:20 EDT 2011


Hi,
 
the wms and layer you request have a extent and scale limitation. It's only
available for a defined extent and up a defined scale.
 
In your example you center the map on lon=5 and lat=40 with zoom=5. That's
far away.
 
try
map.setCenter(new OpenLayers.LonLat(-90,44),13);
 
 
To get some usefull information for wms server use this service
 
https://geoportal.bayern.de/getcapabilities/index.html
 
There you can see, that the requested layer have a scalehint of 37. That
means, you have to use a very high zoomlevel.
 
Arnd

  _____  

Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Surendran
Neelakantan
Gesendet: Dienstag, 13. September 2011 23:02
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Canot Load WMS layer


Hi  list

I am trying to load  WMS and WFS overlay from a remote site.  I tried many
ways but faild it would be great if some one show me how to load these
layers from  the remote site.

Here
<http://ukypssgis.ca.uky.edu/landusenrcs_V3/testing/007/opelayers-wms1.html>
is the link   


Direct urls are working

 WMS request
 
<http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms?REQUEST=GetMap&SERVICE=W
MS&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&WIDTH=800&H
EIGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.993728,-84.
449329,38.044441>
http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms?REQUEST=GetMap&SERVICE=WM
S&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&WIDTH=800&HE
IGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.993728,-84.4
49329,38.044441


WFS request
 
<http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?SERVICE=W
FS&request=GetFeature&version=1.0.0&typeName=Mapunitpoly&SRS=EPSG:4326&BBOX=
-84.513702,37.993728,-84.449329,38.044441>
http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?SERVICE=WF
S&request=GetFeature&version=1.0.0&typeName=Mapunitpoly&SRS=EPSG:4326&BBOX=-
84.513702,37.993728,-84.449329,38.044441

 
This is the code  I have tried

        var lon = 5;
        var lat = 40;
        var zoom = 5;
        var map, layer;

        function init(){
            map = new OpenLayers.Map( 'map' );
            
            //layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
            //        "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers:
'basic'} );<br/>
var
wmsurl="http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms?REQUEST=GetMap
<http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms?REQUEST=GetMap&SERVICE=W
MS&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&WIDTH=800&H
EIGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.993728,-84.
449329,38.044441>
&SERVICE=WMS&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&W
IDTH=800&HEIGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.9
93728,-84.449329,38.044441"

            
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms",
{layers: "MapunitPoly"
                    //request :"GetMap",
                    //version:"1.1.1",
                    //service:"WMS"
                    //TRANSPARENT:"TRUE",
                    //format:"image/gif",
                    //bbox:"-84.513702,37.993728,-84.449329,38.044441"
                    //srs:"EPSG:4326"

                    } );




var wfslayer= = new OpenLayers.Layer.Vector("WFS", {
    strategies: [new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.WFS({
              url:
"http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs",
              featureType: "MapunitPoly",
              //featureNS: "http://www.opengis.net/wfs",
             srsName: "EPSG:42326",
              version: "1.0.0"                    
              })
});
                    map.addLayer(layer,wfslayer);

            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }
        

It would be great if some one can show me the correct syntax.


Surendran



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110914/06b9e728/attachment-0001.html


More information about the Users mailing list