[OpenLayers-Users] WMS Example Problem
Andreas Hocevar
ahocevar at opengeo.org
Sun Jul 8 01:06:13 PDT 2012
Hi,
when using WMS layers, it is always a good idea to look at the
GetCapabilities response. In this case, this would be
http://geodaten1.graz.at/ArcGIS_Graz/services/Extern/BASISKARTE_WMS/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities
Looking at it, you'll see that layer "3" is just a line with the city
border, and "1" is the base map. So instead of configuring your layer
with
{layers: '3'}
you will probably want
{layers: '1,3'}
See this fiddle for a working Graz map based on your code:
http://jsfiddle.net/CHpMW/
Andreas.
On Tue, Jul 3, 2012 at 7:54 PM, erwin nindl
<nine-ol-users at wirdorange.org> wrote:
> hi,
>
> i want to create a wms layer in combination with a osm layer.
> my first trials do not work:
> http://phoenix.nindl.net/~nine/agis/manual.html
>
> or a snipped here:
>> function init() {
>> var lon = 15.4, lat = 47, zoom = 12;
>> var map;
>> map = new OpenLayers.Map('map',{
>> projection: "EPSG:102100"
>> });
>> var osm = new OpenLayers.Layer.OSM;
>> var wms = new OpenLayers.Layer.WMS(
>> "ogd graz",
>> "http://geodaten1.graz.at/ArcGIS_Graz/services/Extern/BASISKARTE_WMS/MapServer/WMSServer",
>> {layers: '3'}
>> );
>> map.addLayers([wms, osm]);
>> //map.addLayers([wms]);
>> map.setCenter(new OpenLayers.LonLat(lon, lat, zoom).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:102100")), zoom);
>> //map.setCenter(new OpenLayers.LonLat(lon, lat, zoom));
>> map.addControl(new OpenLayers.Control.LayerSwitcher());
>> map.addControl(new OpenLayers.Control.MousePosition({id:'mouse'}) );
>> }
>
> the wms-source can be found here:
> http://geodaten1.graz.at/ArcGIS_Graz/rest/services/Extern/BASISKARTE_WMS/MapServer
>
> and a preview of the prefered tiles can be seen here:
> http://www.arcgis.com/home/webmap/viewer.html?url=http%3a%2f%2fgeodaten1.graz.at%2fArcGIS_Graz%2frest%2fservices%2fExtern%2fBASISKARTE_WMS%2fMapServer&source=sd
>
> where is my mistake?
>
> best regards
> erwin
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list