Reprojecting base layers in OpenLayers

OpenLayers can transform vector layers (like WFS). If your vector layer is in EPSG:900913 or EPSG:4326 OpenLayers can handle the transformation itself, otherwise, it needs Proj4js included.

There are examples of how to use OpenLayers with Proj4js.

Raster Layers cannot be transformed by OpenLayers. If you need to include them in a different projection, you have to reproject them by yourself or use a reprojecting WMS proxy like GeoWebCache.


Any good WMS should be able to do the reprojection for you. However I have no idea if ArcGIS Server is a good WMS. If it is unable to provide the layer in 900913 then consider using GeoServer or MapServer as a cascading WMS to handle the reprojection for you.


I'm no OpenLayers guru, but you need to specify the projection of the map object. I think it defaults to WGS84....I could be wrong i might even be the source of the first layer added to the map.

Anyway try something like this (Change the bounds as appropriate)

var googleMercator = new OpenLayers.Projection("EPSG:900913");
var wgs84 = new OpenLayers.Projection("EPSG:4326");
var options = {
    projection: googleMercator,
    units: "m",
    numZoomLevels: 18,
    maxResolution: 156543.0339,
    maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34),
    displayProjection: wgs84,
    controls:[new OpenLayers.Control.Navigation()]}

map = new OpenLayers.Map('div', options);

But then remember when you want to set the map center by using a lat,lon you have to project that coordinate from WGS to GoogleMercator like this (using the wgs84 and googleMercator variable from above).

 var mapCenter = new OpenLayers.LonLat(148,-36);
 mapCenter.transform(wgs84, googleMercator);
 map.setCenter(mapCenter,8);