POST
|
I have two feature classes, treesa_clip and orchard_clip. The fields for the first one looks like this . . . [ATTACH=CONFIG]27113[/ATTACH] and the fields for the second one looks like this . . . [ATTACH=CONFIG]27114[/ATTACH] When I use the Union tool to combine the two into one feature class, I end up with 28 fields, in other words, even though there are fields in common (with common names), it creates two separate fields for those (such as f_code and tile_id). Is there a way that I could get the Union tool, or some other tool, to create an output feature class that also combines fields with names in common? Thanks!
... View more
08-30-2013
06:45 AM
|
0
|
1
|
1249
|
POST
|
Hi, When creating feature services (local or online) there's always a map service with the same content. Therefore - on the LocalFeatureService class there are UrlMapService and UrlFeatureService properties. You can create an ArcGISLocalDynamicMapServiceLayer using the UrlMapService property and an ArcGISLocalFeatureLayer using the UrlFeatureService property. Cheers Mike Thank you. That cleared it up for me. I've changed my code and am trying it out again. I was successful in using the ArcGISLocalDynamicMapServiceLayer for displaying the feature on the map. Thanks again!
... View more
08-15-2013
12:58 PM
|
0
|
0
|
502
|
POST
|
Hi, The reason it fires twice could be because you're explicitly calling Update, but you're also adding the layer to the Map, which you may find initiates a 2nd query and a subsequent UpdateCompleted event (i.e. the second one you're seeing). Note that another option for you might be to put the FeatureLayer in SelectionOnly mode in the Map and add the DynamicLayer equivalent for display. Cheers Mike Thanks so much for the response. Regarding your suggestion . . . "Note that another option for you might be to put the FeatureLayer in SelectionOnly mode in the Map and add the DynamicLayer equivalent for display." I changed the one line to arcGISLocalFeatureLayer.Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.SelectionOnly; However, I'm not sure how to make the dynamic layer equivalent to the local feature layer . . ArcGISLocalDynamicMapServiceLayer dynamicLayer = new ArcGISLocalDynamicMapServiceLayer(). I tried something like . . dynamicLayer.Layers[0] = ? . . but then don't know what to do after that. Thanks!
... View more
08-15-2013
05:39 AM
|
0
|
0
|
502
|
POST
|
I have the following routine that gets the local feature layer service that is used for editing a feature class. For some reason, it goes through the arcGISLocalFeatureLayer.UpdateCompleted event twice. This causes a runtime error due to the lines in which I re-project the aGraphic object. I don't understand why this is happening. private void EditMyFeatureLayer() { // Get the Local Feature Layer service that is used for editing the Result feature class (map package) string mpkPath_features = ConfigurationManager.AppSettings["EsriRuntimeEditMapPackageLocation"]; LocalFeatureService localFeatureService = LocalFeatureService.GetService(mpkPath_features); //CoverAreasResult Feature arcGISLocalFeatureLayer = new ArcGISLocalFeatureLayer(); arcGISLocalFeatureLayer.Service = localFeatureService; arcGISLocalFeatureLayer.Editable = true; arcGISLocalFeatureLayer.ValidateEdits = true; arcGISLocalFeatureLayer.LayerId = 0; arcGISLocalFeatureLayer.ID = "CoverAreasResult"; arcGISLocalFeatureLayer.Path = mpkPath_features; arcGISLocalFeatureLayer.DisableClientCaching = true; arcGISLocalFeatureLayer.AutoSave = true; arcGISLocalFeatureLayer.Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.Snapshot; arcGISLocalFeatureLayer.ShowLegend = true; GraphicCollection aGCollection = arcGISLocalFeatureLayer.Graphics; arcGISLocalFeatureLayer.Initialized += (sender, eventArgs) => { arcGISLocalFeatureLayer.Update(); }; arcGISLocalFeatureLayer.UpdateCompleted += (sender, e) => { ESRI.ArcGIS.Client.Projection.WebMercator aProjector = new WebMercator(); // constructor for easy client projection (102100 <-> 4326) foreach (Graphic aGraphic in _gpFeatureRecordSetLayer.FeatureSet.Features) { aGraphic.Geometry = aProjector.ToGeographic(aGraphic.Geometry); // project graphic geometry to WGS84 aGCollection.Add(aGraphic); // add projected graphic to graphic collection } arcGISLocalFeatureLayer.Graphics = aGCollection; arcGISLocalFeatureLayer.SaveEdits(); // http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html // See above reference - don't need to project layer if going between WGS84 and Web Mercator _map.Layers.Insert(1, arcGISLocalFeatureLayer); }; arcGISLocalFeatureLayer.Initialize(); }
... View more
08-14-2013
07:41 AM
|
0
|
4
|
2432
|
POST
|
As it turned out, the gpk was executing and producing a result, but the result was just not being written out to file geodatabase indicated in the model. I was able to solve this problem by manipulating the object ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer once the gpk was finished executing. Here is the code . . . public ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer _gpFeatureRecordSetLayer; . . . // Check for existence of local geoprocessing package name and start local gpk string gpkPath = ConfigurationManager.AppSettings["EsriRuntimeGeoPackageLocation"]; string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"]; _localGPService = new LocalGeoprocessingService(gpkPath, GPServiceType.SubmitJob); _localGPService.StartAsync((callback) => { if (callback.Error == null) { CoverButton.IsEnabled = true; } else { MessageBox.Show("Error starting service"); } }); public void ExecuteMethod() { string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"]; ESRI.ArcGIS.Client.Tasks.Geoprocessor gp = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(_localGPService.UrlGeoprocessingService + geoObjectPath); gp.OutputSpatialReference = new SpatialReference(4326); List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>(); SubmitJobAsyncMethod(gp, parameters); } private void SubmitJobAsyncMethod(ESRI.ArcGIS.Client.Tasks.Geoprocessor gp, List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters) { gp.JobCompleted += _localGPService_JobCompleted; gp.SubmitJobAsync(parameters); } private void _localGPService_JobCompleted(object sender, JobInfoEventArgs e) { ESRI.ArcGIS.Client.Tasks.Geoprocessor geoprocessorTask = sender as ESRI.ArcGIS.Client.Tasks.Geoprocessor; geoprocessorTask.GetResultDataCompleted += _localGPService_GetResultDataCompleted; geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Cover_Areas"); } private void _localGPService_GetResultDataCompleted(object sender, GPParameterEventArgs e) { _gpFeatureRecordSetLayer = e.Parameter as ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer; foreach (Graphic aGraphic in _gpFeatureRecordSetLayer.FeatureSet.Features) { DisplayGraphicOnMap(aGraphic); } } public void DisplayGraphicOnMap(Graphic graphic) { //Add input graphic to the map graphic.Symbol = this.Resources["InputPolygonSymbol"] as ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol; _graphicsLayer.Graphics.Add(graphic); _map.ZoomTo(graphic.Geometry); _graphicsLayer.Refresh(); }
... View more
08-12-2013
03:24 PM
|
0
|
0
|
95
|
POST
|
I did end up using the ArcGISLocalFeatureLayer object to accomplish what I was trying to do, which was to write the resulting feature class that was created from running the gpk to a geodatabase location of my choosing. I had to grab the GPFeatureRecordSetLayer when the gpk was completed, and use that result to populate the feature class using the Local Feature Layer service. Here is my code . . . // Initialize objects for manipulating result of running gpk ArcGISLocalFeatureLayer arcGISLocalFeatureLayer; public ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer _gpFeatureRecordSetLayer; // start the geoprocessing package string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"]; ESRI.ArcGIS.Client.Tasks.Geoprocessor gp = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(_localGPService.UrlGeoprocessingService + geoObjectPath); gp.OutputSpatialReference = new SpatialReference(4326); List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>(); SubmitJobAsyncMethod(gp, parameters); private void SubmitJobAsyncMethod(ESRI.ArcGIS.Client.Tasks.Geoprocessor gp, List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters) { gp.JobCompleted += _localGPService_JobCompleted; gp.SubmitJobAsync(parameters); } private void _localGPService_JobCompleted(object sender, JobInfoEventArgs e) { ESRI.ArcGIS.Client.Tasks.Geoprocessor geoprocessorTask = sender as ESRI.ArcGIS.Client.Tasks.Geoprocessor; geoprocessorTask.GetResultDataCompleted += _localGPService_GetResultDataCompleted; geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Result");//the name of the output in the model } private void _localGPService_GetResultDataCompleted(object sender, GPParameterEventArgs e) { _gpFeatureRecordSetLayer = e.Parameter as ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer; EditMyFeatureLayer(); } private void EditMyFeatureLayer() { // Get the Local Feature Layer service that is used for editing the Result feature class string mpkPath_features = ConfigurationManager.AppSettings["EsriRuntimeEditMapPackageLocation"]; LocalFeatureService localFeatureService = LocalFeatureService.GetService(mpkPath_features); arcGISLocalFeatureLayer = new ArcGISLocalFeatureLayer(); arcGISLocalFeatureLayer.Service = localFeatureService; arcGISLocalFeatureLayer.Editable = true; arcGISLocalFeatureLayer.ValidateEdits = true; arcGISLocalFeatureLayer.LayerId = 0; arcGISLocalFeatureLayer.ID = "Result"; arcGISLocalFeatureLayer.Path = mpkPath_features; arcGISLocalFeatureLayer.DisableClientCaching = true; arcGISLocalFeatureLayer.AutoSave = true; arcGISLocalFeatureLayer.Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.Snapshot; arcGISLocalFeatureLayer.ShowLegend = true; GraphicCollection aGCollection = arcGISLocalFeatureLayer.Graphics; arcGISLocalFeatureLayer.Initialized += (sender, eventArgs) => { arcGISLocalFeatureLayer.Update(); }; arcGISLocalFeatureLayer.UpdateCompleted += (sender, e) => { foreach (Graphic aGraphic in _gpFeatureRecordSetLayer.FeatureSet.Features) { aGCollection.Add(aGraphic); _map.ZoomTo(aGraphic.Geometry); } arcGISLocalFeatureLayer.Graphics = aGCollection; arcGISLocalFeatureLayer.SaveEdits(); _map.Layers.Insert(1, arcGISLocalFeatureLayer); }; arcGISLocalFeatureLayer.Initialize(); }
... View more
08-12-2013
10:29 AM
|
0
|
0
|
648
|
POST
|
@mbranscomb I've included these lines of code in an attempt to start a local feature service . . . string mpkPath_features = ConfigurationManager.AppSettings["EsriRuntimeMapPackageLocation"]; LocalFeatureService localFeatureService = LocalFeatureService.GetService(mpkPath_features); //CoverAreasResult Feature arcGISLocalFeatureLayer = new ArcGISLocalFeatureLayer(); arcGISLocalFeatureLayer.Service = localFeatureService; arcGISLocalFeatureLayer.Editable = true; arcGISLocalFeatureLayer.LayerId = 0; arcGISLocalFeatureLayer.ID = "CoverAreasResult"; arcGISLocalFeatureLayer.Path = mpkPath_features; arcGISLocalFeatureLayer.DisableClientCaching = true; arcGISLocalFeatureLayer.AutoSave = false; arcGISLocalFeatureLayer.Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.OnDemand; arcGISLocalFeatureLayer.OutFields = new OutFields() { "*" }; _map.Layers.Insert(1, arcGISLocalFeatureLayer); When I used this before, it was with the Editor Widget. I'm not wanting to modify the existing feature class in a type of "draw" mode, I need to replace the existing feature class with the result in the GPFeatureRecordSetLayer. I don't think that I can use this for that, can I? Thanks.
... View more
08-07-2013
06:10 AM
|
0
|
0
|
648
|
POST
|
Option #1 is something that I may have tried before. I'll give that a shot and let you know how it goes. Thanks!
... View more
08-07-2013
03:47 AM
|
0
|
0
|
648
|
POST
|
I have C# code to run a geoprocessing package that produces an output which is stored in a GPFeatureRecordSetLayer. Right now I have code that displays the result on the GUI when the job is complete . . . private void _localGPService_JobCompleted(object sender, JobInfoEventArgs e) { ESRI.ArcGIS.Client.Tasks.Geoprocessor geoprocessorTask = sender as ESRI.ArcGIS.Client.Tasks.Geoprocessor; geoprocessorTask.GetResultDataCompleted += _localGPService_GetResultDataCompleted; geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Areas"); } private void _localGPService_GetResultDataCompleted(object sender, GPParameterEventArgs e) { ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer gpLayer = e.Parameter as ESRI.ArcGIS.Client.Tasks.GPFeatureRecordSetLayer; foreach (Graphic graphic in gpLayer.FeatureSet.Features) { // Code to add graphic to map graphic.Symbol = this.Resources["InputPolygonSymbol"] as ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol; graphic.Geometry.SpatialReference = _graphicsLayer.SpatialReference; _graphicsLayer.Graphics.Add(graphic); _map.ZoomTo(graphic.Geometry); } } What I need to do is to iterate through each graphic and convert the graphic features to an ArcObjects IFeatureClass that I can write to a file geodatabase. In other words, I want to convert a Runtime object to an ArcObject.
... View more
08-06-2013
04:52 PM
|
0
|
4
|
4461
|
POST
|
@sachin The location of the input object is "C:\Projects\Geospatial-Developmental\TestNoGUI\TestNoGUI\Scratch.gdb\TestPolygon". The output object is at "C:\Projects\Geospatial-Developmental\TestNoGUI\TestNoGUI\Scratch.gdb\TestPolygonCopy". I honestly don't know where that temp location is coming from. However, everything in the "Temp" location ("C:\\Users\\Renee Cammarere\\AppData\\Local\\Temp\\arcgisruntime_5528\\simplecopyfeatures2\\jobs) disappears after the process is supposedly complete. The output is not created in either of the locations where it should be put - ( 1)output path defined in the model and 2)output path to location where the gpk is unpacked).
... View more
07-22-2013
10:01 AM
|
0
|
0
|
95
|
POST
|
When I trace through, and check the URL from the Local Geoprocessor object, this is the result when I click on "Execute Task (POST) "{"results":[],"messages":[{"type":"esriJobMessageTypeInformative","description":"Executing (SimpleCopyFeatures2): SimpleCopyFeatures2"},{"type":"esriJobMessageTypeInformative","description":"Start Time: Fri Jul 19 15:43:11 2013"},{"type":"esriJobMessageTypeInformative","description":"Executing (SimpleCopyFeatures2): SimpleCopyFeatures2"},{"type":"esriJobMessageTypeInformative","description":"Start Time: Fri Jul 19 15:43:11 2013"},{"type":"esriJobMessageTypeInformative","description":"Executing (SimpleCopyFeatures2): SimpleCopyFeatures2"},{"type":"esriJobMessageTypeInformative","description":"Start Time: Fri Jul 19 15:43:12 2013"},{"type":"esriJobMessageTypeInformative","description":"Executing (Copy Features): CopyFeatures C:\\Users\\RENEEC~1\\AppData\\Local\\ARCGIS~1\\Documents\\ArcGIS\\Packages\\simplecopyfeatures2\\v101\\scratch.gdb\\TestPolygon \"C:\\Users\\Renee Cammarere\\AppData\\Local\\Temp\\arcgisruntime_5528\\simplecopyfeatures2\\jobs\\_\\j275d94165d9d4f9fa161bfabe2581d55\\scratch\\scratch.gdb\\TestPolygonCopy\" # 0 0 0"},{"type":"esriJobMessageTypeInformative","description":"Start Time: Fri Jul 19 15:43:12 2013"},{"type":"esriJobMessageTypeInformative","description":"Succeeded at Fri Jul 19 15:43:13 2013 (Elapsed Time: 1.00 seconds)"},{"type":"esriJobMessageTypeInformative","description":"Succeeded at Fri Jul 19 15:43:13 2013 (Elapsed Time: 1.00 seconds)"},{"type":"esriJobMessageTypeInformative","description":"Succeeded at Fri Jul 19 15:43:13 2013 (Elapsed Time: 2.00 seconds)"},{"type":"esriJobMessageTypeInformative","description":"Succeeded at Fri Jul 19 15:43:13 2013 (Elapsed Time: 2.00 seconds)"}]}" It appears that the output is being created (TestPolygonCopy), but it doesn't show up.
... View more
07-19-2013
11:49 AM
|
0
|
0
|
468
|
POST
|
I did change the model to include the complete input path. When I created the model before in ArcMap using Modelbuilder, I dragged the feature class and placed it into the model. I guess it didn't grab the full path name, just the name of the layer in ArcMap. I re-created the gpk from this result and tried the code again, but still got the same result. Thanks for your help. I'll just have to keep at it.
... View more
07-17-2013
10:24 AM
|
0
|
0
|
468
|
POST
|
I'll see if I can attach the gpk unpacked and the tool. There's really nothing to the tool. I created it using ModelBuilder (picture attached). Therefore in order to attach it as a script, I had to export the model to a Python script. That is what I've attached, rather than the Modelbuilder model.
... View more
07-17-2013
04:59 AM
|
0
|
0
|
468
|
POST
|
I did re-write the code executing in a non-asynchronous manner, but it didn't make any difference. This is what the changes in the code look like from what I showed previously . . . private LocalGeoprocessingService _localGPService = null; string gpkPath = ConfigurationManager.AppSettings["EsriRuntimeGeoPackageLocation"]; _localGPService = new LocalGeoprocessingService(gpkPath, GPServiceType.Execute); _localGPService.Start(); Inside routine that executes the geoprocessor object . . . string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"]; ESRI.ArcGIS.Client.Tasks.Geoprocessor gp = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(_localGPService.UrlGeoprocessingService + geoObjectPath); //Create a new List of type GPParameter to hold the parameters for the service List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>(); gp.Execute(parameters);
... View more
07-16-2013
05:02 AM
|
0
|
0
|
468
|
POST
|
@sachin I did check the box for ArcGIS Runtime. This is a simple test (I was not able to get my original tool to run). I created a simple model using Modelbuilder, that just uses the CopyFeatures tool to make a copy of a polygon. There are no inputs or output parameters. It runs successfully in ArcMap. By the way, I'm not sure what you meant by "Enabling logging on your local server can also be helpful sometimes"
... View more
07-16-2013
04:27 AM
|
0
|
0
|
468
|
Title | Kudos | Posted |
---|---|---|
1 | 05-02-2017 07:16 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|