Better approach to work with ARCGIS API for WPF

2660
3
01-16-2012 03:25 AM
Labels (1)
DipinBehl
New Contributor
Hi All,

I am developing a Desktop Application using WPF with features such as 'Reverse Geocoding', 'Geocoding Addresses', 'Showing Routes for Stops', 'Showing distance and Estimated Time for a Trip' etc. We are using ArcGis API for WPF for all such functionalities using ESRI's shared servers (we will setup our own servers once we move to production)
We have implemented 'Reverse Geocoding', Geocoding' very well and other features are working well also.
Since being the first-timers to ArcGIS APIs, I am more concerned with our approach and methedology of work.

Particularly, while getting route for a set of stops, we use 'RouteTask' with url 'http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route'. While passing RouteParameters to the RouteTask, i have to set 'ReturnDirections = true' as we also require the distance and time for the route which could be get by 'RouteResult.Directions.TotalLength' and 'RouteResult.Directions.TotalTime'.

While showing the stops and route on the Map, we have to iterate through the list of stops and then create an instance of 'TextSymbol' for each stop, assign a ControlTemplate(to show a circle with stop number) and then add it to the graphics layer.

Also, I would like to ask if there is any drawback of using too many GraphicLayers on a Map. As in our case, we have to show locations of various vehicles and depending upon their status, different images for each vehicle. I am using a different layer for each vehicle status.

Any help or pointers would be life saving.

Thanks.
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
You can use just one GraphicsLayer to label your features. If the graphics are of the same geometry, it is okay that they are added to the same layer. You can even set GraphicsLayer.Renderer to SimpleRenderer with TextSymbol that points to an attribute, this way you don't need to create TextSymbol instance every time.
0 Kudos
DipinBehl
New Contributor
Hi Jennifer and thanks for the reply.

Would I always have to set 'ReturnDirections=true' for the RouteParameters to get the total distance and total drive time for the route, even if I have no intentions to display the directions on the UI. Or is there an optimized way, which i have apparently missed, to get this information. I would also require to get the distance and driver time between each stop in some scenarios.

Thanks.
0 Kudos
JenniferNery
Esri Regular Contributor
Here's some description on the RouteParameters: http://help.arcgis.com/en/webapi/wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.RouteParamet...

If you look at Fiddler response when using this SDK sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Routing, you will see that Total_Time and Shape_Length are returned with RouteDirections=False. ReturnRoutes must be true though to get this information.
0 Kudos