POST
|
Is there a way to programmatically create templates for ArcGIS Pro? I would like to batch create a bunch of templates (.aptx) for our customers without having to go through the ArcGIS Pro Share->Save As->Project Template dialog. I have a hundred or so map templates I would like to create which would take a long time going through the user interface. I would settle for a button that would verify there are correct layers in my Map and create a template of the current map contents.
... View more
04-03-2024
10:10 AM
|
0
|
0
|
148
|
POST
|
I'm more than willing to use the Pro SDK, but didn't get any responses or help. Go to gdal.org and look over how to manipulate features and their attributes (check out the vector API tutorial) with GDAL. I used C++, but there are other bindings with Python the most popular, I think. Just call an external C++ DLL from you C# or build your GDAL code to an executable and call it from your c# if you prefer it that way.
... View more
09-22-2023
03:23 PM
|
1
|
0
|
1066
|
POST
|
I did not find a way to improve the speed with the SDK. I had to write an external C++ GDAL library to do the same thing in just seconds instead multiple minutes or hours.
... View more
09-22-2023
03:01 PM
|
1
|
2
|
1070
|
POST
|
Thanks Wolf. My code is doing a bunch of things (creating an ascii file first), but I put a print before and after the Geoprocessing CopyRaster tool and the error appears before the second print, so I know it was the line that was the offending line. The only difference between your environment is the ".wkt" in the map.spatialReference assuming you mean to include that. I'll use that also. I'll post back up if I get the error again.
... View more
05-14-2023
01:53 PM
|
0
|
0
|
278
|
POST
|
One thing I didn't mention is that I'm doing multiple calls to Geoprocessing CopyRaster in a row. Out of curiosity, I put in Thread.sleep() between each call for about a half second and so far I'm not getting the error anymore. I'm crossing my fingers.
... View more
05-12-2023
03:46 PM
|
0
|
0
|
292
|
POST
|
In ArcGIS Pro SDK, I'm converting ascii files to GeoTiff using the Geoprocessing tool with "CopyRaster_management". The funny thing is, it works 4 out of 5 times, but occasionally I get an internal System.ArgumentNullException 'Key cannot be null' error that I cannot capture with a try/catch. It just crashes ArcGIS Pro. I'll paste the full exception below. I'm not sure what to do here besides go back to the deprecated ASCIIToRaster tool. I'm using ArcGIS Pro 2.9 Here is the code: var srEnv = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: map.SpatialReference/* , parallelProcessingFactor: 0*/);
List<object> arguments = new List<object>
{
@"C:\files\myfile.asc", // raster dataset you want to copy
@"C:\files\myfile.tif", // The name and format for the raster dataset you are creating.
};
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("CopyRaster_management", Geoprocessing.MakeValueArray(arguments.ToArray()),
srEnv); The exception: System.ArgumentNullException HResult=0x80004003 Message=Key cannot be null. Parameter name: key Source=mscorlib StackTrace: at System.Collections.Hashtable.ContainsKey(Object key) at MS.Internal.WeakDictionary`2.TryGetValue(TKey key, TValue& value) at MS.Internal.Helper.SetItemValuesOnContainer(DependencyObject owner, DependencyObject container, Object item) at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item) at System.Windows.Controls.VirtualizingStackPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) at System.Windows.Controls.VirtualizingStackPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized, Boolean isBeforeViewport) at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(IItemContainerGenerator& generator, IContainItemStorage& itemStorageProvider, IContainItemStorage& parentItemStorageProvider, Object& parentItem, Boolean& hasUniformOrAverageContainerSizeBeenSet, Double& computedUniformOrAverageContainerSize, Double& computedUniformOrAverageContainerPixelSize, Boolean& computedAreContainersUniformlySized, Boolean& hasAnyContainerSpanChanged, IList& items, Object& item, IList& children, Int32& childIndex, Boolean& visualOrderChanged, Boolean& isHorizontal, Size& childConstraint, Rect& viewport, VirtualizationCacheLength& cacheSize, VirtualizationCacheLengthUnit& cacheUnit, Int64& scrollGeneration, Boolean& foundFirstItemInViewport, Double& firstItemInViewportOffset, Size& stackPixelSize, Size& stackPixelSizeInViewport, Size& stackPixelSizeInCacheBeforeViewport, Size& stackPixelSizeInCacheAfterViewport, Size& stackLogicalSize, Size& stackLogicalSizeInViewport, Size& stackLogicalSizeInCacheBeforeViewport, Size& stackLogicalSizeInCacheAfterViewport, Boolean& mustDisableVirtualization, Boolean isBeforeFirstItem, Boolean isAfterFirstItem, Boolean isAfterLastItem, Boolean skipActualMeasure, Boolean skipGeneration, Boolean isAncestorLookingForFirstItem, Boolean& hasBringIntoViewContainerBeenMeasured, Boolean& hasVirtualizingChildren) at System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(Size constraint, Nullable`1& lastPageSafeOffset, List`1& previouslyMeasuredOffsets, Nullable`1& lastPagePixelSize, Boolean remeasure) at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 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& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& 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& 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) This exception was originally thrown at this call stack: System.Collections.Hashtable.ContainsKey(object) MS.Internal.WeakDictionary<TKey, TValue>.TryGetValue(TKey, out TValue) MS.Internal.Helper.SetItemValuesOnContainer(System.Windows.DependencyObject, System.Windows.DependencyObject, object) System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(System.Windows.DependencyObject, object) System.Windows.Controls.VirtualizingStackPanel.InsertContainer(int, System.Windows.UIElement, bool) System.Windows.Controls.VirtualizingStackPanel.AddContainerFromGenerator(int, System.Windows.UIElement, bool, bool) System.Windows.Controls.VirtualizingStackPanel.MeasureChild(ref System.Windows.Controls.Primitives.IItemContainerGenerator, ref System.Windows.Controls.Primitives.IContainItemStorage, ref System.Windows.Controls.Primitives.IContainItemStorage, ref object, ref bool, ref double, ref double, ref bool, ref bool, ref System.Collections.IList, ref object, ref System.Collections.IList, ref int, ref bool, ref bool, ref System.Windows.Size, ref System.Windows.Rect, ref System.Windows.Controls.VirtualizationCacheLength, ref System.Windows.Controls.VirtualizationCacheLengthUnit, ref long, ref bool, ref double, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref System.Windows.Size, ref bool, bool, bool, bool, bool, bool, bool, ref bool, ref bool) System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(System.Windows.Size, ref double?, ref System.Collections.Generic.List<double>, ref double?, bool) System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(System.Windows.Size) System.Windows.FrameworkElement.MeasureCore(System.Windows.Size) ... [Call Stack Truncated]
... View more
05-12-2023
12:01 PM
|
0
|
3
|
347
|
POST
|
The Field calculator is a very fast way to edit attributes for multiple feature/rows. What if I have an array of values that I want to apply to the attributes (fields) of a feature layer? Can I use this array in the field calculator? The reason I'm asking is because when I use a feature cursor or the inspector, it is very very slow when you have thousands of features (unless I'm doing it wrong: Editing features very slow - Esri Community).
... View more
02-19-2023
03:49 PM
|
0
|
0
|
238
|
POST
|
I'm looking for a way to save feature attributes a fast as possible. The two methods I have tried are pretty slow. I have a feature dataset in a geodatabase (also tried shapefile) that I am applying a spatial intersect and editing those features that fall in my polygon. I have tried the EditOperation and also the Inspector shown below. I'm editing (changing attributes) over 27,000 features. The modifyoperation takes 10 minutes and the Inspector code takes 23 minutes, which both seem way to slow. I'm doing this in release mode (debug mode takes way too long). // Using Edit Operation
var modifyOp = new ArcGIS.Desktop.Editing.EditOperation();
modifyOp.Name = "my edit";
// Create an extent rectangle
SpatialQueryFilter spatialQueryFilter = new SpatialQueryFilter
{
FilterGeometry = CreateDomainPolygon(X, Y, length),
SpatialRelationship = SpatialRelationship.Intersects
};
using (RowCursor fCursor = pFClass.Search(spatialQueryFilter, false))
{
while (fCursor.MoveNext())
{
using (Row row = fCursor.Current)
{
nameVal = (string)row.GetOriginalValue(nameIndex);
modifyOp.Modify(row, "fieldName1", dict[nameVal]);
modifyOp.Modify(row, "fieldName2", dict[nameVal]);
}
}
}
modifyOp.Execute();
// Inspector inside rowcursor (slower!)
using (Feature pFeature = (Feature)fCursor.Current)
{
nameVal = (string)pFeature.GetOriginalValue(nameIndex);
insp.Load(pLayer, pFeature.GetObjectID());
insp["fieldName1"] = dict[nameVal];
insp["fieldName2"] = dict[nameVal];
insp.Apply();
} I am wanting to get these down to a minute if possible. Is there a faster/better way to edit feature attributes?
... View more
01-25-2022
08:12 PM
|
0
|
11
|
1628
|
POST
|
I'm trying to create an animation of several of my raster datasets by creating a Mosaic Dataset and adding my rasters to that dataset and then adding a time field so I can animate through each. The problem I'm having is that the rasters seem to have some kind of smoothing or outline around each of the cells: Any idea how this is happening? Or is there another suggestion for animating between different raster datasets?
... View more
01-17-2022
04:23 PM
|
0
|
2
|
642
|
POST
|
@Wolf With your hint I nailed it down to one of my panes in my Add-in. I have a webbrowser control inside my pane. If I remove it, the the white rectangle goes away. I'm using it so I can print html status messages to a console like window (my pane). Maybe ArcGIS doesn't support webbrowser control inside pane in this way? I'll have to think of an alternative way to display html if I can't fix. <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<WebBrowser Grid.Row="0" x:Name="webConsole" Margin="10,5,10,0" ui:BrowserBehavior.Html="{Binding HtmlToDisplay}"/>
<ProgressBar Grid.Row="1" x:Name="ProgressBar" HorizontalAlignment="Left" Width="150" Height="10"
Margin="10, 5, 0, 5" IsIndeterminate="{Binding IsProgressIndeterminate}"
Visibility="{Binding IsProgressVisible, Converter={StaticResource BoolToVisibility}}"/>
</Grid>
... View more
05-24-2021
09:08 PM
|
0
|
0
|
655
|
POST
|
Thanks for the link. I did see that. I wonder if they just started to enforce it as legacy apps (ArcMap) do allow it (for shapefiles at least). I now have make sure my code works with the older field names and new ones I will make up. Ugh, more work!
... View more
05-18-2021
07:55 AM
|
0
|
0
|
880
|
POST
|
Back in the ArcObjects days I had no problems creating field names that start with a number. Now when I use Geoprocessing.ExecuteToolAsync("AddField_management", mva), it restricts me from using field names that start with a number (or underscore that I have read). Any way around this? Wonder why the restriction now when all my legacy data has many fields starting with at number?
... View more
05-17-2021
09:34 PM
|
0
|
2
|
988
|
POST
|
Its actually my add-in I'm creating. Ugh, I need to strip down the config.daml so I share it. I'll keep working it. Thanks.
... View more
05-10-2021
07:13 AM
|
0
|
0
|
773
|
POST
|
Thanks for the tip. I'll check my drivers although one of my colleagues is seeing the same thing. If I remove all my add-ins, it goes away. If I reinstall my add-in that I have been developing, I see it again.
... View more
05-06-2021
12:28 PM
|
0
|
0
|
822
|
Title | Kudos | Posted |
---|---|---|
1 | 09-22-2023 03:23 PM | |
1 | 09-22-2023 03:01 PM | |
1 | 03-01-2021 01:24 PM |
Online Status |
Offline
|
Date Last Visited |
04-04-2024
08:29 PM
|