Arnd, Sergant_york Thats actually quite scary on one hand, but thanks a lot for clarifying it for me!
Casper On Thu, Jan 17, 2013 at 7:46 PM, Arnd Wippermann <[email protected]>wrote: > ** > Hi Caspar, > > "If the layer projection equals the mapprojection, the layer projection > is returned" > > In the case of map projection = EPSG:900913 and a WMS projection = > EPSG:3857 the WMS GetMap Request will use EPSG:3857. > Because EPSG:900913 equals EPSG:3857. Declared in Projection.js. > > For other projections and aliases OpenLayers cann't decide equality and > the map projection will be used. > > If 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 proj-strings not ===. > But it would also provide a possibility to add other projections and > aliases to ones applications. > > Arnd > ------------------------------ > *Von:* Casper Span [mailto:[email protected]] > *Gesendet:* Donnerstag, 17. Januar 2013 08:51 > *An:* [email protected] > > *Cc:* [email protected] > *Betreff:* Re: [OpenLayers-Users] epsg:3857 and google 900913 > > Arnd, > > I'm talking about lines 247-251 from wms.js ( > https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Layer/WMS.js > ): > > var mapProjection = this.map.getProjectionObject(); > var projectionCode = this.projection && > this.projection.equals(mapProjection) ? this.projection.getCode() : > mapProjection.getCode(); > var value = (projectionCode == "none") ? null : projectionCode; > > If the layer projection equals the mapprojection, the layer projection is > returned. If not, the mapprojection is returned. > > 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. > > 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" > 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) > > Casper > > > On Wed, Jan 16, 2013 at 11:13 PM, Arnd Wippermann > <[email protected]>wrote: > >> ** >> Hi Caspar, >> >> "In other words, it will only use the map projection in it's WMS request >> URL's" >> >> 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. >> >> Some 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. >> >> 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. >> >> If you have maps with other projections and a server support only an >> alias of the projection, then the above will perhaps not work. >> >> Then the only way is to overwrite the getFullRequestString-method of >> OpenLayers.Layer.WMS. >> >> Example >> >> http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/wms_options_projection.asp >> >> Arnd >> >> >> ------------------------------ >> *Von:* [email protected] [mailto: >> [email protected]] *Im Auftrag von *Casper Span >> *Gesendet:* Mittwoch, 16. Januar 2013 12:53 >> *An:* Sergeant_york >> *Cc:* [email protected] >> *Betreff:* Re: [OpenLayers-Users] epsg:3857 and google 900913 >> >> Hi, >> >> If you look at the source of WMS (lib\OpenLayers\Layer\WMS.js), take a >> look at getFullRequestString. >> In it, the baselayer's projection will always override the given >> projection. In fact, the layers projection itself will be ignored: >> - It takes the Map Projection (=Baselayer projection) >> - then, if the WMS layer projection equals the map projection, it uses >> the layer projection >> - otherwise, it uses the map projection >> >> In other words, it will only use the map projection in it's WMS request >> URL's >> >> So yeah... everything MUST be the same projection for WMS layers or it >> cannot be placed on top of eachother. >> For me, this meant reprojecting my own data so I can serve it with WMS >> onto OSM. >> >> You can check these actual outgoing URL's with Firebug and such. >> >> regards, >> Casper Span >> >> On Wed, Jan 16, 2013 at 12:31 PM, Sergeant_york < >> [email protected]> wrote: >> >>> Hello there, >>> >>> Thank you for the answer. That gave me a good idea. Unfortunately it >>> doesn't >>> work when initializing layer. >>> >>> On the other hand creating a layer (for example aLayer object) then >>> changing >>> projection works! >>> >>> Workin way is: >>> layer aLayer=new OpenLayers.Layer.WMS ...... >>> aLayer.projection= new OpenLayers.Projection("EPSG:3857") >>> >>> >>> >>> -- >>> View this message in context: >>> http://osgeo-org.1560.n6.nabble.com/epsg-3857-and-google-900913-tp5027619p5027809.html >>> Sent from the OpenLayers Users mailing list archive at Nabble.com. >>> _______________________________________________ >>> Users mailing list >>> [email protected] >>> http://lists.osgeo.org/mailman/listinfo/openlayers-users >>> >> >> >> >> -- >> >> Casper Span >> T: @Span_Droid <https://twitter.com/#%21/Span_Droid> >> W: http://www.spatially-oriented.com >> M: [email protected] >> >> > > > -- > > Casper Span > T: @Span_Droid <https://twitter.com/#%21/Span_Droid> > W: http://www.spatially-oriented.com > M: [email protected] > > -- Casper Span T: @Span_Droid <https://twitter.com/#%21/Span_Droid> W: http://www.spatially-oriented.com M: [email protected]
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
