MassGIS / morisoliver

Automatically exported from code.google.com/p/morisoliver
2 stars 2 forks source link

External WMS request not made in EPSG 3857 (why?) #236

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
OLIVER is supposed to be able to request a map in an alternate projection.  

For discussion of the implementation of this see Charlton's comment:  
http://code.google.com/p/morisoliver/issues/detail?id=37#c56

To see it in action use: 
http://maps.massgis.state.ma.us/map_ol/oliver_usgs_1ft_1m.php

Relevant part of oliver_usgs_1ft_1m.php: 

        'http://raster.nationalmap.gov/ArcGIS/services/TNM_Large_Scale_Imagery/MapServer/WMSServer' : {
         name    : 'USGS Orthos 1Ft and 1M'
         ,getcaps : 'usgs_orthos_1ft_1m_getcaps.xml'
         ,proj    : {'EPSG:900913' : 'EPSG:3857'}

       is listed similar to 

         'http://egisws02.nos.noaa.gov/ArcGIS/services/RNC/NOAA_RNC/MapServer/WMSServer' : {
         name    : 'NOAA Charts (RNC)'
         ,getcaps : 'noaa_charts_wms_getcaps.xml'
         ,proj    : {'EPSG:900913' : 'EPSG:3857'}

The equivalent local GetCaps docs are: 

http://maps.massgis.state.ma.us/map_ol/usgs_orthos_1ft_1m_getcaps.xml

http://maps.massgis.state.ma.us/map_ol/noaa_charts_wms_getcaps.xml

Both services offer EPSG 3857.

When I use the external WMS button and choose "NOAA Chars (RNC)" and add the 
layer NOAA_RNC EPSG 3857 is used in the request:

http://egisws02.nos.noaa.gov/ArcGIS/services/RNC/NOAA_RNC/MapServer/WMSServer?LA
YERS=NOAA_RNC&TRANSPARENT=TRUE&STYLES=&STYLE=&FOO=NOAA_RNC&VERSION=1.1.1&SERVICE
=WMS&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG%3A3857&BBOX=-8721029.9495865,488
5335.0436299,-7239680.3416259,5453109.2896533&WIDTH=2422&HEIGHT=928

However, when I use the external WMS button (zoomed into Boston) and choose 
"USGS Orthos 1Ft and 1M" and choose "TNM_Lage_Scale_Imagery" EPSG 900913 is 
used in the request: 

http://raster.nationalmap.gov/arcgis/services/TNM_Large_Scale_Imagery/MapServer/
WMSServer?LAYERS=0&TRANSPARENT=TRUE&STYLES=&STYLE=&FOO=TNM_Large_Scale_Imagery&V
ERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG%3A900913&BBO
X=-7924240.8122241,5207531.44975,-7898271.3318679,5223095.9396322&WIDTH=1359&HEI
GHT=814

Unfortunately, 900913 doesn't work with the USGS service error message 
"Parameter 'srs' contains unacceptable value.") So we would like 3857 to be 
used instead, which does work.

http://raster.nationalmap.gov/arcgis/services/TNM_Large_Scale_Imagery/MapServer/
WMSServer?LAYERS=0&TRANSPARENT=TRUE&STYLES=&STYLE=&FOO=TNM_Large_Scale_Imagery&V
ERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG%3A3857&BBOX=
-8395866.8313066,4920190.3285231,-7564843.4599058,5418254.0047601&WIDTH=1359&HEI
GHT=814

but I can't figure out why 3857 is used for NOAA but not for USGS?
Is it something about the GetCaps content? 

Original issue reported on code.google.com by Aleda.Fr...@state.ma.us on 1 Apr 2014 at 8:22

GoogleCodeExporter commented 9 years ago
The DOM even shows the same entries for proj for these 2 external WMS (see 
attached screenshot)

Original comment by Aleda.Fr...@state.ma.us on 1 Apr 2014 at 8:27

Attachments:

GoogleCodeExporter commented 9 years ago
I'm looking at what I think might be the relevant bit of code, but I can't 
figure out enough to figure out why it's not working:

if (typeof url == 'string' && externalGetCaps[url.split('?')[0]]) {
// override projections for externalWMS
activeLyr[title].getFullRequestString = function(newParams, altUrl) {
var mapProjection = this.map.getProjectionObject();
var projectionCode = this.projection && this.projection.equals(mapProjection) ?
this.projection.getCode() :
mapProjection.getCode();
if (externalGetCaps[this.url.split('?')[0]].proj[mapProjection.getCode()]) {
projectionCode = externalGetCaps[this.url.split('?')[0]].proj[projectionCode];
}
var value = (projectionCode == "none") ? null : projectionCode;
if (parseFloat(this.params.VERSION) >= 1.3) {
this.params.CRS = value;
} else {
this.params.SRS = value;
}

Original comment by Aleda.Fr...@state.ma.us on 1 Apr 2014 at 8:41

GoogleCodeExporter commented 9 years ago
One difference is that there is an error in the console for the USGS and not 
the NOAA:

See attached screenshot.

Original comment by Aleda.Fr...@state.ma.us on 1 Apr 2014 at 8:50

Attachments: