[OpenLayers-Users] confused about wms projections and spherical mercator

Andreas Hocevar ahocevar at opengeo.org
Mon Sep 7 09:16:30 EDT 2009


Jonathan Wolfe wrote:
> Thanks Andreas,
>
> Your explanation was most helpful!  So I imagine people stumble across
> this issue a lot... do you have to convince the source to make the
> data available in the format desired and if they don't you can't
> display the data?

It takes more CPU power to server a reprojected map image than one in
the native projection. Anyway, you still can display these maps in
OpenLayers, you just cannot combine them with commercial map providers
like Google Maps. Make sure to provide projection, units, maxExtent and
maxResolution when you instantiate the layer.

Regards,
Andreas.

>
> Thanks again,
> Jonathan
>
> Andreas Hocevar wrote:
>> Jonathan Wolfe wrote:
>>   
>>> I'm just playing with the examples here 
>>> (http://trac.openlayers.org/wiki/AvailableWMSServices) and can't get 
>>> this one to plot on a spherical mercator as it gives:
>>>
>>> msWMSLoadGetParams(): WMS Server error. Invalid SRS : SRS must be valid 
>>> for all selected layers.
>>>
>>> Please correct me if I'm wrong, but can't anything be reprojected onto 
>>> the google projection?
>>>     
>>
>> It can, but MapServer only offers the projections that a layer is
>> configured to support. To see these, just issue a GetCapabilities
>> request. For the server from your snippet below, this would be
>>
>> http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?request=GetCapabilities&service=WMS&version=1.1.1
>>
>> As you can see, most layers in there are only provided in EPSG:42304.
>>
>>   
>>>  It's just a reprojection, right?  Also, is 
>>> mapserver on a remote server? Like in this example, it would be their 
>>> mapserver that would need to be changed to reproject the data?
>>>   
>>>     
>>
>> Exactly.
>>
>> Regards,
>> Andreas.
>>
>>   
>>> Hopefully someone can shed some light on how these pieces fit together.
>>>
>>> Thanks,
>>> Jonathan
>>>
>>>
>>> here is the relevant snippets:
>>>  var options = {
>>>                                 projection: new 
>>> OpenLayers.Projection("EPSG:900913"),
>>>                                 displayProjection: new 
>>> OpenLayers.Projection("EPSG:4326"),
>>>                                 units: "m",
>>>                                 maxResolution: 156543.0339,
>>>                                 maxExtent: new 
>>> OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)
>>>                         };
>>> map = new OpenLayers.Map('map', options);
>>>
>>> var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
>>>                 "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
>>>                 {layers: "bathymetry,land_fn,park,drain_fn,drainage," +
>>>                          "prov_bound,fedlimit,rail,road,popplace",
>>>                  transparent: "true", format: "image/png" });
>>>
>>> map.addLayer(dm_wms);
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>   
>>>     
>>
>>
>>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list