Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer"/> Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"/> Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> Url="http://servicer.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_MedianIncome_US_2D/MapServer"/>
' Zoom to selected feature (define expand percentage) Dim selectedFeatureExtent As ESRI.ArcGIS.Client.Geometry.Envelope = selectedFeature.Geometry.Extent Dim expandPercentage As Double = 230 Dim widthExpand As Double = selectedFeatureExtent.Width * (expandPercentage / 50) Dim heightExpand As Double = selectedFeatureExtent.He ight * (expandPercentage / 50) Dim displayExtent As New ESRI.ArcGIS.Client.Geometry.Envelope(selectedFeatureExtent.XMin - (widthExpand / 2), selectedFeatureExtent.YMin - (heightExpand / 2), selectedFeatureExtent.XMax + (widthExpand / 2), selectedFeatureExtent.YMax + (heightExpand / 2)) MyMap.ZoomTo(displayExtent)
You have just to initialize the spatialreference of your identify parameters to the spatial reference of your map.
Something like:
identifyParams.SpatialReference = MyMap.SpatialReference
' QUERY NUMBER 2
Dim identifyParamsParcels As ESRI.ArcGIS.Client.Tasks.IdentifyParameters = New IdentifyParameters() With {.SpatialReference = MyMap.SpatialReference}
identifyParamsParcels.LayerIds.Add(8)
Dim queryTask62 As New QueryTask("http://gis.org/arcgis/rest/services/MG_Test_WGS84/MapServer/8")
AddHandler queryTask.ExecuteCompleted, AddressOf QueryTask_ExecuteCompletedSearch
AddHandler queryTask.Failed, AddressOf QueryTask_FailedSearch
queryTask.ExecuteAsync(identifyParamsParcels)
query.ReturnGeometry = true;
query.OutSpatialReference = MyMap.SpatialReference;
Sorry I gave you the code for 'Identify' instead 'Query'.
Query version:
query.ReturnGeometry = true; query.OutSpatialReference = MyMap.SpatialReference;
Private Sub QueryComboBox_SelectionChangedSearch(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
If QueryComboBox.SelectedItem.ToString().Contains("Select...") Then
Return
End If
Dim queryTask As New QueryTask("http://gis.org/arcgis/rest/services/MG_Test_WGS84/MapServer/8")
AddHandler queryTask.ExecuteCompleted, AddressOf QueryTask_ExecuteCompletedSearch
AddHandler queryTask.Failed, AddressOf QueryTask_FailedSearch
Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
query.OutFields.Add("*")
query.Text = QueryComboBox.SelectedItem.ToString()
query.ReturnGeometry = True
query.OutSpatialReference = MyMap.SpatialReference
queryTask.ExecuteAsync(query)
End Sub
Jay,
Trust me they are cached/tiled services in different projections...Not Clean. Drop 10200 the service
http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer.
In your screenshots your starting coords are coods similar to: -115.55 and 26
These coords look like Web Mecator 4326 - Check out the rest end point of http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer
Your see the extents are
Intial Extent:
XMin: -301.639333008995
YMin: -226.229499756746
XMax: 301.639333008995
YMax: 226.229499756746
Spatial Reference: 4326
Full Extent:
XMin: -179.99999
YMin: -89.99999
XMax: 179.99999
YMax: 89.99999
Spatial Reference: 4326
NOW Lookk at the Coords after your Zoom: They are like 5641362.218 and -10407985.655 - these look like Web Mecartor 102100 coords
Now take a look at this endpoint http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer
Notice the extent are very similar:
Intial Extent:
XMin: -20037507.0671618
YMin: -22882589.2065154
XMax: 20037507.0671618
YMax: 22882589.2065155
Spatial Reference: 102100 (3857)
Full Extent:
XMin: -20037507.0671618
YMin: -19971868.8804086
XMax: 20037507.0671618
YMax: 19971868.8804086
Spatial Reference: 102100 (3857)
From my understanding there is no way you can project these two services at the same time and it is very bad practice to have 2 different projected cached services!
Just for humor drop the http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer
Rebuild and test.
J