POST
|
That's what I was looking for, thank you! Even though I have to call "SimplifyAsFeature" on each polygon before Union processes them correctly (and I'm dead sure these polygons are simple already).. if I don't simplify them I get an Exception: System.ArgumentException: Value does not fall within the expected range.
at ArcGIS.Core.Internal.IGeometryEngineIOP.GEUnionArray(IntPtr[] handles, SpatialReferenceTiny srTiny, String wkt, String vWkt, Boolean& outIsKnownSimple)
at ArcGIS.Core.Geometry.GeometryEngine.Union(IEnumerable`1 geometries)
... View more
02-27-2020
04:05 AM
|
0
|
0
|
987
|
POST
|
Hi, I have a network of triangles (TIN) and when I draw them all on a feature layer I can easily merge them together into one big polygon (or a few polygons) with EditOperation.Merge. Works well and so far so good. But of course it's a bit silly to draw for example 100000 triangles (which takes ages) and THEN merge them. Instead it would be much better to have the PolygonBuilder create the polygons and then merge them right away and just add one big polygon onto my feature layer. In pseudocode it would look a bit like this: var editOp = ...;
var polygons = new List<Polygon>(myTriangles.Count);
foreach (var tr in myTriangles) {
var coordinates = tr.GetCoordinates3D();
var pg = PolygonBuilder.CreatePolygon(coordinates, spatialRef);
polygons.Add(pg);
}
editOp.Merge(polygons);
await editOp.ExecuteAsync(); I know this doesn't work right ouf of the box but is there a way I can do this? After all, the merge functionality is there and I don't see why EditOperation.Merge shouldn't work on a sequence of polygons just as it does work on a sequence of Object IDs... Thanks in advance Christian
... View more
02-26-2020
04:58 AM
|
0
|
2
|
1060
|
POST
|
*facepalm* You're right of course.. I assumed that the Catalog pane would update itself automatically just like everything else does in ArcGIS Pro to reflect changes. But turns out it didn't. Thanks a lot!
... View more
01-21-2020
11:27 PM
|
0
|
0
|
1585
|
POST
|
Thanks for your reply. I tried to specify the full path but I wasn't successful.. maybe I'm missing something. Here's the code I typed into the interactive python prompt in ArcGIS: arcpy.CreateFeatureclass_management(arcpy.env.workspace, "test_fc", "POLYGON")
<Result 'C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc'>
arcpy.Delete_management('C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc')
<Result 'true'> However, the layer in the map is gone.. but the feature class is still present in the Example.gdb. What am I doing wrong?
... View more
01-21-2020
07:35 AM
|
0
|
2
|
1585
|
POST
|
Thank you, I moved the question to the Python sub-space.
... View more
01-21-2020
05:51 AM
|
0
|
0
|
1585
|
POST
|
Hi, I have a very simple need: I want to delete a feature class from an ArcGIS Pro project permanently. arcpy.Delete_management only seems to delete the layer from the map, but not the feature class. How can I delete the feature class permanently? (Apart from arcpy I could also use the ArcGIS Pro SDK, just in case somebody knows a way to do it there) Thanks in advance Christian
... View more
01-21-2020
12:32 AM
|
0
|
6
|
1768
|
POST
|
Hi, ArcGIS has a nice command to edit the vertices (add, delete, move etc.) of a polyline and it also makes it easy for me to actually call it from a Button: var iCommand = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesModifyFeature") as ICommand;
if (iCommand != null && iCommand.CanExecute(null))
iCommand.Execute(null); Now whenever a polyline vertice is added, moved or deleted through this command I need to update an internal data structure. Is there a way to get this information somehow? Maybe there's an event or something? Because it would be great if I could just use the ArcGIS functionality instead of having to re-implement most of the stuff.. Thanks in advance! Best regards Christian
... View more
11-25-2019
02:41 AM
|
0
|
2
|
852
|
POST
|
Hi Sean, thank you for your reply. I got it working with the Modify-method 🙂 Best Regards Christian
... View more
05-28-2019
11:32 PM
|
1
|
0
|
735
|
POST
|
Hi, I have a simple polyline feature layer and there are some polylines on it that I want to reshape/replace with new polylines and I'm having a little trouble with it. So, this code here works fine: public async Task SetPolylineShapeAsyncViaCursor(int polylineId, ArcGISGeo.Polyline newPolyline) {
FeatureLayer polylineFeatureLayer = //Get feature layer
if (polylineFeatureLayer == null)
return;
await ArcGISTasks.QueuedTask.Run(() => {
var queryFilter = new ArcGISData.QueryFilter();
queryFilter.WhereClause = String.Format("{0} = {1}", "PID", polylineId);
var cursor = polylineFeatureLayer.Search(queryFilter);
if (cursor.MoveNext()) {
var feature = (ArcGISData.Feature)cursor.Current;
feature.SetShape(newPolyline);
feature.Store();
}
});
} However, I'd very much prefer to use an EditOperation since this polyline operation is part of a bigger editing process and I eventually want to pass around an EditOperation instance that all methods use and in the end ExecuteAsync is called once. For now I'd like to have it working with a local EditOperation, but it doesn't work when I try to modify the shape via EditOperation.Reshape (it only yields an "EditOperation failed" error): public async Task SetPolylineShapeAsyncViaReshape(int polylineId, ArcGISGeo.Polyline newPolyline) {
FeatureLayer polylineFeatureLayer = //Get feature layer
if (polylineFeatureLayer == null)
return;
long polylineOID = await this.GetPolylineOIDAsync(polylineId);
if (polylineOID == -1)
return;
var polylineOperation = new EditOperation();
polylineOperation.Reshape(polylineFeatureLayer, polylineOID, newPolyline);
await polylineOperation.ExecuteAsync();
} It must be a small detail that's missing but I'd be glad if somebody could tell me what I'm doing wrong. Thanks in adavance Best Regards Christian
... View more
05-27-2019
12:17 AM
|
0
|
2
|
1132
|
POST
|
Hi, I'm currently dipping into using EmbeddableControls by fooling around with the official DivideLines sample. The ViewModel overrides the OpenAsync method of the EmbeddableControl base class to set up some stuff. When I fire up the "Divide Lines" tool from the "Edit" tab the OpenAsync method gets called once as expected. But if I change the Config.daml and start the tool from it's own ribbon tab page the OpenAsync method gets called twice.. and I can't figure out why?! Since the OpenAsync method subscribes to events etc. it's less than optimal if it gets called multiple times and I have to work around with an isControlOpen flag - which is not so diserable. So, how come the OpenAsync method is called twice when the tool is started from the ribbon tab but not when called from the "Edit" tab? Thanks in advance Christian
... View more
07-24-2018
06:40 AM
|
0
|
0
|
243
|
POST
|
Thanks for your reply, it does make sense.. somewhat ^^ Anyway, so the only way to avoid the exception is reprojecting the polyline into the layer's spatial reference? Or is there something else I should do?
... View more
02-20-2018
10:59 PM
|
0
|
0
|
841
|
POST
|
Hi, I have a feature layer with polylines, let's call it "polyline_layer". And there are already some polylines on this layer. Now I created a map tool that lets the user sketch a new polyline on that specific layer. So far so good, but I need to check whether the newly sketched polyline touches an existing polyline (so I can modify the existing polyline instead of creating a new one).. but when I call "GeometryEngine.Touches" to check whether two polylines touch an exception is thrown ("incompatible spatial references"). How can this happen? The new polyline has been sketched on the same layer that contains the existing polylines. The WKIDs of the spatial references are the same, but IsEqual returns false nonetheless. This seems a bit strange to me?! If I project the sketched polyline into the spatial reference of the layer everything works fine, but it's stilll a bit weird. Here's some example code: internal class CreatePolyline : MapTool {
public CreatePolyline() {
IsSketchTool = true;
UseSnapping = true;
SketchType = SketchGeometryType.Line;
}
/// <summary>
/// Called when the sketch finishes. This is where we will create the sketch operation and then execute it.
/// </summary>
/// <param name="geometry">The geometry created by the sketch.</param>
/// <returns>A Task returning a Boolean indicating if the sketch complete event was successfully handled.</returns>
protected override async Task<bool> OnSketchCompleteAsync(Geometry geometry) {
var sketchedPolyline = (Polyline)geometry;
if (sketchedPolyline == null)
return false;
if (sketchedPolyline.PointCount < 2)
return false;
FeatureLayer polylineFeatureLayer = //Get feature layer called "polyline_layer"
var geoEngine = GeometryEngine.Instance;
await QueuedTask.Run(() => {
//Uncomment the following lines to avoid the exception
//var srLayer = polylineFeatureLayer.GetSpatialReference();
//sketchedPolyline = (Polyline)geoEngine.Project(sketchedPolyline, srLayer);
var rowCursor = polylineFeatureLayer.Search();
while (rowCursor.MoveNext()) {
var polyline = (Polyline)rowCursor.Current["SHAPE"];
if (geoEngine.Touches(sketchedPolyline, polyline)) {
//Do something..
}
}
});
return true;
}
} I'd be glad if anyone could look into it! Thanks in advance. Best Regards Christian
... View more
02-20-2018
07:36 AM
|
0
|
2
|
1012
|
POST
|
Thanks for your reply! The code works for me, too. But what doesn't work is manually creating a feature on the newly created layers afterwards. Did you test that as well? In any case, I'm currently on vacation and maybe the problem lies in my project file which I will upload as soon as I'll be back after the holiday season in January. Best Regards Christian
... View more
12-20-2017
07:21 AM
|
0
|
1
|
1496
|
POST
|
Hi Nasir, thanks a lot for the detailed description. It looks like something I can use! I'll check it out in more detail after I return from the holidays next January. Best Regards Christian
... View more
12-20-2017
07:18 AM
|
0
|
0
|
381
|
POST
|
Hi Thomas, thanks a lot for the link. I'll look into it after I return from the holidays next January. Best Regards Christian
... View more
12-20-2017
07:17 AM
|
0
|
0
|
381
|
Title | Kudos | Posted |
---|---|---|
1 | 11-13-2017 05:53 AM | |
2 | 02-15-2021 02:46 AM | |
1 | 01-21-2021 11:37 PM | |
1 | 05-28-2019 11:32 PM | |
1 | 11-14-2017 05:21 AM |
Online Status |
Offline
|
Date Last Visited |
05-16-2022
02:48 AM
|