|
POST
|
I'm suspecting that the constructor is at fault here - if ESRI could confirm this as a bug or not that would be good. I have since changed the code to this, not using a constructor, and it works perfectly. Very strange and certainly a high chance that this will "can-trip" a lot of developers. Here is the code that now works: Item currentItem = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
await QueuedTask.Run(() =>
{
//Create a LayerCreationParam - constructor method does not honour indexes.
var layerParam = new LayerCreationParams(currentItem);
layerParam.Name = layer.Name;
layer.Visible = layer.Visible;
layerParam.MapMemberPosition = MapMemberPosition.Index;
layerParam.MapMemberIndex = layer.LayerOrder;
if (LayerFactory.Instance.CanCreateLayerFrom(currentItem))
{
LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParam, groupLayer);
}
});
... View more
02-14-2023
09:31 AM
|
0
|
3
|
1131
|
|
POST
|
Hi, I am trying to add 3 layers to a group layer in a specific index order. I use the FeatureLayerCreationParams object with the LayerFactory.Instance.CreateLayer() function - but when I look at the results in the TOC - the layers have come in a random order and not the order I specified. This was working fine in 2.x but since I have moved to 3.x this code does not seem to work - I'm not sure what I can do but I need to fix the problem urgently. Here is the code I use (I pass in my object called "layer", which holds the index information to pass on): await QueuedTask.Run(() =>
{
Item stagingLayer = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
if (LayerFactory.Instance.CanCreateLayerFrom(stagingLayer))
{
var featureCreateParams = new FeatureLayerCreationParams(stagingLayer)
{
IsVisible = layer.Visible,
MapMemberIndex = layer.LayerOrder,
//Even this does NOT fix the issue
MapMemberPosition = MapMemberPosition.Index,
Name = layer.Name
};
LayerFactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, groupLayer);
}
});
... View more
02-14-2023
07:37 AM
|
0
|
4
|
1185
|
|
POST
|
Hi, I did, in the end, do something similar to what you are suggesting. Multiple queries with guaranteed results of less that 10,000 - then store that in a list. It was a bit more faffing about - but I did learn about clever multiple async calls to the rest endpoint - that ended up getting the results much faster than I thought. So I did gain some benefit out of it.
... View more
02-02-2023
07:06 AM
|
0
|
0
|
1447
|
|
POST
|
No I don't mean that. I mean my actual project/add-in. Its huge from version 2.x of Pro. If I have to start a new addin project and copy in all the code and start again - thats a real pain in the backside!
... View more
01-25-2023
07:14 AM
|
0
|
1
|
1356
|
|
POST
|
Where do you begin with this sort of stuff?! I did the migration process, but who knows if its done it 100% right. It would seem it hasn't ported cleanly. I really don't want to start remaking all over project again.
... View more
01-25-2023
06:59 AM
|
0
|
3
|
1360
|
|
POST
|
I have a maptool where I just place a marker on a map. Nothing else, no other business logic. The marker is placed fine, however - when you look at the debug the amount of exceptions thrown from ArcGIS.Dektop.Mapping.dll is concerning. What is going on here, should this be happening? Here is my simple code: internal class FooTool : MapTool
{
private IDisposable _graphic = null;
public FooTool()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Point;
SketchOutputMode = SketchOutputMode.Map;
}
protected override async Task<bool> OnSketchCompleteAsync(ArcGIS.Core.Geometry.Geometry geometry)
{
try
{
MapPoint mapPoint = (MapPoint)geometry;
await QueuedTask.Run(() =>
{
var mapView = MapView.Active;
//Show marker
if (_graphic != null)
{
_graphic.Dispose();
}
_graphic = mapView.AddOverlay(mapPoint, SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.BlueRGB, 14, SimpleMarkerStyle.Pushpin).MakeSymbolReference());
});
}
catch (ArgumentException ae)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ae.Message, "Tool error");
}
catch (Exception ex)
{
Log.Error(ex);
}
return true;
}
}
... View more
01-25-2023
05:46 AM
|
0
|
7
|
1408
|
|
POST
|
Hi, We, as a company are facing a serious limitation which is having an impact on the add-in software we supply to our customers. We need to be able to search AGOL for items (Layers) that exceed the 10000 limit - we have around 33,000 items we want to return. This is my code which hits the hard limit of 10,000 - it uses pagination. private static async Task<HashSet<AgolLayer>> GetLayersFromAGOL(string search)
{
var portal = ArcGISPortalManager.Current.GetActivePortal();
HashSet<AgolLayer> agolLayers = new HashSet<AgolLayer>(new AgolIdComparer());
if (portal.IsSignedOn())
{
var query = PortalQueryParameters.CreateForItemsOfTypes(new List<PortalItemType>() { PortalItemType.Layer }, "", Properties.Settings.Default.CurrentGroupId, search);
query.Limit = 100;
query.Query = query.Query + "&sortField=modified&sortOrder=desc";
//Loop until done
var portalItems = new List<PortalItem>();
while (query != null)
{
//run the search
PortalQueryResultSet<PortalItem> results = await portal.SearchForContentAsync(query);
portalItems.AddRange(results.Results);
totalResultsCount = results.TotalResultsCount;
query = results.NextQueryParameters;
}
foreach (var pi in portalItems)
{
AgolLayer agolLayer = new AgolLayer(pi);
agolLayers.Add(agolLayer);
}
}
return agolLayers;
} Is there a way around this limitation? Some links (below) back the findings I am referring to: https://developers.arcgis.com/rest/users-groups-and-items/considerations-and-limitations.htm
... View more
01-18-2023
06:27 AM
|
0
|
3
|
1552
|
|
POST
|
It does actually. However the code I left out was a line that created a row in a database (a method that is not async) based on findings earlier on i.e. the alias name. I think this may be the bit of code that is causing the code to not run properly.
... View more
11-14-2022
03:18 AM
|
0
|
0
|
1541
|
|
POST
|
You're right it does work. I have simplified what I have done - so I guess I'll take it from there and build it up in complexity and see what is causing the problem.
... View more
11-14-2022
02:09 AM
|
0
|
2
|
1551
|
|
POST
|
Updated - not really anything special to call code.
... View more
11-14-2022
01:36 AM
|
0
|
4
|
1555
|
|
POST
|
Hi, I'm trying to go through each layer in the TOC and do get the alias name of the layer then do something that name. In order to this - I have a recursive method that loops - however you need to await QueuedTask.Run() the call to get information about an alias in layer - and in a recursive function something weird is happening - as this only gets called once and never breaks into that Queued Task code block again. Something is happening here thats a bit beyond me when it gets to asynchronous programming - can anyone help me find a way to get this recursive function to work properly? //calling code:
var map = MapView.Active.Map;
foreach (var item in map.Layers)
{
await RecurseTocLayers(item);
}
private async Task RecurseTocLayers(Layer layer)
{
if (layer is BasicFeatureLayer)
{
FeatureLayer featureLayer = layer as FeatureLayer;
//THIS ONLY GETS CALLED ONCE - THEN NEVER AGAIN!
await QueuedTask.Run(() =>
{
var table = featureLayer.GetTable();
TableDefinition tableDefinition = table.GetDefinition();
string alias = tableDefinition.GetAliasName();
//do something here with alias name.....e.g.
System.Diagnostics.Debug.WriteLine($"The alias name is: {alias}");
});
}
if (layer is GroupLayer)
{
//do something here with GroupLayer, then....
GroupLayer groupLayer = (GroupLayer)layer;
foreach (var child in groupLayer.Layers)
{
await RecurseTocLayers(child);
}
}
} ASDFDSAF
... View more
11-13-2022
05:14 AM
|
0
|
7
|
1610
|
|
POST
|
This should be simple, however I can't seem to find how you can get the alias name of a featureclass. I am going though the layers in the TOC, I think they are FeatureLayer type when you are looping, but no obvious way to find the alias.
... View more
10-19-2022
12:44 PM
|
0
|
4
|
1794
|
|
POST
|
Yes, I had googled and found the same result/thread (before I posted on this forum). I have followed advice for deleting the DesignTimeBuild folder - but that doesn't get rid of the error. Apart from manually rebuilding the project afresh, I can't think of anything to get rid of this error. This may be a bug with Visual Studio 2022 and nothing to do with ESRI add-in project templates in any case. Would be interesting to know if this has happened to other people once they have migrated their projects to 3.
... View more
10-14-2022
04:31 AM
|
0
|
0
|
1890
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-18-2023 10:11 AM | |
| 1 | 08-22-2025 02:27 AM | |
| 2 | 12-19-2023 01:36 AM | |
| 1 | 12-21-2023 04:02 AM | |
| 1 | 05-27-2021 10:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-08-2025
05:51 AM
|