[OpenLayers-Users] WMS and Mercator projection

Andreas Hocevar ahocevar at opengeo.org
Tue Jun 1 07:27:22 EDT 2010


On Jun 1, 2010, at 12:51 , Joosep-Georg Järvemaa wrote:

> 2010/6/1 Andreas Hocevar <ahocevar at opengeo.org>:
>>>>> 
>>> So you're saying that this JOSM-like behaviour where I have the
>>> display picture in EPSG:3857 and am working with real coordinates is
>>> not possible at all with OpenLayers?
>> 
>> Exactly. This is why I showed you the other approach - requesting the tiles in the appropriate projection.
>> 
>> In general, reprojecting images on the client needs processing power. Browsers don't have a lot of that.
> 
> Well, it's just beyond my understanding how can JOSM do that and why
> can OpenLayers not -- only thing what has to be done is ask the image
> from the WMS server -- and the server already serves the image in
> right projection what I want to see.
> 
> The link I'm dragging along is not constructed by myself but is a real
> working URI grabbed from JOSM debug output --
> http://xgis.maaamet.ee/wms-pub/alus-geo?STYLES=&SRS=EPSG:4326&FORMAT=image/png&VERSION=1.1.1&REQUEST=GetMap&LAYERS=of10000,TOPOYKSUS_6569,TOPOYKSUS_7793&bbox=24.6461274,59.3624859,24.6479219,59.3634004&width=499&height=499
> 
> And looking at all those Mercator-examples for OpenLayers something
> tells me that it must be possible... Google serves images in Mercator,
> right? So does the server at maaamet.ee -- you just have to ask for
> the image with EPSG:4326 and real coordinates.

No. Google serves images in Spherical Mercator (EPSG:900913 or EPSG:3857 or whatever EPSG codes there else may exist). maaamet.ee serves images in unprojected WGS84 (EPSG:4326) and EPSG:3301 (a projection suitable for this area).

> How hard can be translating coordinates from one EPSG to another? Some
> OpenLayers examples show some coordinates-translation being done...

It is easy for coordinates. OpenLayers can do it between EPSG:4326 and EPSG:900913, and for other projections you just have to include proj4js. But OpenLayers does not transform map images (which I assume JOSM does).

> I
> just can not understand how can JOSM have that "computing power" and
> browser running on very same machine suddenly does not.

JOSM uses the Java VM to do that. And a Java VM, running compiled code, is much faster than a browser, interpreting JavaScript.

> My final goal is to start drawing vector data from OSM on that
> maaamet.ee WMS layer.

Then you will have to include proj4js on your OpenLayers page and transform existing OpenStreetMap data from Spherical Mercator (EPSG:900913 or EPSG:3857 or whatever) to EPSG:3301, and back before you save it. If you also need this aerial imagery, you will have to use EPSG:4326 instead of EPSG:3301, and live with the strange aspect ratio of the displayed map.

> I just would like to accomplish that without starting to write my own
> JavaScript library which would do that because I am not familiar with
> GIS internals that much...

You can do it with OpenLayers, but you can only do it with projections that your image server supports.

-Andreas.

> 
> 
> 
> Regards,
> -- 
> Joosep-Georg
> _______________________________________________
> 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