Select to view content in your preferred language

QueryTask result features set to wrong projection system

6021
20
11-19-2014 09:09 PM
SadanandacharB1
New Contributor III

Hi All,

I am getting QueryTask result features in wrong projection system,

1. Task : Migrating of Arcgis server from 10.0 to 10.2.1

2. Development: Silverlight application version 5.0

3. All original map service layers render in correct location in the Map control.

4. But after the using Query task on route event layer, the result objects are set to wrong projection system, it pans to the coast of Africa near Nigeria, when i check the WKID for result features it is set to 102100.

I have also set outSpatialReference [source from map] on query result features no use,

Any one can please help on this...

Thanks

Sadanand

0 Kudos
20 Replies
DominiqueBroux
Esri Frequent Contributor

You have to set the Query.OutSpatialReference before executing the query task.

There are a few query samples that demonstrate how to do it in the Silverlight interactive SDK.

If you are experiencing issues in a specific use case, please share a repro.

Thanks

/Dom

0 Kudos
SadanandacharB1
New Contributor III

Hi Dominique, thanks for the replay, even i had try this by setting this property like below

myQuery.OutSpatialReference = Mainpage.map.SpatialReference; but getting the same error, what could be the cause ? please help on this issue..

Thanks

Sadanand

0 Kudos
JenniferNery
Esri Regular Contributor

Hi Sadanand,

What error message do you get from QueryTask? What SpatialReference is the service in and what is the SpatialReference of your map? Setting Query.OutSpatialReference should return features in that SpatialReference. Does the QueryResult.Features come back with the expected SpatialReference? Are you using GraphicsLayer or FeatureLayer to display these features?

Sorry I have more questions than answers. You can also try running Fiddler to see if there are any error messages from the server and if that error is being captured in the TaskFailedEventArgs when you subscribe to QueryTask.Failed event.

.

0 Kudos
SadanandacharB1
New Contributor III

Hi Jennifer,

Thanks for your replay, below are the details that I have tried.

1. Copied the Geodatabase from Oracle to Geodatabase at Oracle using ArcCatalog 10.2.1 tool copy 'Feature Class to Feature Class'. This is for the purpose of Upgrading the ArcGIS 10.0 to ArcGIS 10.2.1 [New Machine used for ArcGIS server 10.2.1]

2. Created a ArcMap file and added the below layer

  2a. Roads feature layer with M values from the Oracle Geodatabase.

  2b. Added attribute table called Bridges_details. [View in the same Geodatabase]

  2c. Created a 'Make Route Event Layers' using the above 2 layer, this is to show the bridge points on top of  road

3. All the above 3 layers are in the projection system 'WGS_1984_UTM_Zone_44N' by default.

4. In .mxd file 'Layers' projection system is set to WGS_1984_Web_Mercator_Auxiliary_Sphere WKID: 102100, this is published as Mapservices

5. When I run the Silverlight web application all published layers and a basemap are displayed in correct location.

6. I am using QueryTask to locate bridge points, and below are the details.

  6a. Mainpage.map.SpatialReference is set to WKID: 102100

  6b. Query.OutSpatialReference is set with Mainpage.map.SpatialReference [i.e. 102100]

  6c. GraphicsLayer is used to add QueryTask results

7. But QueryResult.Features are not come back as expected, [locating in Africa near Nigeria UTM zone 30 and 31]

8. And one thing I noticed when I provide Bridges_details attribute table [RDBMS View] as a file geodatabase, the QueryResult.Features returns correctly as I expected

What could be the reason please help me, I prefer to use Bridges_details view as dynamic.

Thanks

Sadanand

0 Kudos
JenniferNery
Esri Regular Contributor

Hi Sadanand,

Can you check the web response? You can run Fiddler while your app is making the query, it should look similar to this:query.PNG

If the JSON has spatialReference that is correct (same as outSR=102100), check that QueryResult.Features SR is also the same.

0 Kudos
SadanandacharB1
New Contributor III

Hi Jennifer,sc2.png

         I have run the fiddler, Above is  the screenshot of that query results , My qyeryResult.Features SR has same as JSON spatialReferene, But output is still locating on Africa, what to do?

0 Kudos
SadanandacharB1
New Contributor III

Hello  Jennifer,

        I have one more problem in arcgis 10.2.1 , If i join one oracle attribute table to one spatial table(Feature Class) using "Join and Relates" and accessed as a map service,  It's projection system also changes. But when i publish only spatial table it locate's on the correct projection system. What is the problem in Joining?(in ArcGIS 10.0 same procedure is working).

Thanks

Sadanand

0 Kudos
DominiqueBroux
Esri Frequent Contributor

Hi Sadanand,

From your screenshoot, it seems you didn't set the OutSpatialReference as I suggested above.

This parameter drives the SR of the returned features and is key to fix your issue.

Once set, you should see a 'outSR' parameter in the query request sent to the server.

Dominique.



0 Kudos
SadanandacharB1
New Contributor III

Hello Dominique,

I Set the OutSpatialReference  as you said in QueryTask, But No changes, Results locates on Africa,Here is the screenshot of the result.

  queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;

  queryTask.Failed += QueryTask_Failed;

  Query query = new Query();

  query.OutFields.Add("BRIDGE_NAME");

  query.Where = "1=1";

  query.OutSpatialReference = MyMap.SpatialReference;

  query.ReturnGeometry = true;

   queryTask.ExecuteAsync(query);

sc3.png

0 Kudos