Hi, I am using following code sample and I am able to overlay an ArcGIS Server WMS on top of MapQuest OSM which is the same projection as Google Maps.var map = null;
function init() {
OpenLayers.ProxyHost= function(url) {
return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
};
// set MapBox customized theme
OpenLayers.ImgPath = "http://js.mapbox.com/theme/dark/";
// San Francisco
//var lon = -122.391667;
//var lat = 37.760628;
//var zoom = 5;
// Portland
//var lon = -122.838493;
//var lat = 45.432976;
//var zoom = 4;
// Haiti, Port au Prince
var lon = -72.3386;
var lat = 18.5425;
var zoom = 8;
var options = {
//panMethod: null, // set 'panMethod' to null to disable animated panning
controls: [
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.MousePosition()
],
projection: "EPSG:900913",
units: "m",
maxResolution: 156543.0339,
numZoomLevels: 20, // default allowed zoom levels is 16 so change it to 20
maxExtent: new OpenLayers.Bounds(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789)
};
map = new OpenLayers.Map('map', options);
// MapQuest OSM tiles as base layer
OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
name: "MapQuestOSM",
//attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",
sphericalMercator: true,
url: ' http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
clone: function(obj) {
if (obj == null) {
obj = new OpenLayers.Layer.OSM(
this.name, this.url, this.getOptions());
}
obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
return obj;
},
CLASS_NAME: "OpenLayers.Layer.MapQuestOSM"
});
var base_layer = new OpenLayers.Layer.MapQuestOSM();
var wms_3857_layer = new OpenLayers.Layer.WMS(
"ArcGIS Server WMS EPSG:3857",
"http://gouf:6080/arcgis/services/playground/haiti_3857/MapServer/WMSServer?",
{
layers: 'provinces',
styles: '',
version: '1.3.0',
crs: 'EPSG:3857',
transparent: true
},
{
singleTile: true,
transparent: true,
isBaseLayer: false,
projection: 'EPSG:3857'
}
);
wms_3857_layer.setOpacity(0.72);
map.addLayers([base_layer, wms_3857_layer]);
// transform lon/lat to coordinate in EPSG:900913
map.setCenter(
new OpenLayers.LonLat(lon, lat).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
),
zoom
);
}
Figured this out, thanks to James Fee, his 2009 Dev Summit presentation, and the spherical mercator example at mkgeomatics. Basically just had to publish an AGS service in WGS84 and in OL use a map.projection of EPSG:102113.
Also found some cool stuff for using AGS json in OL (and important potato cooking safety tips) at mapbutcher in the process...