Map without initial extent uses WKT for requests rather than WKID

814
3
12-03-2012 10:12 AM
BrendanWard
New Contributor II
We are running into an issue while upgrading our JSAPI stack for Data Basin (www.databasin.org) to version 3.2

We have found that when you create a JSAPI map (e.g., per JSAPI sample: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/map_terraindemographic.html)

All requests to the operational layer use the WKID of the map's spatial reference for the export image request.  For example (URL decoded for clarity):
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSer...

However, if you comment out the line that sets the initial extent of the map, when the map object is created

map = new esri.Map("map",{
    //extent:esri.geometry.geographicToWebMercator(initExtent)
});


The map still initializes fine, but all export image requests use WKT instead.  For example (url decoded):
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSer...{"wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"}&imageSR={"wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"}&size=600,400&f=image

Which makes for very large requests, and breaks some of our back-end servers which have implemented the ArcGIS server REST API (to serve NetCDF format files using a custom server).

In both cases, the map.spatialReference parameter looks identical (uses WKID 102100)

Why is this?  Is there another configuration parameter we should be using?

EDIT:
This is related to the wrapAround180 property set when the map is created, and the map being within or outside world extent.
If you turn off wrapAround180 (it defaults to true in the JSAPI now), this issue does not occur.
If you leave it on, but set an extent within world bounds, this issue does not occur.  If you zoom out beyond world extent, this issue DOES occur.
0 Kudos
3 Replies
JohnGravois
Frequent Contributor
i noticed the behavior you mentioned even in the published sample (which defines an initial extent for the map) when zooming out to full world scale.  that being said, the behavior does seem specific to cases in which wrapAround180 is set to true.

i'll check into this and let you know what i find...
0 Kudos
JohnGravois
Frequent Contributor
i tested the same sample all the way back to version 2.8 of our API and the behavior is the same.  What version are you upgrading from?
0 Kudos
BrendanWard
New Contributor II
We are upgrading from 2.3 (we have a huge code stack, so upgrades are not as frequent as we'd like)

We've never turned on wrapAround180 previously, and are currently turning it off in our main app due to internal issues with geometry coordinates and extents that get a bit messed up after wrapping.  Long term we want to turn it on once we've got past those issues.

The issue only came up in some of our lightweight unit test pages, wherein we were not necessarily turning off all the things are are now defaulting to on in the 3.2 JSAPI...
0 Kudos