Select Features Shows in a Different Location

388
2
11-21-2013 01:36 AM
Nadeera_RukshanMemmenda_Arachc
New Contributor
[ATTACH=CONFIG]29264[/ATTACH]

See the image attached.
When I call the Select Features method, selected features shows in a different location. I debug the code and came to know that WKID values and line feature paths are different in two scenarios (initial load & calling Select Features method). How this can happen? Any solution for that? In the image, first value set is of the initial load of the feature and second value set is of the select feature method call of that feature.
0 Kudos
2 Replies
TracySchloss
Frequent Contributor
What parameters are in query you are using for selectFeatures?  If your featureLayer isn't the same spatialReference as the map, you need to specify a query parameter for outSpatialReference to whatever the map is.
0 Kudos
Nadeera_RukshanMemmenda_Arachc
New Contributor
Thanks for the reply. when i define an outSpatialReference, it's working now. Spatial reference of the basemap is 102100 and that of the layer is 3006.

But, if you see the api reference;


  1. outSpatialReference

  2. The spatial reference for the returned geometry. If not specified, the geometry is returned in the spatial reference of the map. 
  3. selectFeatures(query,selectionMethod?,callback?,errback?)

  4. The outSpatialReference set by the query object is ignored and the map's spatial reference is used. 

So, according to Api reference, map's WKID value should be used when selecting features, isn't it? whay we need to specify WKID for the query if they skip? and how it works when I specify an outSpatialReference?

/Rukshan
0 Kudos