[OpenLayers-Users] Canot Load WMS layer

Surendran Neelakantan surendrankn at gmail.com
Tue Sep 13 17:01:44 EDT 2011


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 is the link<http://ukypssgis.ca.uky.edu/landusenrcs_V3/testing/007/opelayers-wms1.html>



Direct urls are working

 WMS request
http://sdmdataaccess.nrcs.usda.gov/Spatial/SDM.wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&WIDTH=800&HEIGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.993728,-84.449329,38.044441


WFS request
http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?SERVICE=WFS&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&SERVICE=WMS&VERSION=1.1.1&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&WIDTH=800&HEIGHT=600&FORMAT=image/gif&LAYERS=MapunitPoly&BBOX=-84.513702,37.993728,-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/20110913/755b52d2/attachment.html


More information about the Users mailing list