tags:

views:

537

answers:

1

I'm using an OpenLayers-map and I want to use in it different mapservers, that use different coordinate systems. Can OpenLayers integrate it in the same map and automatically converts coordinate-systems?

+1  A: 

Depending on the layers, you will always have some sort of baselayer (the map) wich you can't really convert. If you want to add data (markers, geo json stuff, etc) on that map you will have to convert it to the projection the baselayer is using.

For markers this can easyly be done by:

// defining our coordinate systems
var google = new OpenLayers.Projection("EPSG:900913"),
    latlon = new OpenLayers.Projection("EPSG:4326");

// transforming the location to the right coordinate system
var location = new OpenLayers.LonLat( 10, 10 ).transform( latlon, google );

// assuming you made an icon and marker layer
var marker = new OpenLayers.Marker( location, icon );     

markerLayer.addMarker( marker );

Check out the Openlayers documentation about transforming location from one system to another.

Dre