|
POST
|
Thanks! As expected, it worked correctly everytime. I guess it must be something with our data. I'll keep you posted.
... View more
09-23-2020
08:29 AM
|
0
|
0
|
1162
|
|
POST
|
Hi Guys, OK, thanks. I will get that submitted on my end. Wolfgang Kaiser; would it be possible for you to send me your test FGDB you were using? I have been doing more testing here, and get the same issue whether I am using our SDE or a FGDB. Just thought I'd try yours, since you mentioned you didn't have any problems with it. Thanks,
... View more
09-23-2020
05:38 AM
|
1
|
2
|
1162
|
|
POST
|
Hi Wolfgang Kaiser, Well first off, thanks for all your help with this. I was hoping it would have been a quick fix, but if we need to investigate further I will do whatever I can to help. Is this something you will escalate or do I need to do anything? I am up in Canada, so not sure if that will make a difference as to whom this gets escalated to. Thanks!
... View more
09-22-2020
12:21 PM
|
0
|
5
|
1582
|
|
POST
|
Hi Wolfgang Kaiser, I am using ArcGIS Pro 2.6.1 and VS 2015.
... View more
09-22-2020
07:24 AM
|
0
|
7
|
1582
|
|
POST
|
Hi Wolfgang Kaiser, I've run your updated test and here is what I have found: 1. The first connection I made came up 'False' with different End/Plug points. I've attached the file FALSE.json. 2. The second connection I made also came up as 'False' but the End/Plug points are actually the same. See the screenshot below. I noticed this the other day too, figuring it was just an error in the code that displayed the True/False notification, but perhaps there is also something else funky going on here. I've attached the file FALSE_NEGATIVE.json for this one. I'm not sure why toPoint.IsEqual(pntFitting) is always coming out False.
... View more
09-21-2020
05:37 AM
|
0
|
10
|
1582
|
|
POST
|
Hi Wolfgang Kaiser, Our IT department manages the DB and this is what they are telling me: "SQL Server 2014, ArcGIS 10.4.1, however I'm not sure if the DB objects/SDE repository was built in 10.2. We did 'upgrade' SDE when we went to 10.4.1, so I think that means it updates SDE repo." Hopefully that makes sense. 🙂
... View more
09-18-2020
06:58 AM
|
0
|
13
|
1582
|
|
POST
|
Hi Wolfgang Kaiser, Using your sample code I am getting similar results to when I am using my own code. It's a bit of a mixed bag. Sometimes the plug is coincident, and other times not. I used your "Select Coincidence" button to test and your tool to create the Service Connection. It is not always coincident. I also used my tool create the connection and used your button to verify, and the results were basically the same. A mixed bag of some working, and others not. We are using an SQL backend. Do you think that has something to do with it??
... View more
09-17-2020
11:06 AM
|
0
|
15
|
3669
|
|
POST
|
And.....it seems like this is only happening with the plug (to point). In my testing, the service connection (from point, also created with .Clone) is always intersecting the water service line.
... View more
09-16-2020
06:39 AM
|
0
|
17
|
3669
|
|
POST
|
Hi Wolfgang. Thanks for taking the time to help me with this. Here is some additional info to help clarify what I am doing: 1. Yes, a map tool is used to sketch a line. I my code I enable snapping, so I don't think that is an issue. Also, when I create the sketch I am careful to make sure I am snapping to the proper geometry. For this tool, it is really only the 'from' point that is snapped to an existing feature (the edge of a watermain). 2. Yes, the sketched geometry is used to create a 'service connection' (from point...snapped to a watermain) and the 'plug' (to point). The sketched line is also used to create the 'water service' (full sketch) and a 'valve' (2nd vertice on the line). So the end result should look like this: 3. Here is the code I use to create each feature, basically using .Clone on the [0], [Count -1], and [1] of the pointCollection.....and then using the whole sketch geometry for the water service line. protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
//use the sketch geometry to create the connectionPoint and plugPoint
var pointCollection = ((Multipart)geometry).Points;
MapPoint connectionPoint = pointCollection[0];
MapPoint plugPoint = pointCollection[pointCollection.Count - 1];
MapPoint valvePoint = pointCollection[1];
//start creating the features
QueuedTask.Run(() =>
{
if (Global.IntersectsLayer(connectionPoint, waterMainLayer) == false)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(connectionPoint.X.ToString() + ", " + connectionPoint.Y.ToString(), "Error");
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The starting point must intersect the WaterMain or Water Service layer.", "Error");
return;
}
//start a new edit operation and name it for the 'Undo' stack
var editOp = new EditOperation();
editOp.Name = "Create new ICI Connection";
//set the attributes for the connectionPoint and create the point in the Fittings layer
var connectionAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 6 },
{"DIAMETER1", 200 },
{"Shape", connectionPoint.Clone() }
};
editOp.Create(waterFittingsLayer, connectionAttributes);
//set the attributes for the valve and create the point in the Control Valve layer
var valveAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 2 },
{"Shape", valvePoint.Clone() },
{"DIAMETER", 200 }
};
editOp.Create(controlValveLayer, valveAttributes);
//set the attributes for the plug and create the point in the Fittings layer
var plugAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 4 },
{"DIAMETER1", 200 },
{"Shape", plugPoint.Clone() }
};
editOp.Create(waterFittingsLayer, plugAttributes);
//set the attributes for the connection line and create the line in the Connections layer
var lineAttributes = new Dictionary<string, object>
{
{"SUBTYPECD", 1 },
{"Shape", geometry.Clone() },
{"DIAMETER", 200 },
{"LENGTH", GeometryEngine.Instance.Length(geometry).ToString()}
};
editOp.Create(waterServiceLayer, lineAttributes);
//show an error message if not successful
var result = editOp.Execute();
if (result != true || editOp.IsSucceeded != true)
throw new Exception($@"Edit failed: {editOp.ErrorMessage}");
});
return base.OnSketchCompleteAsync(geometry);
}
4. Yes, it seems like .Clone is always creating an exact clone. Once I am finished creating the features there is actually another tool I run that looks at the geoemety between the water service and the fitting (in this case, the plug). If the fitting point (ie. X/Y) does not match exactly the water service from point (ie X/Y), then the tool considers them to not be intersecting and converts the plug into a service connection. Here is an example. Initially both lines below had a 'plug' after being created by the sketching tool. But then after running my 'Fittings Tool', the top one gets converted to a service connection because it does not meet the criteria of a plug (ie. intersecting the from point of a water service). The bottom one was intersecting, so no problems. 5. Yes, NAD 83, 17N 6. Yes, I am 100% sure the snapping is working as expected. If I do not snap that first point to a watermain, I get an error....as expected. This tool will only create the features if the first point has an intersecting watermain. It's more the snapping of the points created by .Clone that seems to be a problem. Thanks again. Let me know if you need anything else from me. I am basically converting an old ArcObjects tool to ArcPro. We've been using it for years and I've never seen any issues like this. The inconsistencies are what is most confusing to me. As in the example above, sometimes it works and sometimes it doesn't....all with the same code.
... View more
09-16-2020
06:24 AM
|
0
|
18
|
3669
|
|
POST
|
This is just a guess, but I'm pretty sure when you bring in a .lyrx file it also brings in any scale references, etc. that were set at the time you created the .lyrx. Do you have anything like that set that would prevent the data from displaying properly?
... View more
09-15-2020
05:44 AM
|
0
|
0
|
1196
|
|
POST
|
Hi Wolfgang, I've attached the package. Those values are coming from a tool that looks at a selected feature water fitting feature and determines what subtype, diameter, etc. it needs to be based on the intersecting feature. In the screen shot below, both of these water service lines were created using my MapTool. The one on the left worked properly, snapping the 'plug' to the endpoint. But in the one on the right, the 'plug' gets converted to a 'service point' because the code determines that it is not snapped to the to point. The two coordinates above come from the code that is looking to make sure the to-point and feature point are the same. I just created a message box to try and figure out what was going wrong. MessageBox.Show(toPoint.X.ToString() + " - " + toPoint.Y.ToString() + "\n" + fittingPoint.X.ToString() + " - " + fittingPoint.Y.ToString());
... View more
09-11-2020
12:09 PM
|
0
|
1
|
3669
|
|
POST
|
Thanks Wolfgang, So would you say that using the geometry of the sketch is not the best way to create a point at the to/from points?? Looking back at my old ArcObjects code, I would capture the Mouse Click points and use those coordinates to create the features at the ends of the line. That never seemed to cause any problems, just more coding for me. I figured doing it this way would be more efficient coding wise (which it is), but if it causes other problems than that is not so good.
... View more
09-11-2020
11:21 AM
|
0
|
3
|
3669
|
|
POST
|
Hi, I've created a MapTool that creates a line and places point features at the to/from point of the line. I use code like this to accomplish this.... I use this to get the sketch geometry to create the from point (connectionPoint) and to point (plugPoint): var pointCollection = ((Multipart)geometry).Points; MapPoint connectionPoint = pointCollection[0]; MapPoint plugPoint = pointCollection[pointCollection.Count - 1]; I then create the plugPoint like this: var plugAttributes = new Dictionary<string, object> { {"SUBTYPECD", 4 }, {"DIAMETER1", 200 }, {"Shape", plugPoint.Clone() } }; editOp.Create(waterFittingsLayer, plugAttributes); Does using plugPoint.Clone create an EXACT clone?? Is there a more preferred way of doing this?? I'm finding that most of the time it does create the point correctly, but then other times the point created is not exactly the same. I cannot figure out why this is happening. Here are some screenshots of the values I am seeing. The first value is the TO point of the line and the second value is the 'cloned' point.
... View more
09-11-2020
09:06 AM
|
0
|
24
|
6654
|
|
POST
|
Ah....your a genius Wolfgang!! I had a layer in the TOC called GISWRKS1.WORKS.Watermain_Breaks that was causing the problem. So, is there a way to look for a layer name with an EXACT match??
... View more
08-21-2020
12:06 PM
|
0
|
2
|
3002
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-14-2026 08:54 AM | |
| 2 | 08-18-2023 08:57 AM | |
| 1 | 04-19-2018 05:53 AM | |
| 1 | 04-13-2018 10:07 AM | |
| 1 | 04-13-2018 10:04 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-14-2026
08:53 AM
|