3

How can i display two layers with diferent projections at once? For example i have layer with EPSG:70076 and OSM layer.

5
  • what sort of layers (vector/raster)? what is the source of the layer (wms, wfs, tile cache, google...)? what code have you tried already?
    – Ian Turton
    Apr 30, 2012 at 9:55
  • 1 vector layers 2 wms and OSM 3 Im find example on openlayers site but this reproject all map.
    – Kliver Max
    Apr 30, 2012 at 9:59
  • [code]var options = { projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326") }; map = new OpenLayers.Map('map', options);[/code] This example from openlayers site. How reproject layers with diferent projections?
    – Kliver Max
    Apr 30, 2012 at 10:01
  • im try do like in this example but OSM layer display uncorrect.link
    – Kliver Max
    Apr 30, 2012 at 10:14
  • can you edit those comments into the question
    – Ian Turton
    Apr 30, 2012 at 10:17

2 Answers 2

3

To add two raster layer on the same map like you say in the previous link:

  • Both layer must be set isBaseLayer to false so they were overlay layers.
  • Use the projection property in the map or on each layer.

OSM by default is EPSG:900913 while for a WMS layer you can use any projection the WMS server accepts, so ensure the server accepts the projection you are requesting.

Maybe not necessary to say but remember you can't have a map with a layer in a projection A and a second layer with a projection B.

Cheers.

3
1

Generally, if you have WMS with different projections, you need to deal with this at the server level. Reprojecting tiles on the client will be slow, and unless they have similar projection properties, will probably look awful too (as reprojection usually involves resampling and rotation). If you control the generation of the tiles on the server, then you can reproject at source to a common projection, such as 900913 (geoserver does this, for example).

If you want to reproject vectors, as distinct from rasters, then you can do this client side, but you will probably need to add the proj4js library, as openlayers only natively supports 900913 and 4326. See the example here: http://openlayers.org/dev/examples/using-proj4js.html Also, see the userguide on the proj4js page to see how it is done. http://trac.osgeo.org/ proj4js/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.