|
POST
|
Thank you Charles, I will give it a try with chained edit operations, since I need this both for new and changed features. The key seems to be that the chained operation cannot be created from the RowEvent's operation inside the RowEvent itself because the parent operation is already executing (trying to do so throws an exception as documented here). A pattern that might work (I'm still testing) is: Create a chained EditOperation in the EditStartedEvent In the RowChangedEvent, get an updated shape with surface Z query - letting the parent operation complete and dispose the feature After the surface Z query and further manipulations, but still in the RowChangedEvent handler, get a fresh copy of the feature from the feature layer, and update its geometry in the previously created chained EditOperation I just want to make sure that I'm not creating chained edit operations when I don't need them (e.g., when an edit operation is started on a layer I'm not interested in). Whew, it's getting more complicated than I thought...
... View more
12-02-2022
10:34 AM
|
0
|
0
|
2669
|
|
POST
|
This is a similar issue to what succip posted the other day. I'm trying to update Z values of a feature geometry in a RowEvent (RowCreatedEvent or RowChangedEvent), but while awaiting the Z values, it seems the feature is getting disposed. When trying to update the feature's shape in feature.SetShape(newShape), I get an ArcGIS.Core.ObjectDisconnectedException ("This object has been previously disposed and cannot be manipulated."). My code: public async void OnRowChanged(RowChangedEventArgs args)
{
var feature = (Feature)args.Row;
var newShape = this.PolylineDensifier.Densify(feature.GetShape() as Polyline, MAX_LENGTH);
var result = await MapView.Active.Map.GetZsFromSurfaceAsync(newShape);
if (result.Status == SurfaceZsResultStatus.Ok) newShape = (Polyline)result.Geometry;
newShape = (Polyline)GeometryEngine.Instance.Generalize3D(newShape, GENERALIZE_OFFSET);
UpdateMs(newShape);
newShape = (Polyline)GeometryEngine.Instance.SimplifyAsFeature(newShape, true);
feature.SetShape(newShape);
// ...
} My interpretation: Since the event handler has a void return type, the method is not awaiting the GetZsFromSurfaceAsync call and the edit operation terminates (disposing the feature) before the geometry is being updated. All my other manipulations work well if I skip updating the Z values. I also tried var result = MapView.Active.Map.GetZsFromSurfaceAsync(newShape).Result; But this call never terminates (deadlock). According to Wolfs suggestion in the aforementioned post, I migth start a new EditOperation and re-update the feature there, but to me this looks awkward because my intention was to do all manipulations within the RowEvent's operation. Also, I need the manipulations to appear as one operation on the stack, so that the user cannot undo just my manipulations while the initial create/update operation is not getting undone. How can this be achieved? Is there a way to get Z values synchronously? In ArcMap this was possible with the IFunctionalSurface.Z method, but I haven't found an equivalent in Pro (see also this post). Updating the Zs automatically in the map via ElevationCapturing.CaptureMode = Surface does not seem an option because I want to densify the geometry first and then 3D-generalize it. And updating the Zs in the BeforeSketchCompletedEvent does not seem an option because I need this behavior only for a certain feature layer, both for new features and geometry updates.
... View more
12-02-2022
06:11 AM
|
0
|
5
|
2698
|
|
POST
|
This might work: private static async Task<bool> makeJoin(string rightTableName)
{
var pathRight = Path.Combine(Project.Current.DefaultGeodatabasePath, rightTableName);
var args = Geoprocessing.MakeValueArray(fcName, idField, pathRight, zoneField);
var test2 = await Geoprocessing.ExecuteToolAsync("management.AddJoin", args);
return !test2.IsFailed;
}
... View more
11-18-2022
06:55 AM
|
1
|
0
|
1424
|
|
POST
|
Thanks for the hint Wolf. This works for me (where Graphics is a Dictionary<IMyObjectWithGeometry, IDisposable>): private void FlashGraphic(IMyObjectWithGeometry tag, short flashCount)
{
QueuedTask.Run(() =>
{
for (int i = 0; i < flashCount; i++)
{
MapView.Active.UpdateOverlay(Graphics[tag], tag.Geometry, _invertedSymbol);
Thread.Sleep(200);
MapView.Active.UpdateOverlay(Graphics[tag], tag.Geometry, _originalSymbol);
Thread.Sleep(200);
}
});
} It does flash the geometry, however it does not have the same animation effect as flashing a feature. Would be nice to have a built-in function for flashing geometries on the map.
... View more
11-16-2022
09:21 AM
|
1
|
0
|
5103
|
|
POST
|
You can use PolygonBuilderEx.CreatePolygon() to create polygons from 2D or 3D coordinates, MapPoints, Segments, Multipoints, Envelopes or other Polygons, with or without Spatial Reference.
... View more
11-15-2022
12:39 AM
|
0
|
0
|
2380
|
|
POST
|
Hi Steven, When I upgraded to 3.0 I also had some issues with unit tests. Have you checked https://github.com/EsriJapan/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing? This helped me figuring out how to get my NUnit tests up and running. Key seems to be the helper classes (ArcGISTestClassAttribute, TestResolver, TestEnvironment). ProApp.TestModeInitializeAsync() seems to be required for certain operations, e.g. QueuedTask.Run(). See the attached solution for an example.
... View more
10-26-2022
11:48 PM
|
0
|
0
|
968
|
|
POST
|
You can use the deleteTab tag inside an updateModule tag in your Config.daml file: <modules>
<updateModule refID="esri_editing_EditingModule">
<tabs>
<deleteTab refID="esri_editing_EditingTab" />
</tabs>
</updateModule>
</modules>
... View more
10-24-2022
11:22 PM
|
1
|
0
|
1611
|
|
POST
|
You can implement IExtensionConfig in your Module class and activate/deactivate your events in the State property setter: public ExtensionState State
{
get { return this._state; }
set
{
this._state = value;
if (value == ExtensionState.Disabled) this.UnwireEvents();
else if (value == ExtensionState.Enabled) this.WireEvents();
}
} If you want to persist your extension state in the project, you can overwrite the OnReadSettingsAsync and OnWriteSettingsAsync methods: protected override Task OnReadSettingsAsync(ModuleSettingsReader settings)
{
if (null == settings) return Task.FromResult(0);
var value = settings.Get("MyExtensionState");
if (value != null && value is string s && Enum.TryParse(s, out ExtensionState extensionState))
{
this.State = extensionState;
}
return Task.FromResult(0);
}
protected override Task OnWriteSettingsAsync(ModuleSettingsWriter settings)
{
settings.Add("MyExtensionState", this.State.ToString());
return Task.FromResult(0);
} See also https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings. This also explains how to store settings at the application/user level.
... View more
10-20-2022
06:32 AM
|
0
|
0
|
964
|
|
POST
|
Try this: var invisibleFields = new[] { "OBJECTID", "HIDDEN_FIELD" };
var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var fields = layer.GetFieldDescriptions();
foreach (var field in fields)
{
field.IsVisible = !invisibleFields.Contains(field.Name);
}
layer.SetFieldDescriptions(fields);
... View more
10-17-2022
05:30 AM
|
0
|
1
|
3568
|
|
POST
|
Hi Wolf, just found this thread because I'm having the same issue. I want to create a custom Inspector in an AddIn where the user can edit only a subset of visible attributes from a feature layer. How can this be achieved without modifying the actual layer definition? Is there a way to modify a copy of the schema and pass it to the Inspector?
... View more
09-29-2022
08:03 AM
|
0
|
0
|
2816
|
|
POST
|
Found a solution based on the Database class instead of Geodatabase: var query = string.Format("select cast(forstgis.wimsidutil.nextwimsid({0}) " +
"as number(38,0)) id from dual", unitId);
using (var queryDesc = database.GetQueryDescription(query, "QueryLayer"))
{
queryDesc.SetObjectIDFields("id");
using (var table = database.OpenTable(queryDesc))
using (var cursor = table.Search())
{
while (cursor.MoveNext())
{
using (var row = cursor.Current)
{
return (int)row[0];
}
}
}
}
... View more
05-11-2022
08:40 AM
|
0
|
0
|
1391
|
|
POST
|
In ArcObjects it is possible to return a cursor based on a query string with ISqlWorkspace.OpenQueryCursor(myQuery). I was wondering if and how this is possible in the ArcGIS Pro SDK. The query is in fact calling an Oracle stored procedure which returns a number based on an input number: var myQuery = string.Format("select forstgis.wimsidutil.nextwimsid({0}) from dual", unitId); I tried to put this into a QueryDef and use Geodatabase.Evaluate(queryDef) like this: var queryDef = new QueryDef
{
Tables = "dual",
SubFields = string.Format("forstgis.wimsidutil.nextwimsid({0})", unitId)
}; However, Evaluate in this case throws a COMException (HRESULT: 0x80040351). I know there is also the ArcSDESQLExecute class, but I would prefer not to use Geoprocessing in this case.
... View more
04-22-2022
09:15 AM
|
0
|
1
|
1479
|
|
POST
|
Thanks Curtis, the code works great for the given examples, and also for polygons with multiple interior rings (holes). However, I can't figure out how to create a multipart polygon with a hole in one of its parts (the union of Feat0 and Feat2 - tested with ArcGIS Desktop 10.8.1). The returned polygon will only contain the first part: Feat3 = [
[[3.0, 8.0],
[1.0, 8.0],
[2.0, 10.0],
[3.0, 8.0]],
[[9.0, 11.0],
[9.0, 8.0],
[6.0, 8.0],
[6.0, 11.0],
[9.0, 11.0],
None,
[7.0, 10.0],
[7.0, 9.0],
[8.0, 9.0],
[8.0, 10.0],
[7.0, 10.0]]
] When I try to print the returned polygon with the following method: def printpoly(polygon):
print "Area: {0}".format(polygon.area)
print "Length: {0}".format(polygon.length)
for part in polygon:
for pnt in part:
print pnt I get this result: Area: 2.0
Length: 6.472135955
3,0001220703125 8,0001220703125 NaN NaN
1,0001220703125 8,0001220703125 NaN NaN
2,0001220703125 10,0001220703125 NaN NaN
3,0001220703125 8,0001220703125 NaN NaN Am I missing something or is there a bug in Esri's Polygon constructor?
... View more
11-17-2021
12:50 PM
|
0
|
0
|
6397
|
|
POST
|
Thank you @Steven Salas! In the meantime I also got this information from Esri support. It has also been logged as a bug under BUG-000111144: When a user connects to a database from ArcGIS Deskt.. .
... View more
11-09-2020
11:27 PM
|
2
|
0
|
2836
|
|
POST
|
I've been wondering too. It's also missing in 10.6.1. Have you found out anything about this @Steven?
... View more
10-21-2020
10:35 PM
|
0
|
2
|
2836
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-16-2022 09:21 AM | |
| 1 | 05-19-2025 12:15 AM | |
| 2 | 03-27-2023 07:31 AM | |
| 1 | 03-01-2023 10:59 PM | |
| 1 | 11-18-2022 06:55 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-12-2026
10:03 AM
|