<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19394"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=546052118-17012013><FONT color=#0000ff
size=2 face=Arial>Hi Caspar,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=546052118-17012013><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=546052118-17012013>"</SPAN>If the layer
projection equals the mapprojection, the layer projection is returned<SPAN
class=546052118-17012013>"</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=546052118-17012013><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=546052118-17012013><FONT color=#0000ff size=2 face=Arial>In the
case of map projection = EPSG:900913 and a WMS projection =
EPSG:3857 the WMS GetMap Request will use EPSG:3857.</FONT></SPAN></DIV>
<DIV><SPAN class=546052118-17012013></SPAN><SPAN
class=546052118-17012013></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2>B<SPAN class=546052118-17012013>ecause EPSG:900913 equals EPSG:3857.
Declared in Projection.js.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=546052118-17012013></SPAN></FONT></FONT></FONT> </DIV><SPAN
class=546052118-17012013>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN class=546052118-17012013>For
other projections and aliases OpenLayers cann't decide equality and the map
projection will be used.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=546052118-17012013>I</SPAN>f you include the proj4js-library to your
application, then OpenLayers tests for equality by text comparision of
the proj-strings and that may lead to other results as above, if the <SPAN
class=546052118-17012013>proj-</SPAN>strings not ===.<SPAN
class=546052118-17012013> </SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=546052118-17012013>But it would also provide a possibility to add other
projections and aliases to ones
applications.</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=546052118-17012013></SPAN></FONT></FONT></FONT><FONT face=Arial><FONT
color=#0000ff><FONT size=2><SPAN
class=546052118-17012013></SPAN></FONT></FONT></FONT><FONT color=#0000ff size=2
face=Arial></FONT> </DIV>
<DIV><SPAN class=546052118-17012013></SPAN><FONT face=Arial><FONT
color=#0000ff><FONT size=2>A<SPAN
class=546052118-17012013>rnd</SPAN></FONT></FONT></FONT><BR></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> Casper Span
[mailto:info@spatially-oriented.com] <BR><B>Gesendet:</B> Donnerstag, 17. Januar
2013 08:51<BR><B>An:</B> arnd.wippermann@web.de<BR><B>Cc:</B>
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> Re: [OpenLayers-Users]
epsg:3857 and google 900913<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>
<DIV>
<DIV>
<DIV>Arnd,<BR><BR>I'm talking about lines 247-251 from wms.js (<A
href="https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Layer/WMS.js">https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Layer/WMS.js</A>):<BR><BR>var
mapProjection = this.map.getProjectionObject();<BR>var projectionCode =
this.projection && this.projection.equals(mapProjection) ?
this.projection.getCode() : mapProjection.getCode();<BR>var value =
(projectionCode == "none") ? null : projectionCode;<BR><BR></DIV>If the layer
projection equals the mapprojection, the layer projection is returned. If not,
the mapprojection is returned.<BR><BR></DIV>Correct me if I'm wrong, but that
would say it always returns the map projection code, no matter what I fill in on
the projection code or when I fill it.<BR><BR></DIV>
<DIV>I came across this piece of code after building a WMS server with SharpMap.
I only built in support for EPSG:3857 but the default OSM layer is in
EPSG:900913. My WMS server kept coming with error "SRS 900913 not
supported"<BR></DIV>
<DIV>Please note that in my case the WMS layer is NOT my base layer. If it was,
it WOULD listen to the projection of the layer (as the Map.Projection asks it's
baselayer for the projection)<BR></DIV>
<DIV><BR></DIV>Casper<BR></DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>On Wed, Jan 16, 2013 at 11:13 PM, Arnd Wippermann <SPAN
dir=ltr><<A href="mailto:arnd.wippermann@web.de"
target=_blank>arnd.wippermann@web.de</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff face=Arial>Hi
Caspar,</FONT></SPAN></DIV>
<DIV class=im>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN>"</SPAN>In other words, it will only use the map
projection in it's WMS request URL's<SPAN>"</SPAN></DIV>
<DIV><SPAN></SPAN> </DIV></DIV>
<DIV><SPAN><FONT color=#0000ff face=Arial>That's not right as you have found
out by yourself. If the map projection is equal the wms projection, then the
WMS GetMap Request use the wms projection.</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff face=Arial></FONT> </DIV>
<DIV><SPAN></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=+0>S<SPAN>ome servers provide only requests for EPSG:3857 (an alias for
EPSG:900913) and if you use for your map EPSG:900913, then you can add these
servers and set the projection to EPSG:3857 and it
works.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=+0><SPAN>But it seems,
that that only works for EPSG:900913 and EPSG:4326 and their aliases, because
OpenLayers has aliases defined in OpenLayers
Projection.js.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=+0><SPAN>If you have maps
with other projections and a server support only an alias of the projection,
then the above will perhaps not work.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=+0><SPAN>Then the only
way is to overwrite the getFullRequestString-method of
OpenLayers.Layer.WMS.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN>Example</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=+0><SPAN><A
href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/wms_options_projection.asp"
target=_blank>http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/wms_options_projection.asp</A></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT
size=+0><SPAN>Arnd</SPAN></FONT></FONT></FONT></DIV>
<DIV><BR></DIV><BR>
<DIV dir=ltr lang=de align=left>
<HR>
<FONT face=Tahoma><B>Von:</B> <A
href="mailto:openlayers-users-bounces@lists.osgeo.org"
target=_blank>openlayers-users-bounces@lists.osgeo.org</A> [mailto:<A
href="mailto:openlayers-users-bounces@lists.osgeo.org"
target=_blank>openlayers-users-bounces@lists.osgeo.org</A>] <B>Im Auftrag von
</B>Casper Span<BR><B>Gesendet:</B> Mittwoch, 16. Januar 2013
12:53<BR><B>An:</B> Sergeant_york<BR><B>Cc:</B> <A
href="mailto:openlayers-users@lists.osgeo.org"
target=_blank>openlayers-users@lists.osgeo.org</A><BR><B>Betreff:</B> Re:
[OpenLayers-Users] epsg:3857 and google 900913<BR></FONT><BR></DIV>
<DIV>
<DIV class=h5>
<DIV></DIV>
<DIV dir=ltr>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>Hi,<BR><BR></DIV>If you look at the source of WMS
(lib\OpenLayers\Layer\WMS.js), take a look at
getFullRequestString.<BR></DIV>In it, the baselayer's projection will always
override the given projection. In fact, the layers projection itself will be
ignored:<BR></DIV>- It takes the Map Projection (=Baselayer
projection)<BR></DIV>- then, if the WMS layer projection equals the map
projection, it uses the layer projection<BR></DIV>- otherwise, it uses the map
projection<BR><BR></DIV>In other words, it will only use the map projection in
it's WMS request URL's<BR>
<DIV>
<DIV>
<DIV>
<DIV><BR>So yeah... everything MUST be the same projection for WMS layers or
it cannot be placed on top of eachother.<BR>
<DIV class=gmail_extra></DIV>
<DIV class=gmail_extra>For me, this meant reprojecting my own data so I can
serve it with WMS onto OSM.<BR><BR></DIV>
<DIV class=gmail_extra>You can check these actual outgoing URL's with Firebug
and such.<BR><BR></DIV>
<DIV class=gmail_extra>regards,<BR></DIV>
<DIV class=gmail_extra>Casper Span<BR></DIV>
<DIV class=gmail_extra><BR>
<DIV class=gmail_quote>On Wed, Jan 16, 2013 at 12:31 PM, Sergeant_york <SPAN
dir=ltr><<A href="mailto:electronicpanda@gmail.com"
target=_blank>electronicpanda@gmail.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Hello there,<BR><BR>Thank you for the answer. That gave me
a good idea. Unfortunately it doesn't<BR>work when initializing
layer.<BR><BR>On the other hand creating a layer (for example aLayer object)
then changing<BR>projection works!<BR><BR>Workin way is:<BR>layer aLayer=new
OpenLayers.Layer.WMS ......<BR>aLayer.projection= new
OpenLayers.Projection("EPSG:3857")<BR><BR><BR><BR>--<BR>View this message in
context: <A
href="http://osgeo-org.1560.n6.nabble.com/epsg-3857-and-google-900913-tp5027619p5027809.html"
target=_blank>http://osgeo-org.1560.n6.nabble.com/epsg-3857-and-google-900913-tp5027619p5027809.html</A><BR>
<DIV>
<DIV>Sent from the OpenLayers Users mailing list archive at
Nabble.com.<BR>_______________________________________________<BR>Users
mailing list<BR><A href="mailto:Users@lists.osgeo.org"
target=_blank>Users@lists.osgeo.org</A><BR><A
href="http://lists.osgeo.org/mailman/listinfo/openlayers-users"
target=_blank>http://lists.osgeo.org/mailman/listinfo/openlayers-users</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR><BR>Casper Span<BR>T: <A
href="https://twitter.com/#%21/Span_Droid" target=_blank>@Span_Droid</A><BR>W:
<A href="http://www.spatially-oriented.com"
target=_blank>http://www.spatially-oriented.com</A><BR>M: <A
href="mailto:info@spatially-oriented.com"
target=_blank>info@spatially-oriented.com</A><BR><BR></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR><BR>Casper Span<BR>T: <A
href="https://twitter.com/#%21/Span_Droid" target=_blank>@Span_Droid</A><BR>W:
<A href="http://www.spatially-oriented.com"
target=_blank>http://www.spatially-oriented.com</A><BR>M: <A
href="mailto:info@spatially-oriented.com"
target=_blank>info@spatially-oriented.com</A><BR><BR></DIV></BODY></HTML>