POST
|
Are you saying that each Add-In has to keep track of its own extension state and needs to save this state in the project or application settings?
... View more
07-22-2021
07:23 AM
|
0
|
1
|
830
|
POST
|
Does ArcPro save the state of enabled/disabled External Extensions on exit? I have an Add-In set up with the IExtensionConfig interface and the appropriate DAML settings, but I cannot seem to tell if the module should come up enabled because it was previously enabled or come up disabled because it was previously disabled. Is there some way to find out from ArcPro what the initial state is?
... View more
07-21-2021
11:31 AM
|
0
|
3
|
875
|
POST
|
In this code snippet, how are you giving the FeatureLayer the security token (line 17)?
... View more
07-20-2021
09:15 AM
|
0
|
1
|
3228
|
POST
|
I do not have a username/password (which is why I am using a generated token).
... View more
07-15-2021
04:33 PM
|
0
|
0
|
3257
|
POST
|
No, this would be a security token created for a 'secure' map service. I am actually simulating the existence of this token parameter (this is a customer environment I do not have access to) by putting '?blah=blah' at the end of the REST url.
... View more
07-15-2021
03:41 PM
|
0
|
0
|
3264
|
POST
|
I am connection to a Map Service that requires a token and this code works to get the list of layers (where url is something like http://myhost/arcgis/rest/services/MapServer?token=abcdefg😞 using (var client = new HttpClient()) { client.BaseAddress = new Uri(url + "&f=pjson"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return client.GetAsync("").Result; } I then want to go through each layer and add it as a feature layer to a map (where layerUrl looks like http://myhost/arcgis/rest/services/MapServer/5?token=abcdefg) Uri serviceUri = new Uri(layerUrl); FeatureLayer layer = new FeatureLayer(serviceUri); await layer.LoadAsync(); Map.OperationalLayers.Add(layer); This does not seem to be working. I am getting no errors, but the layer is also showing no features. Is it obvious what I am doing wrong?
... View more
07-14-2021
10:53 AM
|
0
|
9
|
3291
|
POST
|
Are you able to catch this exception? No matter where I put the try (inside or outside the QueuedTask) Visual Studio jumps to a 'stopped execution'.
... View more
09-01-2020
04:20 PM
|
0
|
0
|
572
|
POST
|
Yes, but my program does not know what the spatial reference will be until after the map frame is updated. Setting the map frame to the map copy happens very early in the process and setting the map's spatial reference happens much latter in the process.
... View more
09-01-2020
04:11 PM
|
0
|
0
|
572
|
POST
|
In ArcPro 2.6 (and 2.6.1), this code snippet will core dump (it works in 2.5). This is a much simplified version of a larger Add-In. Is this a known issue? Is there a way around this core dump (without altering the steps it requires)? protected async override void OnClick() { await QueuedTask.Run(() => { string mapName = $"Map-Copy"; //Get the map MapProjectItem mapProjectItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(item => item.Name == "Map"); Map originalMap = mapProjectItem.GetMap(); // Make a copy of the map Map newMap = MapFactory.Instance.CopyMap(originalMap); newMap.SetName(mapName); SpatialReference spatialReference = SpatialReferenceBuilder.CreateSpatialReference(6455); // Get the map frame in the layout LayoutProjectItem layoutProjectItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name == "Layout"); Layout layout = layoutProjectItem.GetLayout(); MapFrame frame = layout.Elements.FirstOrDefault(e => e.Name == "Map Frame") as MapFrame; //Set the map frame's map to the new copy frame.SetMap(newMap); // Change the spatial reference of the map newMap.SetSpatialReference(spatialReference); }); }
... View more
09-01-2020
03:26 PM
|
0
|
3
|
629
|
POST
|
To help debug performance issues we are seeing in another add-in, I created a new, simple add-in with one button which adds 50 point text elements at random positions on an empty layout. I did tests with and without a map tab open. Here is the code for adding an modifying the elements: GraphicElement element = LayoutElementFactory.Instance.CreatePointTextGraphicElement(layout, location.Coordinate2D, text); element.SetAnchor(Anchor.LeftMidPoint); element.SetRotation(ELEMENT_ANGLE); Here are my test results: Create, SetAnchor, and SetRotation on 50 elements with no map in project: ~3s Create elements only on 50 elements with map tab open: ~20s Create and SetAnchor on 50 elements with map tab open: ~2m Create, SetAnchor, and SetRotation on 50 elements with map tab open: ~3m Create, SetAnchor, and SetRotation on 50 elements with closed map in project: ~3s In all of these cases, the layout being modified was in the project contents, but not an open tab. The map was empty, and had no connection to the layout other than being in the same project. I would not expect having a map tab open to affect the performance of adding elements to an unrelated layout. Am I doing something wrong here? Is it possible to improve performance with the map tab open?
... View more
06-25-2020
03:45 PM
|
0
|
1
|
526
|
POST
|
I tested this in 2.5.1 and it still crashes and unfortunately my sequencing does not lend itself to separating the operations. I have narrowed it down to this code snippet. It is still quite slow. I think this is due to the fact that every call to CreatePointGraphic is also selecting that element in the TOC and triggering other panes (like the Edit Feature pane). Is there a way to create an element, but not have it be selected? GraphicElement defaultSymbol = layout.FindElement(DefaultSymbols.DEFAULT_SYMBOL_NAME) as GraphicElement; GraphicElement newSymbol = LayoutElementFactory.Instance.CreatePointGraphicElement(layout, new Coordinate2D()); CIMElement sourceCIM = defaultSymbol.GetDefinition(); newSymbol.SetDefinition(sourceCIM); newSymbol.SetName(elementName);
... View more
05-13-2020
08:56 AM
|
0
|
1
|
1141
|
POST
|
I changed the inner loop to this given Jeremy's suggestion. This seems solve the crash issue but is also much slower and obviously very inefficient. Is there a better solution out there? GraphicElement defaultSymbol = layout.FindElement(DefaultSymbols.DEFAULT_SYMBOL_NAME) as GraphicElement; CIMGraphicElement element = defaultSymbol.GetDefinition() as CIMGraphicElement; string elementXml = element.ToXml(); GraphicElement symbolElement = LayoutElementFactory.Instance.CreatePointGraphicElement(layout, new Coordinate2D()); CIMElement symbolElementCIM = symbolElement.GetDefinition(); StringReader sr = new StringReader(elementXml); using (XmlTextReader xtr = new XmlTextReader(sr)) { symbolElementCIM.ReadXml(xtr); } symbolElement.SetDefinition(symbolElementCIM); symbolElement.SetName(elementName);
... View more
05-12-2020
02:37 PM
|
0
|
0
|
1141
|
POST
|
It appears as though you are cloning a layout, not creating new cloned elements in a layout.
... View more
05-12-2020
08:44 AM
|
0
|
1
|
1141
|
POST
|
I need to programmatically clone a layout element many times but it keeps crashing ArcGIS Pro. I have narrowed it down to this snippet: GraphicElement element = layout.FindElement(DefaultSymbols.DEFAULT_SYMBOL_NAME) as GraphicElement; for (int i=0; i<1000; i++) { GraphicElement clonedElement = element.Clone(); clonedElement.SetName(elementName + i); } This code never completes. It gets a couple of hundred in and then excepts (the number of times through the loop varies from run to run). I am running this code inside of a QueuedTask.Run(). If I remove the SetName() I can get through more iterations (usually more than 1,000), but it still fails. Below are the stack traces it produces. Any suggestions about how to avoid this issue? Trace with SetName() System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>ArcGISPro.exe</AppDomain><Exception><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not set to an instance of an object.</Message><StackTrace> at ArcGIS.Desktop.Layouts.Element.IsFrameElement(Element element) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at ArcGIS.Desktop.Layouts.Element.SelectionHasFrame() at ArcGIS.Desktop.Layouts.Element.GetSelectedSubElements() at ArcGIS.Desktop.Layouts.Layout.&lt;&gt;c__DisplayClass130_0.&lt;UpdateGUISelectionAsync&gt;b__0() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at main(String[] args)</StackTrace><ExceptionString>System.NullReferenceException: Object reference not set to an instance of an object. at ArcGIS.Desktop.Layouts.Element.IsFrameElement(Element element) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at ArcGIS.Desktop.Layouts.Element.SelectionHasFrame() at ArcGIS.Desktop.Layouts.Element.GetSelectedSubElements() at ArcGIS.Desktop.Layouts.Layout.&lt;&gt;c__DisplayClass130_0.&lt;UpdateGUISelectionAsync&gt;b__0() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at main(String[] args)</ExceptionString><DataItems><Data></Data></DataItems></Exception></TraceRecord> An unhandled exception of type 'System.NullReferenceException' occurred in ArcGIS.Desktop.Layouts.dll Object reference not set to an instance of an object. Trace without SetName() System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>ArcGISPro.exe</AppDomain><Exception><ExceptionType>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Destination array was not long enough. Check destIndex and length, and the array's lower bounds.</Message><StackTrace> at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex) at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at ArcGIS.Desktop.Internal.Layouts.ElementContainer.ArcGIS.Desktop.Internal.Layouts.IElementContainerInternal.GetFlattenedElements() at ArcGIS.Desktop.Internal.Layouts.ElementContainer.ArcGIS.Desktop.Internal.Layouts.IElementContainerInternal.FindElement(String elementName, Boolean recurse) at ArcGIS.Desktop.Internal.Layouts.Utilities.ElementUtil.&lt;&gt;c__DisplayClass5_0.&lt;SelectedElements&gt;b__0(String name) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at ArcGIS.Desktop.Internal.Layouts.Utilities.ElementUtil.SelectedElements() at ArcGIS.Desktop.Layouts.Element.SelectionHasFrame() at ArcGIS.Desktop.Layouts.Element.GetSelectedSubElements() at ArcGIS.Desktop.Layouts.Layout.&lt;&gt;c__DisplayClass130_0.&lt;UpdateGUISelectionAsync&gt;b__0() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at main(String[] args)</StackTrace><ExceptionString>System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds. at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex) at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at ArcGIS.Desktop.Internal.Layouts.ElementContainer.ArcGIS.Desktop.Internal.Layouts.IElementContainerInternal.GetFlattenedElements() at ArcGIS.Desktop.Internal.Layouts.ElementContainer.ArcGIS.Desktop.Internal.Layouts.IElementContainerInternal.FindElement(String elementName, Boolean recurse) at ArcGIS.Desktop.Internal.Layouts.Utilities.ElementUtil.&lt;&gt;c__DisplayClass5_0.&lt;SelectedElements&gt;b__0(String name) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at ArcGIS.Desktop.Internal.Layouts.Utilities.ElementUtil.SelectedElements() at ArcGIS.Desktop.Layouts.Element.SelectionHasFrame() at ArcGIS.Desktop.Layouts.Element.GetSelectedSubElements() at ArcGIS.Desktop.Layouts.Layout.&lt;&gt;c__DisplayClass130_0.&lt;UpdateGUISelectionAsync&gt;b__0() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at main(String[] args)</ExceptionString><DataItems><Data></Data></DataItems></Exception></TraceRecord> An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
... View more
05-11-2020
11:45 AM
|
0
|
7
|
1321
|
POST
|
... xmlns:mapping="clr-namespace:ArcGIS.Desktop.Mapping.Controls;assembly=ArcGIS.Desktop.Mapping" ... <mapping:CoordinateSystemsControl Grid.Row="0" x:Name="CoordinateSystemsControl" ConfigureControl="{Binding Path=ControlProperties}" />
... View more
04-27-2020
07:27 AM
|
0
|
4
|
1392
|
Title | Kudos | Posted |
---|---|---|
1 | 12-09-2019 09:54 AM |
Online Status |
Offline
|
Date Last Visited |
02-07-2023
08:06 PM
|