[OpenLayers-Users] Having Google map api and arcGIS server. Anybetter ideas?

Arnd Wippermann arnd.wippermann at web.de
Mon Apr 29 09:35:51 PDT 2013


Hi Phil,

For WMS you doesn't need to overwrite getFullRequestString(). 
You have to set projection in the layer options.

Look at
http://osgeo-org.1560.x6.nabble.com/epsg-3857-and-google-900913-td5027619.ht
ml

Example
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/wms_options_projection.asp 

For OpenLayers the projections 

// list of equivalent codes for web mercator
var mercator = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100"],

are equal. If the layer projection equals the mapprojection, the layer
projection are used. 

Arnd



-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Phil
Scadden
Gesendet: Montag, 29. April 2013 06:22
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Having Google map api and arcGIS server.
Anybetter ideas?

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
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list