Creating Point at end of line

2838
24
09-11-2020 09:06 AM
BrianBulla
Occasional Contributor III

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.

0 Kudos
24 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I think SQL backend could possibly be an issue, because internally the geometry data is stored in a different format from a file geodatabase (where it works).  If you tell me what database you are using, I will try it here and see if I can duplicate the issue.

0 Kudos
BrianBulla
Occasional Contributor III

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.  🙂

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Brian Bulla‌,

 I will try your environment today.  If i can't duplicate the problem with that setup, I will send you a test program with code that serializes the 'sketch' geometry to a file.  This way i should be able to use your sketch to duplicate the issue.

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Brian Bulla

 I setup and tested the SQL Server enterprise geodatabase configuration and was not able to duplicate your issue.  I even used your projection to no avail.  So i made a new test add-in (GeoNet259853-v2.zip) for you that 'captures' and saves the geometries that are causing the issue.  Please use the test add-in with your data (i think all layer names should be the same as on your map).  Follow these steps:

  1. Build the new test add-in
  2. Open Pro with your water service map.
  3. Make sure that the "selection settings" are only checked for WaterService and Fitting:
  4. From the add-in tab use the "Create Service Connection" tool to create a service connection

  5. Once you create a service connection you can then click the 'Rectangle' button and select the 'end point' of the newly created service connection

  6. Once the end point (and the service line) are selected, you then click 'Selection Coincidence' to check for the error.  

  7. Once you duplicate the 'coincident: false' error, click the "Export Geometry" button to save the "serialized geometries" in a json file.  
  8. Send me the json file so that i can take a look at the geometries myself.

 

I hope we'll get a duplicatable case from this.

 

0 Kudos
BrianBulla
Occasional Contributor III

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.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Thanks Brian Bulla‌,

 I am not able to duplicate the problem even with your geometry (that I loaded into the same app i sent you).  I am using 2.6.0 (not patched), what version of Pro are you using?  I also don't see the additional digits for the coordinates you are seeing.  What version of Visual Studio are you using?

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Brian Bulla‌,

 Not sure if you seen my previous reply,,,  I am using 2.6.0 (not patched), what version of Pro are you using?  I also don't see the additional digits for the coordinates you are seeing in the MessageBox (see previous reply).  What version of Visual Studio are you using?  If I can't duplicate this issue we'll give it to support.  

0 Kudos
BrianBulla
Occasional Contributor III

Hi Wolfgang Kaiser‌,

I am using ArcGIS Pro 2.6.1 and VS 2015.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Brian Bulla,

 I tried Pro 2.6.1 to no avail, I am not able to duplicate the issue.  I also talked it over with some colleagues and we concluded that at this point the issue must be with the data and/or SDE compatibility.  I think that at this time it's best to have Esri support investigate this issue since they are better suited to look at the SDE and database aspects of your system.

0 Kudos
BrianBulla
Occasional Contributor III

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!

0 Kudos