Monthly Archives: November 2008

ArcGIS Server Javascript API Gotcha: Identify

I ran into an odd problem after I installed SP1 (actually a few odd problems) with a site using the ArcGIS Server javascript API.  Basically, the identify task broke in IE only.  All was well in Firefox, so I was stumped, as I didn’t receive any error messages.  So, I cranked open Fidder which revealed that the HTTP request was never happening.  Strange, I thought, so I copied the HTTP request that was working in Firefox from the Firebug Net tab and pasted it into the IE address bar, yet it wouldn’t let me paste the whole URL.  So, the URL was too long…but why?  As it turns out the IdentifyParameters use a geometry, and that geometry has a spatialReference, which comes from the map.  The spatialReference we use is WKID 2913, which is one of the Oregon State Plane projected systems.   When the API sets this value on the javascript map object, it uses the Well-Known Text (WKT) version, which is a REALLY long string.  So, I overwrite the spatialReference on the geometry before executing the identify task with a light object that just has the WKID.  Like so:

function doIdentify(evt) {
    taskParameters.mapExtent =;
    taskParameters.geometry = evt.mapPoint;
    // have to do this in order to make this work in IE.
    // otherwise the AGS jsapi will post the WKT which makes the URL too long.
    taskParameters.geometry.spatialReference = { wkid: 2913, toJson: function() { return '{"wkid":"2913"}'; } };

    var task = new esri.tasks.IdentifyTask(serv.URL);
    taskParameters.height =;
    taskParameters.width =;
    task.execute(this.taskParameters, _identifyResults);


Once the URL wasn’t too long, identify started working in IE again.

Anyone else having any issues after installing AGS 9.3 SP1?

Reblog this post [with Zemanta]