|
POST
|
Hi, I have the BackStage_PropertyPage sample compiled and running in ArcPro. In that sample, there is a checkbox called 'GeneralSetting' that resides in "Options - Application - Sample App Settings". I am trying to access the value of that checkbox through a completely different tool. How do I do that?? Thanks,
... View more
06-22-2018
11:11 AM
|
0
|
3
|
977
|
|
POST
|
Yes, no worries. In my case, I'm not really locating any of the attributes in the joined XLS. I'm just trying to Locate one of the feature class attributes after creating the join. Now the Locate pane won't even let me do that. The only way I can do a locate on the feature class with a join, is to remove the join. This is with a join to XLS. Perhaps a join to a Table in a PGDB is different, as Shana suggest above.
... View more
06-21-2018
07:53 AM
|
0
|
4
|
1194
|
|
POST
|
Hi Robert LeClair. Have you read the rest of this chain?? The problem isn't working the Locate pane. The problem is that layers with joins on them are now not showing up in the Locate pane since the latest update to 2.1.3. Previously a joined layer could be added, and all of the 'settings' adjusted, but using the 'Locate' function of the locate pane didn't actually work....at least with an SDE Feature class joined to an .XLS. Now (since I updated to 2.1.3) this same joined layer isn't even showing in the Locate pane. The 'Add Layer' button will not allow you to add it.
... View more
06-21-2018
07:43 AM
|
0
|
6
|
1194
|
|
POST
|
Hi Shana Britt Sorry for the delay getting back to you. I have just done some more testing and for some reason everything is working now. Jaywin Cl and Jaywin Circle are both being found with the locator. Of course, I think my locator has been modified somewhat since the one we started looking at when I first created this post. Perhaps even the latest ArcPro update has made an impact?? Anyways, I do have it working now. I'll test things a bit more and see if I can tweak it based on your suggestions. Thanks!!
... View more
06-21-2018
06:34 AM
|
0
|
0
|
816
|
|
POST
|
Robert LeClair I am trying to locate attributes that are in the SDE Feature class, not features in the joined .XLS file.
... View more
06-21-2018
06:25 AM
|
0
|
8
|
1942
|
|
POST
|
Shana Britt So, I am trying to replicate but have noticed that now (or at least since the update to 2.1.3) things are different. The Locate pane will not even let me add a layer that has a join on it to the Locate. Under 'Settings' I select 'Add Layer' and then choose the layer with the join to add, and nothing happens. Also, prior to creating the join that layer was showing in the Locate, and after adding the join the system must have removed it. So, what does this mean?? ArcPro does not support joined layers?? The join I was using was and SDE Feature class joined to an .XLS sheet.
... View more
06-21-2018
06:24 AM
|
0
|
1
|
1942
|
|
POST
|
OK, I think I have figured it out. I have moved my var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); to before the foreach loop, and now all is working as expected. I'm still not really sure why it worked in debug mode before, but it seems to be working now in real-time and debug mode now. Thanks!!
... View more
06-15-2018
06:44 AM
|
0
|
0
|
924
|
|
POST
|
Hi, I have some code I'm trying to troubleshoot. It does some editing of attributes to a point and the intersecting line feature. A user can select multiple points, and then click the tool to run the code on each selected point. I get no error messages, but the results are not as expected when selecting more than one feature. The weird thing is that if I step through the code, line by line, everything works fine. The only time I have problems is when running the code in real-time. For some reason, only the first feature selected gets updated, and all the other features keep their original attributes. I will post the code below, but here is the main logic behind it: 1. select one or more hydrant features and click on the tool 2. the tool work through each selected hydrant one at a time 3. it finds the intersecting water service connected to the hydrant and updates the SUBTYPE attribute of the water service 4. it then finds the intersecting water main of the water service, and updates the WATERMAINSIZE and WATERMAINID on the hydrant feature 5. goes to the next selected hydrant and repeats steps 2 through 4 If anyone has any ideas as to why this code will not work in real-time, please let me know. Thanks! internal class FittingsButton : Button
{
public string GetIntersectingFeature(MapPoint point, FeatureLayer intersectLayer, string fieldName)
{
try
{
//ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(point.X.ToString() + " : " + point.Y.ToString());
//Create a Spatial Query using the supplied point, layer and fieldname
SpatialQueryFilter spatialFilter = new SpatialQueryFilter();
spatialFilter.FilterGeometry = point;
spatialFilter.SpatialRelationship = SpatialRelationship.Intersects;
spatialFilter.SubFields = fieldName;
//Gets the intersecting feature
string fieldValue = null;
RowCursor featureCursor = intersectLayer.Search(spatialFilter);
Feature feature;
//Gets the value using the fieldName
while (featureCursor.MoveNext())
{
using (feature = (Feature)featureCursor.Current)
{
int fieldPosition = feature.FindField(fieldName);
if (feature[fieldPosition] != null)
fieldValue = feature[fieldPosition].ToString();
else
fieldValue = null;
}
}
return fieldValue;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("An error occured while finding the intersecting feature." + "\n" + "\n" + ex.ToString(), "GetIntersecingFeature", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
return null;
}
}
protected async override void OnClick()
{
try
{
await QueuedTask.Run(() =>
{
//Start the edit operation, and place on the UNDO stack
var editOperation = new ArcGIS.Desktop.Editing.EditOperation();
editOperation.Name = "Update Fittings Diameters on Selected Features";
editOperation.EditOperationType = ArcGIS.Desktop.Editing.EditOperationType.Long;
Map map = MapView.Active.Map;
FeatureLayer waterMainLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WaterMain").FirstOrDefault();
FeatureLayer waterServiceLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WaterService").FirstOrDefault();
FeatureLayer hydrantLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WAT_Hydrant").FirstOrDefault();
FeatureLayer controlValveLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WAT_ControlValve").FirstOrDefault();
FeatureLayer waterFittingsLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WAT_Fitting").FirstOrDefault();
FeatureLayer reliefValveLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WAT_ReliefValve").FirstOrDefault();
FeatureLayer pressureZoneLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.WAT_PressureZone").FirstOrDefault();
#region Check for hydrants; Update the
if (hydrantLayer != null)
{
if (hydrantLayer.SelectionCount > 0)
{
var hydrantSelection = hydrantLayer.GetSelection();
IReadOnlyList<long> selectedOIDs = hydrantSelection.GetObjectIDs();
foreach(var oid in selectedOIDs)
{
var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
insp.Load(hydrantLayer, oid);
var thePoint = insp.Shape;
MapPoint hydrantPoint = (MapPoint)insp.Shape;
//Update the subtype of the water service to 2 - HydrantLateral
var wsInspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
wsInspector.Load(waterServiceLayer, Convert.ToInt64(GetIntersectingFeature(hydrantPoint, waterServiceLayer, "OBJECTID")));
wsInspector["SubTypeCD"] = 2;
editOperation.Modify(wsInspector);
//Now get the watermain that intersect the From point of the HydrantLateral.
//Get the To and From point of the currently selected HydrantLateral
var pointCollection = ((Multipart)wsInspector.Shape).Points;
MapPoint fromPoint = pointCollection[0];
MapPoint toPoint = pointCollection[pointCollection.Count - 1];
string watermainID = GetIntersectingFeature(fromPoint, waterMainLayer, "OBJECTID");
//The HydrantLateral could be digitized backwards, so use the toPoint if the fromPoint returns NULL
if (watermainID == null)
watermainID = GetIntersectingFeature(toPoint, waterMainLayer, "OBJECTID");
if (watermainID != null)
{
var wmInspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
wmInspector.Load(waterMainLayer, Convert.ToInt64(watermainID));
insp["WaterMainSize"] = wmInspector["Diameter"];
insp["WATERMAINID"] = wmInspector["FACILITYID"];
}
editOperation.Modify(insp);
}
}
}
#endregion
#region Check for Control Valves
#endregion
editOperation.Execute();
});
}
catch
{
}
finally
{
}
}
}
... View more
06-15-2018
05:43 AM
|
0
|
1
|
992
|
|
POST
|
Thanks Charles Macleod and Sean Jones As I'm really just a part-time coder I had no idea that this was connected to LINQ, so I wasn't really sure where to start looking for answers. I will definitely investigate LINQ now that I know. I've really just been using the method Sean talks about when he mentions my 'related question', but now that I know how to structure the command and what the l => l == l is all about, I can definitely make some changes to how I do things. This is what I ended up with in the end: FeatureLayer sanForceMainLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "GISWRKS1.WORKS.ForceMain").FirstOrDefault(); Thanks!!
... View more
06-13-2018
11:29 AM
|
0
|
0
|
947
|
|
POST
|
Hi, When using the following code to find a specific layer in my map, I am finding that if a similarly named layer exists first in the TOC, then the FeatureLayer object gets set to it. FeatureLayer sanForceMainLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name.IndexOf("GISWRKS1.WORKS.ForceMain", StringComparison.CurrentCultureIgnoreCase) >= 0).FirstOrDefault(); For example, if I have a TOC like this: layer1 layer2 GISWRKS1.WORKS.ForceMain_removals layer4 layer5 GISWRKS1.WORKS.ForceMain layer7 In this case, sanForceMainLayer is getting set to 'GISWRKS1.WORKS.ForceMain_removals'. I am expecting it to match exactly to 'GISWRKS1.WORKS.ForceMain'. Thanks,
... View more
06-12-2018
01:43 PM
|
0
|
3
|
1032
|
|
POST
|
Hi Dan, No, I did not make the join permanent. That isn't really the most ideal solution. The way I see it, I should still be able to use the Locate tool on a layer with or without a Join. In ArcMap the 'Find' tool will work even with a Join. Is this perhaps a 'bug' or a feature that needs to be added??
... View more
05-22-2018
12:03 PM
|
0
|
4
|
1942
|
|
POST
|
Hi, I am trying to add a layer in my Map to the Locate tool, but after I click on 'OK' nothing really happens. No error message, but also it does not show up in the Locate pane. I have a join on the layer I am trying to add. Could this be the reason it is not working??
... View more
05-16-2018
08:26 AM
|
0
|
17
|
3317
|
|
POST
|
Actually, my bad. It IS working. The Index seems to have fixed it. Operator error on the last round of testing! 🙂 Thanks for your help.
... View more
04-19-2018
06:15 AM
|
0
|
0
|
801
|
|
POST
|
Hi Jake Skinner, The Index was put on the feature class but the Locate is still not finding features. If I scroll down the attribute table till it says 'Scanning', then do a 'Locate' for the indexed attribute, the value is still not found. Any other ideas??
... View more
04-19-2018
05:53 AM
|
1
|
2
|
4604
|
|
POST
|
Hi Shana Britt, Thanks for the information. Currently I am experimenting with both US Address - Single House as well as Single House Subaddress. With our Civic Number, we sometimes have a Civic Number Suffix. So there could be a 234 Mackenzie Ave as well as a 234A Mackenzie Ave. Is there a field-mapping in the Single House Subaddress I can use for this?? Currently neither of the styles mentioned above are catching these addresses with a suffix on the Civic Number. Also, when using the Subaddress style locator you mentioned to map ROAD_FULL to StreetName, but in the Subaddress mapping there is a FullStreetName mapping so I have done it there. Should I switch it to map to StreetName?? Thanks,
... View more
04-18-2018
05:27 AM
|
0
|
2
|
816
|
| Title | Kudos | Posted |
|---|---|---|
| 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 | |
| 1 | 04-13-2018 05:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-20-2025
03:53 PM
|