POST
|
Hello, I have created a geoprocessing package that utilizes a model that has turn by turn directions as a model parameter. The turn by turn directions are outputted as a .xml file. I need the ability to process the direction strings in another language. Since my code keys on xml tags that are in english, I only need the "normal" text formatted in another language. Is their a way in ModelBuilder to specify the output language? Does anyone have any other ideas on how to return turn by turn directions in another language? (I have attached screen shots of my model for reference, please refer to the RouteDirections.xml parameter) Thanks in advance
... View more
06-19-2013
04:42 AM
|
0
|
0
|
723
|
POST
|
You might also be interested by a centerAndZoom function:
private void centerAndZoom(ESRI.ArcGIS.Client.Map map, ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint, double resolution)
{
double ratio = 1.0;
if (map.Resolution != 0.0)
ratio = resolution / map.Resolution;
if (ratio == 1.0)
map.PanTo(mapPoint);
else
{
ESRI.ArcGIS.Client.Geometry.MapPoint mapCenter = map.Extent.GetCenter();
double X = (mapPoint.X - ratio * mapCenter.X) / (1 - ratio);
double Y = (mapPoint.Y - ratio * mapCenter.Y) / (1 - ratio);
map.ZoomToResolution(resolution, new ESRI.ArcGIS.Client.Geometry.MapPoint(X, Y));
}
}
You can use it to center on a point and zoom to a given resolution. For example centerAndZoom(MyMap, pt, MyMap.MinimumResolution * 4); Center and Zoom needs to be modified for couple of reasons - need to compensate for center when current resolution is already less than minimum resolution - need to compensate for center when current extent envelope does not contain the input point private void centerAndZoom(ESRI.ArcGIS.Client.Map map, ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint, double resolution) { ratio = resolution / map.Resolution; if (Math.Round(map.Resolution,5) <= Math.Round(map.MinimumResolution,5)) map.PanTo(mapPoint); else { map.PanTo(mapPoint); ESRI.ArcGIS.Client.Geometry.MapPoint mapCenter = map.Extent.GetCenter(); double X = (mapPoint.X - ratio * mapCenter.X) / (1 - ratio); double Y = (mapPoint.Y - ratio * mapCenter.Y) / (1 - ratio); map.ZoomToResolution(resolution, new ESRI.ArcGIS.Client.Geometry.MapPoint(X, Y)); } }
... View more
04-16-2013
05:50 AM
|
0
|
0
|
1201
|
POST
|
I was able to Successfully do this can you perhaps put your code up, might be able to help? I have attached code in previous post. The only other way I can think of it is to create a text file output from the Geoprocessing model using ModelBuilder example here http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000009q000000 And then have a method that reads the output text; but it would seem that the directions can be exposed some other way
... View more
03-28-2013
12:15 PM
|
0
|
0
|
244
|
POST
|
Below is code ............................................................................ private LocalGeoprocessingService geoprocessingService; private Geoprocessor geoprocessorTask; // Creating the service and starting public bool CreateNewRoute() { try { var source = ConfigUtils.ProjectLocation + ConfigurationManager.RouteLayer.SourceLayerName + ".gpk"; geoprocessingService = new LocalGeoprocessingService(source, GPServiceType.SubmitJob); geoprocessingService.StartAsync((x) => { if (x.Error != null) Log.Error(x.Error); }); return true; } catch (Exception ex) { Log.Error(ex); return false; } } // Solving route with input locations public bool SolveRoute() { try { geoprocessorTask = new Geoprocessor(geoprocessingService.UrlGeoprocessingService + "/Route"); geoprocessorTask.Failed += new EventHandler<TaskFailedEventArgs>(GeoprocessorTaskFailed); geoprocessorTask.JobCompleted += new EventHandler<JobInfoEventArgs>(GeoprocessorTaskJobCompleted); routeTask = new RouteTask(geoprocessingService.UrlGeoprocessingService + "/Route"); routeTask.SolveCompleted += new EventHandler<RouteEventArgs>(RouteTaskSolveCompleted); routeTask.Failed += new EventHandler<TaskFailedEventArgs>(RouteTaskFailed); List<GPParameter> parameters = new List<GPParameter>(); List<Geometry> inputLocations = new List<Geometry>() { new ESRI.ArcGIS.Client.Geometry.MapPoint(routeStartPoint.X, routeStartPoint.Y,esriMap.SpatialReference), new ESRI.ArcGIS.Client.Geometry.MapPoint(routeEndPoint.X, routeEndPoint.Y,esriMap.SpatialReference) }; FeatureSet featureSet = new FeatureSet(inputLocations); featureSet.GeometryType = GeometryType.Point; featureSet.SpatialReference = esriMap.SpatialReference; GPFeatureRecordSetLayer gpFeatureRecordSetLayer = new GPFeatureRecordSetLayer("Input_Locations", featureSet); parameters.Add(gpFeatureRecordSetLayer); geoprocessorTask.UpdateDelay = 2000; geoprocessorTask.SubmitJobAsync(parameters); return true; } catch (Exception ex) { Log.Error(ex); return false; } } //Route solved async, only features are returned, no way of deriving route direction objects private void GeoprocessorTaskJobCompleted(object sender, JobInfoEventArgs e) { try { geoprocessorTask.GetResultDataCompleted += (s1, e1) => { if (e1.Parameter is GPFeatureRecordSetLayer) { GPFeatureRecordSetLayer gpLayer = e1.Parameter as GPFeatureRecordSetLayer; var gphLayer = (GraphicsLayer)esriMap.Layers["LocalGraphicsLayer"]; gphLayer.ClearGraphics(); int i = 1; foreach (Graphic graphic in gpLayer.FeatureSet.Features) { Symbol sym = new SimpleLineSymbol() { Color = ConfigurationManager.RoutingColorBrush, Width = ConfigurationManager.RoutingWidth, }; graphic.Symbol = sym; gphLayer.Graphics.Add(graphic); } } }; geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Routes"); } catch (Exception ex) { Log.Error(ex); } }
... View more
03-28-2013
12:12 PM
|
0
|
0
|
244
|
POST
|
Hello, I am trying to return driving directions when using a GeoprocessorTask with a local dataset. The example I am following is the "Point-to-point routing in ArcGIS Runtime for WPF" available here http://www.arcgis.com/home/item.html?id=21a58d089764402e90ce127894dec94e. Routing works just fine, however I am unable to get Routing Directions from the resulting FeatureSet. Questions 1) Can one derive directions from a GeoprocessingTask and .gpk (if so how)? 2) Is the RouteTask and subsequent ArcGISServer Network Dataset the only way to return directions? Ultimately my goal is to derive Routing Directions with a local dataset and not have to go through ArcGISServer. Thanks in advance.
... View more
03-28-2013
07:50 AM
|
0
|
3
|
2221
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|