[OpenLayers-Users] wms layer over openstreet base map
Gery .
gamejihou at hotmail.com
Thu May 24 14:24:49 PDT 2012
sorry!, I meant "4326" instead of "4322" =)
From: gamejihou at hotmail.com
To: jdmorgan at unca.edu
Subject: RE: [OpenLayers-Users] wms layer over openstreet base map
Date: Thu, 24 May 2012 21:23:07 +0000
CC: openlayers-users at lists.osgeo.org
Hola Derek,
That's great!, your error points to the projection (SRS) that it is required and also something called version 1.1.1 that it is normally added in the MAP file when using Mapserver. Are you using Mapserver? if so, you should read this one: http://mapserver.org/ogc/wfs_server.html, these instructions are useful for WFS layers, but WMS is a bit more problematic, try this one also: http://mapserver.org/ogc/wms_server.html. I think with both of them you will start understanding where the problem is, that it is basically adding the "wms_srs" flag (if using Mapserver) and adding the right projections. If your raster is in UTM, you have to play a bit, probably assigning the right UTM SRID (check for getting ideas: http://stackoverflow.com/questions/1541202/how-do-you-know-what-srid-to-use-for-a-shp-file) plus the 4322 as you already did (or as it appears in the WMS web I put above).
Hope this helps!, cheers
Date: Thu, 24 May 2012 17:12:27 -0400
From: jdmorgan at unca.edu
To: gamejihou at hotmail.com
CC: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] wms layer over openstreet base map
Hola Gery,
That does help and I have been able to narrow the problem down a bit
more. I think this has to do w/ the fact that I am attempting to
load a wms layer and there isn't an entry for the item in epsg
file. I gathered this from the following page
I have now added the epsg for 900913 but I am still having an
issue. I was able to get an error back from the wms server which
is:
<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1">
<ServiceException code="InvalidSRS">
msWMSLoadGetMapParams(): WMS server error. Invalid SRS given : SRS
must be valid for all requested layers.
</ServiceException>
</ServiceExceptionReport>
Thanks,
Derek
On 5/24/2012 1:46 PM, Gery . wrote:
Hello,
I think you're right, projection has something to do there, this
link may help you:
http://blog.sonxurxo.com/2011/04/28/tutorial-de-openlayers-ii-capas-de-google/
There is a lot of stuff about google maps and openlayers and
projection, just google them.
Hope this helps,
> Date: Thu, 24 May 2012 13:37:52 -0400
> From: jdmorgan at unca.edu
> To: openlayers-users at lists.osgeo.org
> Subject: [OpenLayers-Users] wms layer over openstreet
base map
>
> Hello,
> I am trying to get a wms states layer to overlay on a
base openstreet
> map. The openstreet map shows up fine but the wms layer
never does. I
> am guessing this is a projection issue but can't figure
out how to
> resolve it. Any tips would be greatly appreciated. Here
is my code:
>
> <!DOCTYPE HTML>
> <html>
> <head>
> <title>OpenLayers Demo</title>
> <style type="text/css">
> html, body, #basicMap {
> width: 100%;
> height: 100%;
> margin: 0;
> }
> </style>
> <script
src="http://www.openlayers.org/api/OpenLayers.js"></script>
> <script>
> function init() {
>
> map = new OpenLayers.Map("basicMap", {projection:
"EPSG:900913"});
> var mapnik = new OpenLayers.Layer.OSM();
> var fromProjection = new
OpenLayers.Projection("EPSG:4326");
> // Transform from WGS 1984
> var toProjection = new
OpenLayers.Projection("EPSG:900913");
> // to Spherical Mercator Projection
> var position = new OpenLayers.LonLat(-98.0859375,
> 39.095962936305476).transform(fromProjection,
toProjection);
> var zoom = 5;
>
> var stateMap = new OpenLayers.Layer.WMS(
> 'States',
> 'http://pathToWMSlayer/vlayers',
> {layers: 'states', transparent: true}
> {
> isBaseLayer: false,
> }
> );
>
> map.addLayers([mapnik, stateMap]);
> map.setCenter(position, zoom);
> }
> </script>
> </head>
> <body onload="init();">
> <div id="basicMap"></div>
> </body>
> </html>
>
>
> Thanks ahead of time,
> Derek
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Derek @ NEMAC
http://nemac.unca.edu
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120524/5eaaf41b/attachment-0001.html
More information about the Users
mailing list