Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
what sort of layers (vector/raster)? what is the source of the layer (wms, wfs, tile cache, google...)? what code have you tried already? –  iant Apr 30 '12 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 '12 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 '12 at 10:01
    
im try do like in this example but OSM layer display uncorrect.link –  Kliver Max Apr 30 '12 at 10:14
    
can you edit those comments into the question –  iant Apr 30 '12 at 10:17

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
Okay. I set Declared SRS 900913 to WMS layer. But nothing changes. OSM not displaying it look like this screenshot. –  Kliver Max Apr 30 '12 at 13:22
    
put your code, please. You can use something like jsfiddle.net to share it –  EricSonaron Apr 30 '12 at 15:51
    
You probably need to explicity add the proj4js library. OpenLayers only has native support for common formats like 900913. See the example here: openlayers.org/dev/examples/using-proj4js.html Also, see the userguide on the proj4js page to see how it is done. trac.osgeo.org/proj4js –  John Barça Jan 30 '13 at 8:45

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/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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