ArcGIS Server doesnt like EPSG:900913 and maps doesnt like EPSG:3857. Its a pain.

I got around this with a couple of overrides. Has anyone found a better way?

Ext.override(OpenLayers.Layer.WMS, {
    getFullRequestString:function(newParams, altUrl) {
        var projectionCode = this.map.getProjection();
if((projectionCode == 'EPSG:900913') && this.url.search(/arcgis/)>=0) {
            this.params.SRS = 'EPSG:3857';
        } else {
this.params.SRS = (projectionCode == "none") ? null :projectionCode;
        }
        return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
                                                   this, arguments);
    }
});

Ext.override(OpenLayers.Request, {
    GET:function(config) {
if((config.params.SRS == 'EPSG:900913') && config.url.search(/arcgis/)>=0) {
            config.params.SRS = 'EPSG:3857';
        }
        config = OpenLayers.Util.extend(config, {method: "GET"});
        return OpenLayers.Request.issue(config);
    }
});

And for WFS protocol, create with:
var srs = (currProj=='EPSG:900913' && source.serverUrl.search(/arcgis/)>=0) ? 'EPSG:3857' : currProj;
    if(spatialQueryNode.type=='wfs') {
            source.wfsProtocol = new OpenLayers.Protocol.WFS.v1_1_0({
                url: spatialQueryNode.url,
                featurePrefix: spatialQueryNode.featurePrefix,
                featureType: spatialQueryNode.featureType,
                geometryName :geomName,
                srsName: srs
            });

--
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to