|
POST
|
Hi Than, Pro is using the 7 zip library. I attached a sample project to unzip a project file that appears to work for me, it should work for templates too. Since Pro ships with the 7z dll you can set the path for the extractor to the Pro install bin folder (c:\ArcGIS is my install location): // set 7z.dll path:
SevenZipExtractor.SetLibraryPath(@"C:\ArcGIS\Bin\7z.dll"); I also used the following NuGet: NuGet Gallery | SevenZipSharp.Interop 19.0.0
... View more
07-07-2020
02:18 PM
|
1
|
2
|
3002
|
|
POST
|
There is a sample that deletes a table from a File Geodatabase: Edit Operation Row Event You might be able to use this snippet from this sample: QueuedTask.Run(async() =>
{
//find layer and derive geodatabase
var cpLayer = MapView.Active.Map.FindLayers("CrowdPlanning").FirstOrDefault() as FeatureLayer;
var geodatabase = cpLayer.GetFeatureClass().GetDatastore() as Geodatabase;
//Advise
//Delete the editlog table
var mva = Geoprocessing.MakeValueArray(geodatabase.GetPath().AbsolutePath,"EditLog");
await Geoprocessing.ExecuteToolAsync("Delete_management", mva);
});
... View more
07-07-2020
11:28 AM
|
1
|
2
|
3271
|
|
POST
|
Hi Than, This is not supported by the API. However, these files are simple .zip files so as a possible solution you could write some code to unzip the file (project or template) and parse the content for your tags.
... View more
07-06-2020
08:41 AM
|
1
|
4
|
3002
|
|
POST
|
Hi Than, Can you try to simplify your code as shown below and try if it works: private void RemoveDrawnGraphics()
{
this.CurrentGraphic?.Dispose();
this.CurrentGraphic = null;
}
... View more
06-30-2020
12:58 PM
|
0
|
2
|
1851
|
|
POST
|
Hi Lars, Just to re-iterate the issue one more time: after converting a set of polygons from GML these polygons can be rendered as 'distinct' polygon records as shown below, showing all the expected detail (extrusions etc.): If we take these 'distinct' polygon records and create one 'multi-part' polygon record using the 'distinct' polygons as parts, the rendered representation has 'holes' as compared to the rendering of the 'distinct' records. I showed the data to the development team and here is the gist of their reply: ArcGIS Pro only renders multipart polygons without 'holes' if these polygons are 'simple' polygons. One of the requirements of a 'simple' polygon is that 'rings cannot overlap'. If there's an overlap of parts, rendering can exhibit 'holes' because ArcGIS Pro uses the even-odd rule when rendering polygons. As defined by this rule overlapping parts will produce holes when rendered. Here is a definition of the Even-Odd rule: https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule So in order to render the converted GML you have two options: add a 'distinct' polygon for each part of the building (and use an id field to identify polygons belonging to a specific building) or union the polygon parts of a building into a single building polygon (in which case you only get the footprint outline of the building). For the next release, we will try to update our ProConcept documentation to address these rendering behaviors in more detail.
... View more
06-17-2020
10:01 AM
|
2
|
1
|
4982
|
|
POST
|
You can use the snippet below to get this result when searching for these accounts (type string) ' "Test 0", "Test 1", "Test x"' - Note that only Test x doesn't exist: In essence you first do your selection and then search through the selected set one by one to find the 'missing' item. protected override async void OnClick()
{
Tuple<int, string> selectionInfo = null;
try
{
var accounts = new List<string>() { "Test 0", "Test 1", "Test x" };
selectionInfo = await SelectByAttributeAsync("TestPoints", accounts);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
_ = MapView.Active.ZoomToSelectedAsync(new TimeSpan(0, 0, 3), true);
MessageBox.Show($@"{selectionInfo.Item1} records were selected - {selectionInfo.Item2}");
}
public static Task<Tuple<int, string>> SelectByAttributeAsync(string featureLayerName, List<string> accounts)
{
return QueuedTask.Run(() =>
{
var firstLyr = MapView.Active.Map.FindLayers(featureLayerName).FirstOrDefault() as FeatureLayer;
if (firstLyr == null) throw new Exception(string.Format("The feature class: {0} does not exist", featureLayerName));
// make list of accounts into 'in' clause
var commaList = string.Join(",", accounts.Select(p => $@"'{p}'"));
var qf = new QueryFilter()
{
WhereClause = $@"description in ({commaList})",
SubFields = "*"
};
var selection = firstLyr.Select(qf);
// remainingAccounts tracks first all accounts and each found account will be removed
var remainingAccounts = new List<string>(accounts);
using (var foundCursor = firstLyr.Search(new QueryFilter() { ObjectIDs = selection.GetObjectIDs() }))
{
while (foundCursor.MoveNext())
{
using (var row = foundCursor.Current)
{
var foundAccount = row["description"].ToString();
remainingAccounts.Remove(foundAccount);
}
}
}
var msg = string.Empty;
if (remainingAccounts.Count == 0) msg = "All records found";
else msg = $@"Not found: {string.Join (",", remainingAccounts)}";
return new Tuple<int, string> (selection.GetCount(), msg);
});
}
... View more
06-16-2020
02:36 PM
|
2
|
1
|
1086
|
|
POST
|
thanks for the sample code, i was able to duplicate your issue. I am still looking at some details (for example if the renderer or the data is to blame), but if i understand correctly, you expect this geometry: but instead you get a multipart polygon (or multi patch) geometry with a few holes: i will have somebody look over my findings and will get back to you on this thread.
... View more
06-15-2020
04:42 PM
|
1
|
3
|
4982
|
|
POST
|
You mean like it's shown in this sample: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/TableControl ? If so, Charlie just pointed out to me that there is also a ProGuide for the table control: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-TableControl
... View more
06-15-2020
11:28 AM
|
1
|
0
|
981
|
|
POST
|
Just to match sure you can only store Multipatch geometries in a feature class that supports Multipatch type geometry:
... View more
06-15-2020
09:19 AM
|
1
|
1
|
4982
|
|
POST
|
I implemented a configuration which allows you to make your modifications to the file geodatabase before the project is even loaded. I think this should alleviate the hanging issues and UI lockups you are seeing. There are a few changes to the command line since you start ArcGIS Pro with the installed 'managed configuration' (which is like an add-in plus control over Pro startup & customization). The command line looks like this now: C:\ArcGIS\bin\ArcGISPro.exe /config:"UpdateAnnotation" /load:"C:\Data\FeatureTest\FeatureTest.aprx"
where: UpdateAnnotation is the name of the 'managed configuration'
and C:\Data\FeatureTest\FeatureTest.aprx is the path to the project to open You start Pro with the above command line, the default startup screen has been replaced by a custom startup screen which is showing the progress of your workflow (see the StartupUI folder) : Your business logic (making new annotation - using MyBusinessLogic as a sample for each step) would go here in the OnApplicationReady override: protected override async void OnApplicationReady ()
{
var projectPath = ParseCommandArgs("/load:");
if (string.IsNullOrEmpty(projectPath))
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(@"Command line parameter is required: /load:""path to project file""");
FrameworkApplication.Close();
return;
}
RunOnUiThread(() => _startupPageViewModel.TheProject = projectPath);
for (int i = 0; i < 10; i++)
{
RunOnUiThread(() => _startupPageViewModel.TheStatus += $"Step {i} \n");
await MyBusinessLogicAsync();
}
_ = Project.OpenAsync(projectPath);
} I attached the complete project, i built it in 2.6 but 2.5 should work as well.
... View more
06-11-2020
04:47 PM
|
0
|
1
|
1000
|
|
POST
|
A few questions and assumption of mine regarding the workflow. I just want to make sure i understand your workflow before i try it: Do you start Pro with a configuration or without any command line parameters? How is the ArcGIS Pro project loaded - i.e. does the user click to open a project or does your add-in/configuration open it programmatically? Here are a few assumptions of mine, let me know if these are correct: 1. You know which annotation tables you like to 'refresh' by name and file GDB path. 1. Your 'refresh' is in essence deleting the annotation feature class first and then recreating it. 1. When a mapview is opened you want it to display the 'refreshed' annotation. And here are my assumptions of how your workflow works: 1. A mapview pane opens and draws a map including the [from above] annotation in the TOC 1. You wait for the mapview to finish drawing 1. In the OnCompletedDrawEvent you delete the TOC entry for the annotation feature class 1. On the annotation feature class you run a Geoprocessing tool, management.Delete 1. Currently this tool hangs - but let's ignore the hang for now 1. You then recreate the a new annotation feature class using some external process - maybe a GP tool again, this annotation feature class has the same name/path as the one you deleted before. 1. You add the annotation back to the TOC. 1. Now the mapview shows the 'refreshed' annotation class.
... View more
06-11-2020
01:05 PM
|
0
|
3
|
2856
|
|
POST
|
Looks like we are getting closer to the cause of the hang ... in general context matters because Pro will execute background operations in sequence and if you introduce an operation with a cross dependency this can lead to a 'hang'. You can use the ArcGIS Diagnostic Monitor (which you can start once ArcGIS Pro has started by using the following key sequence: Alt+Ctrl+M) to see any such hangs. Just as a test you can try to run your logic from the UI thread by using the following utility functions [in my case] added to a Utils class: /// <summary>
/// utility function to enable an action to run on the UI thread (if not already)
/// </summary>
/// <param name="action">the action to execute</param>
/// <returns></returns>
internal static void RunOnUiThread(Action action)
{
try
{
if (IsOnUiThread)
action();
else
Application.Current.Dispatcher.Invoke(action);
}
catch (Exception ex)
{
MessageBox.Show($@"Error in RunOnUiThread: {ex.Message}");
}
}
/// <summary>
/// Determines whether the calling thread is the thread associated with this
/// System.Windows.Threading.Dispatcher, the UI thread.
///
/// If called from a View model test it always returns true.
/// </summary>
public static bool IsOnUiThread => ArcGIS.Desktop.Framework.FrameworkApplication.TestMode || System.Windows.Application.Current.Dispatcher.CheckAccess(); and using RunOnUiThread you can then run your business logic on the UI thread: Utils.RunOnUiThread(() =>
{
// add your logic here
}); If we take a step back though, what is it your workflow is trying to accomplish? Are you trying to programmatically remove certain layers from the TOC when a new mapview is opened ? Maybe there's a better way to do this.
... View more
06-11-2020
11:28 AM
|
0
|
8
|
2856
|
|
POST
|
Hi Martin, I wasn't sure about the Wait, since I wasn't patient enough I removed it, however, it works with or without. You have to use the Datastore within a using block though. I tried the sample code below and it worked fine ... the anno layers under the group were removed and no hang occurred. protected override async void OnClick()
{
var activeMap = MapView.Active?.Map;
if (activeMap == null) return;
var location = @"C:/Data/FeatureTest/FeatureTest.gdb";
var name = @"TestLinesAnno";
await QueuedTask.Run(() =>
{
List<Layer> layersToRemove = new List<Layer>();
foreach (AnnotationLayer annotationLayer in activeMap.GetLayersAsFlattenedList().OfType<AnnotationLayer>())
{
using (AnnotationFeatureClass featureClass = annotationLayer.GetFeatureClass() as AnnotationFeatureClass)
{
if (featureClass != null)
{
using (var dataStore = featureClass.GetDatastore())
{
if (dataStore.GetPath().AbsolutePath == location &&
featureClass.GetName() == name)
{
layersToRemove.Add(annotationLayer);
}
}
}
}
}
activeMap.RemoveLayers(layersToRemove);
});
}
... View more
06-11-2020
10:30 AM
|
0
|
1
|
2856
|
|
POST
|
It's hard to tell without seeing your code. I lifted this snippet from one of my samples and it works: var activeMap = MapView.Active?.Map;
if (activeMap == null) return;
try
{
var removeLayers = activeMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(fl => fl.Name.StartsWith("Test"));
await QueuedTask.Run(() =>
{
MapView.Active.Map.RemoveLayers(removeLayers);
});
}
catch (Exception ex)
{
MessageBox.Show($@"Exception occurred: {ex}");
}
... View more
06-11-2020
09:13 AM
|
0
|
3
|
2856
|
|
POST
|
If you look inside the project file (it's a zip format, so you can unzip it) you will be able to find your layout stored in form of a CIMLayout XML (mine is called layout.xml). You can also use the CIMViewer tool to inspect the CIMLayout without looking at the project file. If you look through the CIMLayout and more specifically through the Graphic elements within the CIMLayout tag you will find that your image is included under the PictureURL tag as a base64 encoded jpeg. That's why you see the image when you open your layout even so the original path from where the image was sourced is inaccessible. When you further inspect the same Graphics tag you see the original source path stored under the SourceURL tag. This SourceURL tag's content is what you see when you open up the properties page for the image.
... View more
06-10-2020
02:02 PM
|
0
|
1
|
1910
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-29-2025 10:48 AM | |
| 1 | 05-24-2021 09:04 AM | |
| 1 | 12-03-2020 08:44 AM | |
| 1 | 10-07-2025 07:27 AM | |
| 2 | 12-29-2025 10:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-21-2026
01:59 PM
|