|
POST
|
Hi Uma Harano. Do you know if this is still an issue? I am trying to do something similar.....rotate a point feature symbol (ie. set ROTATION field) to a value that orients it properly for mapping. In my old ArcObjects code I would do this with "line" being the line that the point is attached to at the TO node. object missing = Type.Missing; ILine line = new LineClass(); line.FromPoint = fromPoint; line.ToPoint = toPoint; double angle = (180 * line.Angle / (System.Math.PI)); return angle; In ArcPro SDK I have tried everything I can think of to get this to work, but the results are all over the place. I have no idea where I am going wrong. i am creating the line in ArcPro SDK like this: var lineBuilder = new LineBuilder(fromPoint, toPoint); var line = lineBuilder.ToSegment();
... View more
08-07-2020
11:53 AM
|
0
|
2
|
2128
|
|
POST
|
Hi, I'm creating a MapTool to help with creating a fully digitized sewer connection. It works by sketching a line on the map; the first click creates the connection to the sewer, the last click the 'end' of the line, and everything in between is the actual sewer connection. Currently I check for the first click to be intersecting the gravityMainLayer in the OnSketchCompleteAsync. It works, and I've created some IntersectsLayer code to determine an intersection of the first point. protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
var pointCollection = ((Multipart)geometry).Points;
MapPoint connectionPoint = pointCollection[0];
MapPoint plugPoint = pointCollection[pointCollection.Count - 1];
QueuedTask.Run(() =>
{
if (IntersectsLayer(connectionPoint, gravityMainLayer) == false)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The starting point must intersect the GravitySewer layer.", "Error");
return;
}
.....
blah, blah, blah,
.....
return base.OnSketchCompleteAsync(geometry);
}
public bool IntersectsLayer(MapPoint point, FeatureLayer layer)
{
try
{
SpatialQueryFilter spatialFilter = new SpatialQueryFilter();
spatialFilter.FilterGeometry = point;
spatialFilter.SpatialRelationship = SpatialRelationship.Intersects;
RowCursor theCursor = layer.Search(spatialFilter);
Feature feature;
while (theCursor.MoveNext())
{
using (feature = (Feature)theCursor.Current)
{
return true;
}
}
return false;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
}
return false;
} To make things work better for the user, I am trying to have it check for the intersection after the first mouse click, to avoid the user making more clicks when not necessary. So I am using the OnToolMouseDown to capture the first click, and the look for the intersection. The problem is that each time the IntersectLayer always returns false, even though I am for sure clicking a point that is intersecting the gravityMainLayer. As soon as I comment out the OnToolMouseDown code, everything works fine again. So my question is should the OnToolMouseDown event return the same MapPoint as the OnSketchCompleteAsync event?? From stepping through the code, it looks like a valid point, but I don't understand why it is never intersecting. protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
{
clickCount++;
e.Handled = true; //Handle the event args to get the call to the corresponding async method
}
//base.OnToolMouseDown(e);
}
protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
if (clickCount == 1)
{
QueuedTask.Run(() =>
{
var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
if (IntersectsLayer(mapPoint, gravityMainLayer) == false)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The starting point must intersect the GravitySewer layer.", "Error");
clickCount = 0;
}
});
}
return base.HandleMouseDownAsync(e);
}
... View more
08-07-2020
06:53 AM
|
0
|
6
|
2913
|
|
POST
|
OK. Thanks Sean Jones. I'm rebuilding an old ArcObjects tool I created ages ago to work in ArcGIS Pro. With ArcObjects all of the features stay selected, regardless of how many you make. I think it just did it....no special programming from what I remember. I'll have to go back and look at the code to be sure. Anyways, "Yes" if something could be added in a future release to "Add to Selection" that would be great. Thanks again!
... View more
08-06-2020
10:00 AM
|
0
|
0
|
952
|
|
POST
|
Great. Yes, I haven't updated my code since 2.6 came out, so I will look into graphics layers and see if that fixes my problem. Thanks!
... View more
08-06-2020
09:56 AM
|
0
|
0
|
1905
|
|
POST
|
Hi, I'm using a MapTool to create some custom features to represent Sanitary Service Connections. The completed line contains a line, with a point on either end. My code is working fine, but I'd like to keep all of the created features selected. When I go to create the next service connection, the previous one de-selects. Is there a way to keep all features selected through the code?? protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
var pointCollection = ((Multipart)geometry).Points;
MapPoint connectionPoint = pointCollection[0];
MapPoint plugPoint = pointCollection[1];
QueuedTask.Run(() =>
{
if (IntersectsLayer(connectionPoint, gravityMainLayer) == false)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The starting point must intersect the GravitySewer layer.", "Error");
return;
}
var editOp = new EditOperation();
editOp.Name = "Create new Sewer Connection";
var connectionAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 3 },
{"Shape", connectionPoint.Clone() }
};
//editOp.Create(sewerFittingsLayer, connectionPoint);
editOp.Create(sewerFittingsLayer, connectionAttributes);
var plugAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 2 },
{"Shape", plugPoint.Clone() }
//determine ROTATION here also!!
};
editOp.Create(sewerFittingsLayer, plugAttributes);
var lineAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 1 },
{"Shape", GeometryEngine.Instance.ReverseOrientation((Multipart)geometry).Clone() },
{"DIAMETER", 50 },
//determine LENGTH here!!
};
editOp.Create(sewerServiceLayer, lineAttributes);
var result = editOp.Execute();
if (result != true || editOp.IsSucceeded != true)
throw new Exception($@"Edit failed: {editOp.ErrorMessage}");
});
return base.OnSketchCompleteAsync(geometry);
}
... View more
08-04-2020
10:51 AM
|
0
|
2
|
999
|
|
POST
|
Great. Thanks Sean Jones. Another related question: Is it possible to snap to a graphic that is drawn on the screen? In my case, I have a tool that creates graphics along of a sewer segment to show where residential sewer connections are coming into the pipe (red graphics). Ideally I would be able to snap to these red graphics and not just the line.
... View more
08-04-2020
06:48 AM
|
0
|
2
|
1905
|
|
POST
|
I'm creating a MapTool and I need it to be able to snap to a line. Within Pro, I have edge snapping 'enabled' and snapping turned on. I also have Snapping turn on through the code in the MapTool, but either way I cannot get the little 'cross hair' cursor to snap to anything. Where am I going wrong with this?? protected override Task OnToolActivateAsync(bool active)
{
Snapping.IsEnabled = true;
Snapping.SetSnapMode(SnapMode.Edge, true);
Snapping.SetSnapMode(SnapMode.End, true);
return base.OnToolActivateAsync(active);
}
... View more
07-31-2020
07:37 AM
|
0
|
4
|
1985
|
|
POST
|
Hi, I'm using a DJI Phantom Pro 4 to capture imagery which I then process in Drone2Map. I am trying to create an accurate orthomosaic using the images. While it looks good, it is off in terms of the accuracy of it. The image below shows my captured orthomaosaic against a 15cm accurate ortho we get from a vendor. As you can see, the road centrelines are off by about 2m. Is there a way to get better accuracy? Either through an enhancement to my drone, or through adjusting the settings in Drone2Map??
... View more
07-17-2020
12:39 PM
|
2
|
5
|
4870
|
|
POST
|
Thanks Than Aung. Sean Jones: Since there does seem to be a need from users to calculate the bearing between two points, is there any way that esri could consider adding this sort of functionality to the SDK? Given two points, to build in all the math required to do this calculation?? Years ago I became quite familiar with another SDK called the Franson GPS SDK, which had all sort of functionality like that built right into the SDK. Anyways....just a thought. Thanks!!
... View more
07-17-2020
12:32 PM
|
0
|
0
|
3104
|
|
POST
|
OK, well I did find a solution that involves calculating it all out yourself, but I would have to imagine there is something pre-built into the SDK that would allow us to do this without all the math. If there is, please let me know. 🙂 double Rad2Degrees = 180 / Math.PI; var lineBuilder = new LineBuilder(fromPoint, toPoint); var lineSeg = lineBuilder.ToSegment(); var degrees = lineSeg.Angle * Rad2Degrees; degrees = 90 - degrees; if (degrees < 0) degrees = degrees + 360;
... View more
07-15-2020
12:46 PM
|
0
|
1
|
3104
|
|
POST
|
Hi Chris, I'm actually looking for something in the SDK for determining the bearing of a selected line feature. For example, as I go iterate through a collection of selected line features features. I can do things like .LENGTH to get the length, .Points to get the points, but what I am look for is .Bearing which does not seem to exist anywhere that I can find.
... View more
07-15-2020
12:17 PM
|
0
|
2
|
3104
|
|
POST
|
Hi, Can't seem to find anything in the SDK or the forums here regarding getting the bearing of a selected line segment. Is there a method somewhere that would do this for me?? I guess I could get the start and end point coordinates and figure it out myself, but I was hoping for something quick and easy. Thanks!
... View more
07-15-2020
10:48 AM
|
0
|
6
|
3181
|
|
POST
|
Hi, I've been droning for a while now, but I'm about to do my first drone job of a gravel stockpile for a volume measurment. Can anyone offer any advice on the best way to do this? How many pictures? Drone speed? Resolution? Camera angle? etc. Thanks!
... View more
07-03-2020
07:54 AM
|
0
|
0
|
679
|
|
POST
|
Hi, So I'm working on a bit of code to visualize sewer service connection from field CCTV data. In the example below, there should be 5 connection on the selected sewer line. I can add those to the map (red squares...see below) as a MapOverlay without any issues. I am now stuck at how to determine the nearest point on the Parcel fabric (polygon layer) because I need to now draw a line (see the hand drawn blue lines below) that goes from the connection point (red square) to the nearest point of the parcel fabric, but using the 'Clock' value as a guide for knowing which direction the sewer connection line is going. Does that make any sense?? I see there is a NearestPoint in the GeometryEngine, but I'm not sure how to select the nearest parcel in a given direction.
... View more
06-26-2020
10:32 AM
|
0
|
1
|
1028
|
|
POST
|
Hi Sean Jones. I ended up just doing math on it, but it's good to know about the ReverseOrientation option. Thanks!
... View more
06-26-2020
09:47 AM
|
0
|
0
|
1011
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-29-2026 07:40 AM | |
| 1 | 10-17-2023 07:40 AM | |
| 1 | 04-14-2026 08:54 AM | |
| 2 | 08-18-2023 08:57 AM | |
| 1 | 04-13-2018 10:07 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-29-2026
09:43 AM
|