|
POST
|
I was over complicating but @Wolf helped me find the right solution with map control. public void CreateInsetMap()
{
QueuedTask.Run(() =>
{
var newProject = Project.Current;
if (newProject != null)
{
kymap = MapFactory.Instance.CreateMap("Kentucky", MapType.Map, MapViewingMode.Map, Basemap.Hybrid);
//map = MapView.Active.Map
var spatialRef = SpatialReferenceBuilder.CreateSpatialReference(4269);
var env = EnvelopeBuilder.CreateEnvelope(3798937, 3348809, 6018368, 4307216, spatialRef);
kymap.SetCustomFullExtent(env);
//Define 2D Extent that should be displayed inside the mapcontrol.
this.Dispatcher.Invoke(() =>
{
LayersMapControl.ViewContent = MapControlContentFactory.Create(kymap, env, kymap.DefaultViewingMode);
});
return;
}
});
} This is not a proper MVVM way but I will fix it later. Result:
... View more
11-16-2020
08:36 AM
|
0
|
0
|
2195
|
|
POST
|
I am able to access properties of an XAML control items directly. For instance, changing a header of a tab in a Dockpane XAML (View):
<TabControl x:Name="FavoritesTabs" HorizontalAlignment="Stretch" Height="23" Initialized="FavoritesTabs_Initialized" Margin="8,0,7,0" >
<TabItem x:Name="Tab1" Height="20" Width="75"> </TabItem>
<TabItem x:Name="Tab2" Height="20" Width="75"></TabItem>
</TabControl>
C# (Model):
private void FavoritesTabs_Initialized(object sender, EventArgs e)
{
Tab1.Header = "MyFavoriteTab";
}
However, I know it this is not right/proper way and I would like to use MVVM. I would like to bind tab Headers to Model by using MVVM. How can I achieve that? I think XAML would be XAML:
<TabControl x:Name="FavoritesTabs" HorizontalAlignment="Stretch" Height="23" Initialized="FavoritesTabs_Initialized" Margin="8,0,7,0" >
<TabItem x:Name="Tab1" Header="{Binding MyFavorite1}" Height="20" Width="75"> </TabItem>
<TabItem x:Name="Tab2" Header="{Binding MyFavorite2}" Height="20" Width="75"></TabItem>
</TabControl>
What else I should add Dockpane1ViewModel.cs (View Model) and Dockpane1.xaml.cs (Model)?
... View more
11-09-2020
05:50 PM
|
0
|
10
|
7165
|
|
POST
|
Sorry for the insufficient information on my question. I was just trying to show what I have tried which caused to a confusion. Also, I thought your mapcontrol is a module itself rather than something I can place inside a dockpane. I am creating a dockpane which helps users to filter/find the data easily as we have too many different spatial data. I would like to display an inset map along with the full zoomed selected layer. So, users are able to see the data visually without moving the layer to TOC. I started working on the creating the map as initial step. I have modified your code but still map is not showing up. Do you have any idea what I am doing wrong?
XAML:
xmlns:controls1="clr-namespace:ArcGIS.Desktop.Mapping.Controls;assembly=ArcGIS.Desktop.Mapping"
.
.
.
<TextBlock Text="{Binding ActiveMap}" Margin="0,10"></TextBlock>
<!--The MapControl -->
<controls1:MapControl Name="MapControl" HorizontalAlignment="Right" Height="150" Margin="0,0,7,0" Width="273" >
</controls1:MapControl>
C#:
private readonly MapControl _mapControl = null;
public Dockpane1View()
{
InitializeComponent();
_mapControl = this.MapControl; //Link _mapControl variable to this map control
CreateInsetMap();
}
public void CreateInsetMap()
{
QueuedTask.Run(() =>
{
var newProject = Project.Current;
if (newProject != null)
{
var map = MapFactory.Instance.CreateMap("Kentucky", MapType.Map, MapViewingMode.Map, Basemap.Hybrid);
map = MapView.Active.Map;
if (MapView.Active == null)
return;
if (MapView.Active.Extent == null)
return;
var spatialRef = SpatialReferenceBuilder.CreateSpatialReference(4269);
var env = EnvelopeBuilder.CreateEnvelope(3798937, 3348809, 6018368, 4307216, spatialRef);
map.SetCustomFullExtent(env);
//Define 2D Extent that should be displayed inside the mapcontrol.
_mapControl.ViewContent = MapControlContentFactory.Create(map, env, map.DefaultViewingMode)
return;
}
});
}
... View more
11-06-2020
08:26 AM
|
0
|
1
|
2230
|
|
POST
|
Is there a specific reason you want to close it with a cancel button? It comes with a closing control already.
... View more
11-05-2020
07:50 PM
|
0
|
0
|
1214
|
|
POST
|
This is not what I am looking for but good to know this exists and might be able to use for another application. I need a simple inset map displays inside a dock pane. Thank you for your answer.
... View more
11-05-2020
06:34 PM
|
0
|
3
|
2230
|
|
POST
|
I created a frame inside of a dockpane and created the map but I could not figure out how to place the map inside the frame I created. XAML:
<Frame x:Name="InsetMapFrame" HorizontalAlignment="Left" Margin="5,5,0,0"
VerticalAlignment="Top" Height="100" Width="278"/>
C#:
public void AddMap2()
{
QueuedTask.Run(() =>
{
var newProject = Project.Current;
if (newProject != null)
{
var map = MapFactory.Instance.CreateMap("Kentucky", MapType.Map,
MapViewingMode.Map, Basemap.Hybrid);
System.Uri uri = new System.Uri(map.URI);
InsetMapFrame.Source = uri;
}
});
}
... View more
11-05-2020
10:10 AM
|
0
|
5
|
2366
|
|
POST
|
Thanks a lot @David-Pike, I copied and pasted the wrong lines. duh! exactly, where is stopOperation() and stopEditing(True) I did not even notice I did not stop editing. That was the problem.
... View more
11-01-2020
07:28 AM
|
1
|
0
|
1866
|
|
POST
|
@Joe-Borgione Thank you for your answer. I have DBO and Admin credentials I am the one who run the scripts. I use the Admin connection on the data will be updated. database = r'\\nrdsmnt6\mine maps\DMP_Database\ShapefileProcessing_SupportFiles\Connection_DMP_Admin.sde' Should I do something else? I can not use append tool here because there are read locks and I am unable to remove locks to switch "unregister as versioned".
... View more
11-01-2020
07:05 AM
|
0
|
0
|
1866
|
|
POST
|
from vrbls import *
arcpy.env.workspace = database
workspace = arcpy.env.workspace
arcpy.env.overwriteOutput = True
edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)
edit.startOperation()
insert_cursor = arcpy.da.InsertCursor(perm_bound, ["PermitNo", "FeatCLS", "Contact", "Source",
"National_ID", "Type_Flag", "Calc_Acres", 'SHAPE@'])
with arcpy.da.SearchCursor(perm_bound_file_geodb, ["PermitNo", "FeatCLS", "Contact", "Source", "National_ID",
"Type_Flag", "Calc_Acres", 'SHAPE@']) as cursor:
for row in cursor:
insert_cursor.insertRow(row)
print('row inserted')
del cursor
del insert_cursor
edit.startEditing(False, True)
edit.startOperation() I do not have any problem using this code in a file geodatabase and it works fine. It does not work inside an enterprise geodatabase and does not insert any rows yet I do not get any error and it exits with zero code.
... View more
11-01-2020
06:34 AM
|
0
|
4
|
2004
|
|
POST
|
The major problem was assignment of the collection right after initialization and assigning again when it is updated. One assignment was enough as far as it is Observable Collection. SearchLayersBox.SuggestionSource = SearchSuggestCollection; Then I also add a requirement to enter 3 characters before firing up the autosuggestions. However, this is not proper MVVM model. If somebody can explain a proper structure for MVVM model for ArcGIS Pro SDK framework, it would be very useful.
... View more
10-23-2020
06:10 AM
|
0
|
0
|
1380
|
|
POST
|
I implemented a PRO SDK SearchTextBox however it works pretty slow. I read from a CSV file and create an object type Observable Collection and dump that into SuggestionSource then filter the results as SearchBox text change. Do you have any idea what I am doing wrong? XAML : <!-- Inserting inside user control --> xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework" <!-- Inserting inside a stack panel--> <controls:SearchTextBox x:Name="SearchLayersBox" Height="23" Margin="5,5,10,10" VerticalAlignment="Top" InfoText="Search" SearchMode="Auto" ShowHistory="True" Search="SearchTextBox_Search" Initialized="SearchLayersBox_Initialized" TextChanged="SearchLayersBox_TextChanged" SuggestionListMax="15" /> C#
public void LayersListSearchBox()
{
LayerDict.Clear();
DataListBoxSource.Clear();
var path = @"\\nrdsmnt6\mine maps\DMP_Database\Layer_Properties_spc_CSV.csv";
using (TextFieldParser csvParser = new TextFieldParser(path))
{
csvParser.SetDelimiters(new string[] { "*%&" });
csvParser.HasFieldsEnclosedInQuotes = false;
//Skip the row with the column names
csvParser.ReadLine();
while (!csvParser.EndOfData)
{
string[] fields = csvParser.ReadFields();
string LayerDisplayName = fields[3].Substring(1);
SearchSuggestCollection.Add(LayerDisplayName);
}
}
SearchLayersBox.SuggestionSource = SearchSuggestCollection;
}
private void SearchLayersBox_TextChanged(object sender, TextChangedEventArgs e)
{
string searchString = SearchLayersBox.Text;
ObservableCollection<object> filteredCollection = new ObservableCollection<object>(from objectL in SearchSuggestCollection where objectL.ToString().Contains(searchString) select objectL);
SearchLayersBox.SuggestionSource = filteredCollection;
}
private void SearchLayersBox_Initialized(object sender, EventArgs e)
{
LayersListSearchBox();
}
... View more
10-20-2020
06:34 PM
|
0
|
1
|
1414
|
|
IDEA
|
While this option is not exactly what I would like to have, it will help me greatly. Thank you!
... View more
09-28-2020
07:10 AM
|
1
|
0
|
1647
|
|
IDEA
|
When hovering on a feature class only type and path are shown in the catalog pane. However, I would like to get more information without adding a feature class to Table of Contents (TOC). For example, I would like to be able to see a little description, feature count, fields and/or inset map etc. We have about 800 different feature classes. Sometimes I need to open 6-7 different feature classes till I found the right one. I am sure there is many GIS users dealing with vast amount of feature classes/shapefiles or layers. Seeing the content of the spatial data beforehand will help us to save time and energy. If you can make this tooltip adjustable, it would be even better. In that way, a user can adjust the information s/he would like to see when mouse hover on spatial data. Thanks!
... View more
09-26-2020
06:50 AM
|
3
|
2
|
1743
|
|
POST
|
Yes, I found this information but also I heard this method cut the performance about half. Moreover, I have to deal with IT guys. If I have no other options I might give a try. Thanks for posting the information.
... View more
09-24-2020
07:11 PM
|
0
|
0
|
1341
|
|
POST
|
Is there way to edit data within a file geodatabase while other user read/view data only. I deployed a file geodatabase and other users view the data but my process scripts can not edit the data and gives me ERROR 000224 cannot acquire a lock. Is there a way to solve this problem?
... View more
09-24-2020
09:35 AM
|
0
|
2
|
1430
|
| 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 |
03-26-2025
08:14 AM
|