FindResults return features in the wrong coordinate system

1127
2
01-25-2011 03:17 AM
RichardKaufholz
New Contributor
Hi there,

I keep getting results from the FindTask that are in geographical coordinates (i.e. Lat/Long). The map is setup in Web Mercator (and uses Bing as a basemap), so I am expecting results in projected coordinates (i.e. Meters). The API explicitly states that results will be returned in the map coordinates if outSpatialReference is not defined for the Find task. Mine are not defined but results are not returned in the map coordinates.

To further complicate things, I have an Identify function running on the same feature layer (in the same application), and its results come back in web mercator!

Identify Params (works fine):
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [0,4];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.width  = map.width;
identifyParams.height = map.height;


Find Params (dont work fine):
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.contains=true;
findParams.layerIds = [0];
findParams.searchFields = ['SERIAL_NO'];
findParams.searchText = dijit.byId('searchText').get('value');


I have now explicitly set outSpatialReference using FindParameters to wkid:102100, and the results are ok.

Any idea why the results arent being returned in the map coordinates automatically?

Also, perhaps worth noting, the datasets being queried are saved as "Spatial Reference: 4148".

Thanks,
Richard.
0 Kudos
2 Replies
AxelSchaefer
New Contributor II
I keep getting results from the FindTask that are in geographical coordinates (i.e. Lat/Long). The map is setup in Web Mercator (and uses Bing as a basemap), so I am expecting results in projected coordinates (i.e. Meters). The API explicitly states that results will be returned in the map coordinates if outSpatialReference is not defined for the Find task. Mine are not defined but results are not returned in the map coordinates.


I think you misunderstand something in the documentation, or I misunderstand your question. 😉 The returned Coordinate System of a FindTask depends on the Coordinate System of the underlying MapService of the Find Task. Not the MapService used in your Map.

If the coordinate system of the FindTask-MapService differs from the one of the MapDisplay-MapService you have to define as outSpatialReference the Reference of your MapService to show the results on that map.

There is simply the difference between your two used MapServices: The MapService for the FindTask and the MapService for your map display.

(1) If you use the FindTask on a MapService which is (for example) WKID 4326 (WGS84), the results are returned in the coordinate system of this service: the WKID 4326 MapService. So the results are WKID 4326.

(2) If you have an application with a map in WKID 102100 and use the Find tasks on this WKID 102100 service, you'll get the results in WKID 102100.

(3) If you have an application with a map in WKID 102100 and use the Find tasks on the other WKID 4326 service, you'll get the results in WKID 4326. Because the example (1) counts now. You have to specify 102100 for outSpatialReference.

HTH.
Axel
0 Kudos
RichardKaufholz
New Contributor
Hi Axel,

Thanks for your explanation - makes more sense now. Still find it confusing that the Find task does that but not the Identify task. In any case, I have a handler now to convert the results as I need them.

Cheers,
Richard.
0 Kudos