POST
|
One more follow up. I wanted to change the label to say "3 airports found". That required an escape sequence {}, otherwise the initial curly brace will not compile. <Label x:Name="lblAptCount" Content="{Binding Path=DvAirports.Count}" ContentStringFormat="{}{0} airports found"
ToolTip="Number of airports found near origin airport" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="1.239,5.789" Margin="0,134,0,0" Width="207"/> {}
... View more
08-26-2022
06:11 AM
|
0
|
0
|
2284
|
POST
|
@GKmieliauskas thank you! lord have mercy. I checked several articles and I could have sworn I looked only at Labels. Maybe I need more sleep.
... View more
08-26-2022
05:55 AM
|
0
|
0
|
2285
|
POST
|
Some of these things should be so simple but I end up spending days on it. Really frustrating. I looked up examples on how to set a label to hard coded text and a binding. Something like "Airports found = 3". I tried various ways to do this but all I get is just the number. <Label x:Name="lblAptCount" Content="{Binding Path=DvAirports.Count, StringFormat='Airports found = \{0\}'}"
ToolTip="Number of airports found near origin airport" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="1.239,5.789" Margin="0,134,0,0" Width="207"/> When I use this XAML, the result in the label is just the number like 3. Can anyone point me in the right direction please.
... View more
08-25-2022
03:28 PM
|
0
|
3
|
2344
|
POST
|
Actually I found the possible source of all my problems. I suspect that many other devs might also make this simple mistake. //create the parameter list for the GP
List<object> vals = new List<object>();
vals.Add(lyrProximity); //in_layer: the selection will be applied to this layer
vals.Add("WITHIN_A_DISTANCE_GEODESIC"); //overlap_type: we want features within a geodesic distance
vals.Add(lyrOrigin); //select_features: this is the source
vals.Add(radiusInNm.ToString() + " NAUTICALMILES"); //search_distance: search within xNM of the source
vals.Add("NEW_SELECTION"); //selection_type: new selection
vals.Add("NOT_INVERT"); //invert_spatial_relationship: do not invert selection
//var parameters = Geoprocessing.MakeValueArray(vals); //compiles but does not work
var parameters = Geoprocessing.MakeValueArray(vals.ToArray()); //compiles and works
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("SelectLayerByLocation_management", parameters);
... View more
08-23-2022
04:31 PM
|
0
|
0
|
1338
|
POST
|
Actually I found the possible source of all my problems. I suspect that many other devs might also make this simple mistake. The function MakeValueArray takes as its input a variable number of objects as an array. I thought that if i passed it a List of Objects it would work as well. It does compile so merrily I went along. However, it is reading the List of Objects as a single object. What I needed to do was convert that List of Objects to an Array of objects AND then pass that to the GP tool. Example: //create the parameter list for the GP
List<object> vals = new List<object>();
vals.Add(lyrProximity); //in_layer: the selection will be applied to this layer
vals.Add("WITHIN_A_DISTANCE_GEODESIC"); //overlap_type: we want features within a geodesic distance
vals.Add(lyrOrigin); //select_features: this is the source
vals.Add(radiusInNm.ToString() + " NAUTICALMILES"); //search_distance: search within xNM of the source
vals.Add("NEW_SELECTION"); //selection_type: new selection
vals.Add("NOT_INVERT"); //invert_spatial_relationship: do not invert selection
//var parameters = Geoprocessing.MakeValueArray(vals); //compiles but does not work
var parameters = Geoprocessing.MakeValueArray(vals.ToArray()); //compiles and works
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("SelectLayerByLocation_management", parameters);
... View more
08-23-2022
04:28 PM
|
0
|
0
|
1338
|
POST
|
@GKmieliauskas @CharlesMacleod well that seemed to work. thanks!!! The only thing I did different was change my classes from BasicFeatureLayer to FeatureLayer. I wonder if the GP tools just dont work with the BasicFeatureLayer class.
... View more
08-23-2022
04:13 PM
|
0
|
0
|
1341
|
POST
|
Let me test this. The only difference I see is that I am using BasicFeatureLayer. Not sure why though. I think the example I was following used that class. Now that I look at the differences, the FeatureLayer class has more methods. So let me change to that class and test again.
... View more
08-22-2022
04:15 PM
|
0
|
0
|
1366
|
POST
|
@GKmieliauskas that is exactly what I have in my original post. It doesnt work. I also posted the error.
... View more
08-22-2022
09:04 AM
|
0
|
0
|
1381
|
POST
|
Unfortunately it didn't work. I have been trying for 2 days to get this to work and its a bit disappointing to me that at Pro 3.0 that geometry objects are not supported with geoprocessing. At least the ones I have tested. This is what ended up working for me after numerous tests (why are we still relying on strings when we have classes and objects?): //clear the origin layer of ALL selections
SelectedOriginLayer.ClearSelection();
//select ONLY the origin feature in the origin layer
var qf = new QueryFilter();
qf.WhereClause = "FID=1";
Selection selOrigin = SelectedOriginLayer.Select(qf, SelectionCombinationMethod.New);
//clear the proximity layer of ALL selections
SelectedProximityLayer.ClearSelection();
//gp
List<string> vals= new List<string>();
vals.Add(SelectedProximityLayer.URI); //in_layer: the selection will be applied to this layer
vals.Add("WITHIN_A_DISTANCE_GEODESIC"); //overlap_type: we want features within a geodesic distance
vals.Add(SelectedOriginLayer.URI); //select_features: this is the source (the original)
vals.Add("100 NAUTICALMILES"); //search_distance: search within 100 NM of the source
vals.Add("NEW_SELECTION"); //selection_type: new selection
vals.Add("NOT_INVERT"); //invert_spatial_relationship: do not invert selection
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("SelectLayerByLocation_management", vals);
... View more
08-21-2022
03:37 PM
|
0
|
2
|
1414
|
POST
|
After looking at the documentation and my prior work with ArcMap I see where I erred. The parameter Selecting Features is defined as a Feature Layer and I was trying to pass it a Feature object. All I had to do was select my feature in the layer and pass it the layer like so: //clear the origin layer of ALL selections
SelectedOriginLayer.ClearSelection();
//select ONLY the origin feature in the origin layer
var qf = new QueryFilter();
qf.WhereClause = "FID=1";
Selection selOrigin = SelectedOriginLayer.Select(qf, SelectionCombinationMethod.New);
//clear the proximity layer of ALL selections
SelectedProximityLayer.ClearSelection();
//gp
List<object> values = new List<object>();
values.Add(SelectedProximityLayer); //in_layer: the selection will be applied to this layer
values.Add("WITHIN_A_DISTANCE_GEODESIC"); //overlap_type: we want features within a geodesic distance
values.Add(SelectedOriginLayer); //select_features: this is the source (the original)
values.Add("100 NAUTICALMILES"); //search_distance: search within 100 NM of the source
values.Add("NEW_SELECTION"); //selection_type: new selection
values.Add("NOT_INVERT"); //invert_spatial_relationship: do not invert selection
var parameters = Geoprocessing.MakeValueArray(values);
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("SelectLayerByLocation_management", parameters);
... View more
08-21-2022
11:38 AM
|
0
|
3
|
1418
|
POST
|
With Pro 3.0 I am trying to implement the SelectLayerByLocation geoprocessing tool. I have objects/classes that I want to pass in to the tool. I've looked at the community samples and the ESRI forums and I must be missing something because this throws an exception System.InvalidOperationException HResult=0x80131509 Message=convert unsupported type Source=ArcGIS.Desktop.GeoProcessing object[] listOfParameter = { SelectedProximityLayer, "WITHIN_A_DISTANCE_GEODESIC", featOrigin, "100 NAUTICALMILES", "NEW_SELECTION", "NOT_INVERT" };
var parameters = Geoprocessing.MakeValueArray(listOfParameter); //exception here
var gpResult = await Geoprocessing.ExecuteToolAsync("SelectLayerByLocation_management", parameters); With ArcMap you could call out a native .NET API to do this and I can't find anything similar with Pro: Dim selLyrLoc As New SelectLayerByLocation
selLyrLoc.in_layer = pPointProxLayer 'the selection will be applied to this layer
selLyrLoc.overlap_type = "WITHIN_A_DISTANCE_GEODESIC" 'we want features within a geodesic distance
selLyrLoc.select_features = pFeatSelOrigin 'this is the source feature
selLyrLoc.search_distance = "100 NAUTICALMILES" 'search within 100 NM of the source
selLyrLoc.selection_type = "NEW_SELECTION" 'new selection
selLyrLoc.invert_spatial_relationship = "NOT_INVERT" 'do not invert selection
'run the geoprocessor
Dim res As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult = CType(GP.Execute(selLyrLoc, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult) I see that the parameter list is a string list but how do I feed my objects /classes to any geoprocessing tool?
... View more
08-20-2022
03:58 PM
|
0
|
9
|
1460
|
IDEA
|
As detailed in this post: https://community.esri.com/t5/arcgis-pro-sdk-questions/light-dark-logo-image-in-prowindow/m-p/1197457 I added a ProWindow to my project and the ViewModel class was not added. DockPanes and PropertySheets get the ViewModel class added automatically. Is this by design? If not, I think It would be helpful if it was added in an update.
... View more
08-17-2022
11:17 AM
|
1
|
2
|
765
|
POST
|
Woot!!! I got it to work. Two things that were messing me up: 1. The missing ViewModel which is not created by the VS extension. I had to create my own ViewModel class and then reference that in the ShowProWindow class. 2. The path to the image. I was under the impression that I needed to provide the namespace of the project in the path. That didn't work so I tried just the name of the project and that worked. //"pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png"
url = @"pack://application:,,,/MyProject;component/Images/logo.png";
... View more
07-29-2022
07:20 AM
|
0
|
0
|
1988
|
POST
|
@UmaHarano thank you very much for the sample. One thing I did notice was that when I add a ProWindow through the VS 2022 Extension I do not get a ViewModel. Since I'm kind of newish to WPF I just thought it wasnt needed. DockPanes and PropertySheets get the ViewModel class added automatically. Is this by design?
... View more
07-29-2022
06:23 AM
|
0
|
1
|
1988
|
Title | Kudos | Posted |
---|---|---|
1 | 04-25-2020 09:25 PM | |
1 | 08-17-2022 11:17 AM | |
1 | 07-24-2022 01:36 PM | |
1 | 07-14-2022 11:22 AM | |
1 | 07-14-2022 10:29 AM |
Online Status |
Offline
|
Date Last Visited |
10-03-2022
04:04 PM
|