|
POST
|
I was not aware of that term. I think I can figure this out somehow. Thanks for your all help.
... View more
10-20-2022
06:48 AM
|
0
|
0
|
2395
|
|
POST
|
I got that it is commercial software but I don't understand why you wouldn't give its name. Thanks anyway I will check online if I can find something for our needs.
... View more
10-19-2022
12:14 PM
|
0
|
2
|
2402
|
|
POST
|
@GKmieliauskas Do you mind sharing the software name and how it works? I was thinking of creating a list of alphanumeric strings and read/mark those from a live Google doc or something but your way is more robust, easier and less time consuming
... View more
10-19-2022
05:32 AM
|
0
|
4
|
2419
|
|
POST
|
@KirkKuykendall1 I think we use active directory and, this solution would be really nice. It has some advantages as well. However, I don't get along with IT guys. I will have less control, have to wait, get questioned etc.. so, I went by @GKmieliauskas solution. I appreciate it anyway.
... View more
10-18-2022
06:31 PM
|
0
|
0
|
673
|
|
POST
|
@GKmieliauskas Thanks for the solution! I was able to apply the sample code to my add-in but now facing two problems. One, I need to provide unique product id for each user and that can not be used more than once. Two, I would like to implement an expiration date for the add-in. Do you know if there is an easy way to do these?
... View more
10-18-2022
06:27 PM
|
0
|
6
|
2426
|
|
POST
|
@CharlesMacleod Never mind, I figured it out. QueuedTask.Run(() =>
{
LayerDocument lyrDocFromLyrxFile = new LayerDocument(layerPath);
var jsonfile = lyrDocFromLyrxFile.AsJson();
dynamic array = JsonConvert.DeserializeObject(jsonfile);
string nl = "\r\n";
var geometry = "Geometry : " + array.layerDefinitions[0].featureTemplates[0].tags.ToString() + nl;
var descriptionAll = array.binaryReferences[0].data.ToString();
var fufu = array.binaryReferences[0].uRI.ToString();
XmlDocument xmltest = new XmlDocument();
xmltest.LoadXml(descriptionAll);
string creationDate;
XmlNodeList xmlNodeListCreationDate = xmltest.GetElementsByTagName("CreaDate");
if (xmlNodeListCreationDate.Count > 0)
creationDate = "Creation Date : " + xmlNodeListCreationDate[0].InnerXml + nl;
else
creationDate = "Creation Date : No info" + nl;
string projection;
XmlNodeList xmlNodeListProjection = xmltest.GetElementsByTagName("projcsn");
if(xmlNodeListProjection.Count > 0)
projection = "Projection : " + xmlNodeListProjection[0].InnerXml + nl;
else
projection = "Projection : No info" + nl;
string tags;
XmlNodeList xmlNodeListTags = xmltest.GetElementsByTagName("keyword");
if (xmlNodeListTags.Count > 0)
tags = "Tags : " + xmlNodeListTags[0].InnerXml + nl;
else
tags = "Tags : No info" + nl;
string description;
XmlNodeList xmlNodeListDescription = xmltest.GetElementsByTagName("idAbs");
if (xmlNodeListDescription.Count > 0)
description = "Description : " + xmlNodeListDescription[0].InnerXml + nl;
else
description = "Description : No info" + nl;
string credit;
XmlNodeList xmlNodeListCredit = xmltest.GetElementsByTagName("idCredit");
if (xmlNodeListCredit.Count > 0)
credit = "Credit : " + xmlNodeListCredit[0].InnerXml + nl;
else
credit = "Credit : No info" + nl;
string limitation;
XmlNodeList xmlNodeListLimitation = xmltest.GetElementsByTagName("useLimit");
if (xmlNodeListCredit.Count > 0)
limitation = "Use Limitations: " + xmlNodeListLimitation[0].InnerXml + nl;
else
limitation = "Use Limitations : No info" + nl;
DescriptionTextBoxText = geometry + creationDate + projection + tags + description + credit + limitation;
});
... View more
10-17-2022
11:50 AM
|
0
|
0
|
3143
|
|
POST
|
@CharlesMacleod I am using one of the .lyrx files to get the info from the layer document. I was able to get geometry type by using JsonConvert.DeserializeObject(jsonfile) but some of the info looks like in XML format QueuedTask.Run(() =>
{
LayerDocument lyrDocFromLyrxFile = new LayerDocument(layerPath);
var jsonfile = lyrDocFromLyrxFile.AsJson();
dynamic array = JsonConvert.DeserializeObject(jsonfile);
string nl = "\r\n";
var geometry = "Geometry: " + array.layerDefinitions[0].featureTemplates[0].tags.ToString() + nl;
var description = "Description: " + array.binaryReferences[0].data + nl; //This is in XML how can I read child nodes and convert to string
DescriptionTextBoxText = geometry + date.ToString();
}); //Is there way to get child nodes in string?
... View more
10-17-2022
06:33 AM
|
0
|
0
|
3153
|
|
POST
|
@CharlesMacleod Thanks for the inquisition, yes unfortunately I dont have lyrx option at the moment. I will see if I can solve this in another way. I will share it here if I do.
... View more
10-07-2022
10:47 AM
|
0
|
0
|
3209
|
|
POST
|
@CharlesMacleod Thanks for the reply. I was able to use this for .lyrx extension but it does not work for the .lyr. All my files are .lyr files. for the .lyr extension layer files I get this Do you know if there is a solution for this? I will mark your answer as a solution anyway since it gives a solution to my question.
... View more
10-06-2022
09:31 AM
|
0
|
0
|
3235
|
|
POST
|
I would like to get layers' description/properties without adding/creating the layer. Is it possible to get the all the info directly from the layer file (.lyr or .lyrx) in ArcGIS Pro SDK. It is fairly simple in ArcPy but I don't wanna switch between ArcPy and the SDK. When I open a layer file I get something like this
... View more
10-05-2022
08:13 AM
|
0
|
6
|
3314
|
|
POST
|
@Wolf I looped and selected all items and it works fine. If that does not work somewhere I will try IsVirtualizing= false method. Thanks!
... View more
07-20-2022
08:51 AM
|
1
|
0
|
6084
|
|
POST
|
Finally, I found the problem. I was making the selection (ListBox.SelectAll()) in the code-behind. I didnt know it was going to be problem. The issue was gone. As soon as I carried that into the view-model. @Wolf I appreciate your help anyway. Somehow, my problems are gone as soon as you post an answer to my questions 😄
... View more
07-20-2022
08:33 AM
|
0
|
0
|
6088
|
|
POST
|
@Wolf Thanks for the reply but checkbox for each item is not a good option for me. It gets more space and users need to check them all. Here is the UI: Users select the layers (strings at this point) from the highlighted listbox and click a button. All selected layers found in a string array dictionary and created and add to the TOC. In some cases, there are more than 40 layers. So, I created a button which selects the all layers in the listbox. It looks like all layers selected in the UI. However, when I put them in the loop to check their IsSelected property. It says only 12 of them selected. If I play with the scroll it shows more selected. I even tried auto scroll end of the listbox but still not all selected. I hope it is more clear now. It is a weird problem ad difficult to explain too
... View more
07-20-2022
08:17 AM
|
0
|
0
|
6092
|
|
POST
|
I am trying to read selected items in a Listbox if selected, and a layer is created. I would like to do it with MVVM. My code does not work properly. It selects no more than 11 items, yet creates 12 layers out of it. I am puzzled. I would appreciate any help. I am using 3.0 but I get the same result with 2.9 UPDATE: I just noticed even though all items selected in the list box. They are not detected unless the scroll is all the way down. Selected items are detected according to the scroll position. I don't know why it acts like that. XAML: <ListBox x:Name="DataListBox" SelectionMode="Extended" HorizontalAlignment="Left" Margin="5,5,0,0" Grid.Row="1" Grid.Column="0" Grid.RowSpan="8"
VerticalAlignment="Top" Height="200" Width="200"
ItemsSource="{Binding DataListBoxItemsSource, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding DataListBoxSelectedItem, UpdateSourceTrigger=PropertyChanged}"
>
<ListBox.InputBindings>
<KeyBinding Command="ApplicationCommands.SelectAll" Modifiers="Ctrl" Key="A" />
</ListBox.InputBindings>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
</Style>
</ListBox.ItemContainerStyle>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged" >
<i:CallMethodAction TargetObject="{Binding}" MethodName="DataListBox_SelectionChanged"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox> View Model public async void CreateLayersTOC()
{
if (MapView.Active != null)
{
if (DataListBoxSelectedItem != null || FavoriteTabsSelectedItem != null)
MainStackPanelIsEnabled = false;
LayerNames = new List<string>();
await Task.Run(() =>
{
MessageBox.Show("source count " +DataListBoxItemsSource.Count); //78 and All items selected in the UI
if (DataListBoxSelectedItem != null)
foreach (ItemPresenter itemP in DataListBoxItemsSource)
{
if (itemP.IsSelected)
{
if (LayerNames.Contains(itemP.ToString()) == false)
LayerNames.Add(itemP.ToString());
}
}
if (FavoriteTabsSelectedItem != null)
{
foreach (ItemPresenter itemP in FavListBoxItemsSource)
{
if (itemP.IsSelected)
{
if (LayerNames.Contains(itemP.ToString()) == false)
LayerNames.Add(itemP.ToString());
}
}
}
MessageBox.Show("Coll" + LayerNames.Count); // Only 11 ??
});
foreach (KeyValuePair<string, List<string>> kvp in LayerDict)
{
if (LayerNames.Contains(kvp.Value[2]))
{
await QueuedTask.Run(() =>
{
Uri layerURI = new Uri(System.IO.Path.Combine(kvp.Value[4], kvp.Value[5] + ".lyr"));
MapView mapView = MapView.Active;
Map activeMap = mapView.Map;
Layer mapLayer = LayerFactory.Instance.CreateLayer(layerURI, activeMap, 0, kvp.Value[2]);
//MainStackPanelIsEnabled = true;
});
}
//LayerNames.Remove(kvp.Value[2]);
}
}
else
MessageBox.Show("Make sure to have a map available before adding layers to a map");
MainStackPanelIsEnabled = true;
} public class ItemPresenter : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private readonly string _value;
public ItemPresenter(string value)
{
_value = value;
}
public override string ToString()
{
return _value;
}
private bool _isSelected;
public bool IsSelected
{
get { return _isSelected; }
set
{
if (_isSelected != value)
{
_isSelected = value;
OnPropertyChanged();
}
}
}
}
... View more
07-19-2022
08:51 AM
|
0
|
5
|
6182
|
|
POST
|
@Wolf I just realized I didn't do Pro Migrate Solution. After the migration 2->3 it works fine. I am sorry! I should have paid more attention. Knowing there is no problem pushed me find my own mistake. Thank you for your support, I appreciate that.
... View more
07-11-2022
07:41 AM
|
0
|
0
|
1388
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-23-2021 02:29 PM | |
| 1 | 09-25-2024 03:31 PM | |
| 1 | 02-26-2024 06:48 AM | |
| 1 | 02-11-2020 02:18 PM | |
| 1 | 07-20-2022 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|