|
POST
|
Is there a way to alternate the placement of elements within a map series? For example, when printing a double-sided map series I want the "Page Number" element to be placed on the rights side on odd pages, and on the left side on even pages. Also shifting all elements slightly left (or right) is also desirable when printing for a spiral bound book. The only way I have found to do this is by creating two separate Layouts, each with the desired placement of all elements done manually...one for Even pages and one for Odd pages. This also requires a custom grid for each map which is a bit of a pain as well as other slight modifications. Has anyone else dealt with this issue? What solutions do you use?? Thanks,
... View more
09-13-2019
11:38 AM
|
0
|
1
|
1012
|
|
POST
|
Hi Kylie, I have things working now. Workforce was referencing a map to open that the user didn't have access to. Thanks for the help!
... View more
08-22-2019
05:30 AM
|
1
|
0
|
2755
|
|
POST
|
Hi, I've created a Workforce project, and can see my Dispatcher and Worker maps from the projects Overview tab. I am able to assign tasks through the Dispatcher map without any problems. I'm using a Pixel 3 to run Workforce in the field. I can see assigned tasks, but when I click on 'Collect at Assignment' to open up Collector, I get a "Map not found: Make sure the map is shared with you." message come up. It seems like my sharing permissions are setup correctly though, so I don't know what is going on. Any ideas on things to try??
... View more
08-21-2019
08:21 AM
|
0
|
10
|
3491
|
|
POST
|
Does anyone know when the details on the 2020 Dev Summit will get released. Mainly, where, when and prices. Thanks,
... View more
07-31-2019
07:53 AM
|
1
|
2
|
2057
|
|
POST
|
Hi, I've added .ShowProgressor = true to my EditOperation, but I'm just wondering what exactly needs to get triggered for it to appear. In my code, I am looping though bunch of selected features, and doing a chainedEdit operation. The progressDialog never shows though the entire process. Occasionally I do get a "Performing Edits" window message pop-up, but I'm assuming that is just a standard ArcPro message that I am seeing. It shows up for a few seconds, then disappears perhaps showing up again if a lot of features were selected. How do I get the Progressor to show and stay on the screen until finished? var editOperation = new ArcGIS.Desktop.Editing.EditOperation();
editOperation.Name = "Create new Facility IDs";
editOperation.ProgressMessage = "Calculating FacilityID's...";
editOperation.ShowProgressor = true;
editOperation.CancelMessage = "Operation Cancelled";
editOperation.ErrorMessage = "Error Updating Attributes";
editOperation.EditOperationType = ArcGIS.Desktop.Editing.EditOperationType.Long;
... View more
07-24-2019
05:37 AM
|
0
|
1
|
1064
|
|
POST
|
Hi Sean Jones, Great! Thanks for the help. The Inspector.Clear didn't really make any difference, but creating the chainedOp each time through the loop is what made the difference. I'd previously used a ChainedOp when I was trying to add a group of edits as one item on the Undo stack. Doing what is apparantly the 'wrong way' worked in that case because I was not dependent on the results of previous edits for the next edit. But when you do need that previous edit for the next, it looks like creating the chainedOp each time is essential. Thanks again. if (isMainOperation)
{
editOperation.Modify(inspector);
bool result = editOperation.Execute();
//change the flag so we use the ChainedOp next
isMainOperation = false;
}
else
{
chainedOp = editOperation.CreateChainedOperation();
//queue up a Modify
chainedOp.Modify(inspector);
chainedOp.Execute();
}
... View more
07-24-2019
05:02 AM
|
0
|
0
|
1670
|
|
POST
|
Hi Sean Jones, Yes, I have tried adding a chainedOp.Execute right after the Modify, but then the code crashes. Without it, I just get the same value plugged into each feature as you mentioned. No, rejectedCount is really just some random in development code that never gets hit. I've been messing with this all day, breaking it down into a more simplified version, but I get the same results. I'm really baffled as to how to get this working. Here is everything I have if it helps. Should be simpler and easier to read. using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Catalog;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Editing;
using ArcGIS.Desktop.Extensions;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
using System.Collections;
namespace ArcPro_DSM_Settings
{
internal class TEST : Button
{
string gridNumber, structureType;
int sequenceNumber;
protected override void OnClick()
{
QueuedTask.Run(() =>
{
Map map = MapView.Active.Map;
//Create the MAIN edit operation...this will show up on the Undo Stack
var editOperation = new ArcGIS.Desktop.Editing.EditOperation();
editOperation.Name = "Create new Facility IDs";
editOperation.ProgressMessage = "Calculating FacilityID's";
editOperation.ShowProgressor = true;
editOperation.CancelMessage = "Operation Cancelled";
editOperation.ErrorMessage = "Error Updating Attributes";
editOperation.EditOperationType = ArcGIS.Desktop.Editing.EditOperationType.Long;
//create a flag to track the 'main' operation
bool isMainOperation = true;
ArcGIS.Desktop.Editing.EditOperation chainedOp = null;
//create the Inspector Object
var inspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
//Go through each layer in the map
foreach (Layer layer in map.GetLayersAsFlattenedList().OfType<FeatureLayer>())
{
var currentLayer = map.FindLayers(layer.Name).FirstOrDefault() as BasicFeatureLayer;
var selection = currentLayer.GetSelection();
IReadOnlyList<long> selectedOIDs = selection.GetObjectIDs();
int nextNum = 0;
//Loop through each selected OBJECTID, and pass the DRAWING and FACILITYID fields to the OpenDrawing method.
foreach (var oid in selectedOIDs)
{
inspector.Clear();
inspector.Load(currentLayer, oid);
//Need to pass a FeatureCLass to the GetNextFaciltyID procedure
FeatureLayer currFLayer = currentLayer as FeatureLayer;
FeatureClass currFClass = currFLayer.GetFeatureClass();
//This is where the sequence number will get incremented each time (in the GetNextFacilityID)
inspector["FACILITYID"] = GetNextFacilityID(currFClass, "Y27");
inspector["SEQUENCENO"] = sequenceNumber;
//editOperation.Modify(inspector);
if (isMainOperation)
{
editOperation.Modify(inspector);
bool result = editOperation.Execute();
//change the flag so we use the ChainedOp next
isMainOperation = false;
}
else
{
//only create the ChainedOp once
if (chainedOp == null)
chainedOp = editOperation.CreateChainedOperation();
//queue up a Modify
chainedOp.Modify(inspector);
bool chainResult = chainedOp.Execute();
}
}
}
//if (!editOperation.IsEmpty)
// editOperation.Execute();
if ((chainedOp != null) && !chainedOp.IsEmpty)
{
bool chainedResult = chainedOp.Execute();
}
});
}
//This will return the next FacilityID
public string GetNextFacilityID(FeatureClass fClass, string gridNum)
{
try
{
QueryFilter queryFilter = new QueryFilter();
queryFilter.WhereClause = "GRIDNO ='" + gridNum + "'";
queryFilter.SubFields = "SEQUENCENO";
//create an array to hold all of the SEQUENCENO; give it's first member the value zero
ArrayList idList = new ArrayList();
idList.Add(int.Parse("0"));
RowCursor rCursor = fClass.Search(queryFilter);
Feature feature;
while (rCursor.MoveNext())
{
using (feature = (Feature)rCursor.Current)
{
int sequencePosition = feature.FindField("SEQUENCENO");
idList.Add(Convert.ToInt32(feature[sequencePosition]));
}
}
//sort the list so we can get the highest value of SEQUENCENO
idList.Sort();
//the next # we want is the current highest number + 1
int number = (int)idList[idList.Count - 1] + 1;
sequenceNumber = number;
//convert it to a string so we can add the zero placeholders to the front of it....it needs to be 4 digits.
string finalNum = number.ToString();
switch (finalNum.Length)
{
case 1:
finalNum = "000" + finalNum;
break;
case 2:
finalNum = "00" + finalNum;
break;
case 3:
finalNum = "0" + finalNum;
break;
}
//return the full facility id, with the STRUCTURETYPE, GRIDNO, and SEQUENCENO
return structureType + "-" + gridNumber + "-" + finalNum;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
return null;
}
}
}
}
... View more
07-23-2019
12:29 PM
|
0
|
3
|
1670
|
|
POST
|
Hi, I'm trying to figure out where I am going wrong in my edit sequence. What I am doing is selecting newly created features that have no attribute information entered. The user then runs the tool and an attribute get populated. The field is a numeric field and there is some code that looks for the last entered number (ie. the current highest number) and increases it by 1 for the new feature. So, for example the user adds 3 new hydrants and selects them all, then runs the tool. If there are already 10 hydrants the 3 new hydrants should get the numbers 11, 12, and 13 added into the SEQUENCENO attribute for the new features. My problem is that the 11 and 12 get added, but then third feature gets 12 added again. If I have 10 features selected, the same sort of pattern happens. The 11 and 12 get added, but then the remaining 8 would also get 12. I only want one item to show on the Undo stack, and each edit will affect the next, so that is why I am using ChainedOperation, but I just don't think I am implementing it correctly. Below is the code where it loops though all the selected features and assigns the next number. If you can offer some advice on how to get this working I'd appreciate it. //Create the MAIN edit operation...this will show up on the Undo Stack
var editOperation = new ArcGIS.Desktop.Editing.EditOperation();
editOperation.Name = "Create new IDs";
editOperation.EditOperationType = ArcGIS.Desktop.Editing.EditOperationType.Long;
ArcGIS.Desktop.Editing.EditOperation chainedOp = null;
//create the Inspector Object
var inspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
//create a flag to track the 'main' operation
bool isMainOperation = true;
//Loop through each selected OBJECTID.
foreach (var oid in selectedOIDs)
{
inspector.Clear();
inspector.Load(currentLayer, oid);
//Need to pass a FeatureCLass to the GetNextFaciltyID procedure
FeatureLayer currFLayer = currentLayer as FeatureLayer;
FeatureClass currFClass = currFLayer.GetFeatureClass();
//This is where the sequence number will get incremented each time (in the GetNextFacilityID)
inspector["FACILITYID"] = GetNextFacilityID(currFClass, gridNumber);
inspector["SEQUENCENO"] = sequenceNumber;
}
if (isMainOperation)
{
editOperation.Modify(inspector);
bool result = editOperation.Execute();
//change the flag so we use the ChainedOp next
isMainOperation = false;
}
else
{
//only create the ChainedOp once
if (chainedOp == null)
chainedOp = editOperation.CreateChainedOperation();
//queue up a Modify
chainedOp.Modify(inspector);
}
//Increase the feature count for the final tally
featureCount++;
}
else
{
rejectedCount++;
}
} //go to next selected feature in current layer
if ((chainedOp != null) && !chainedOp.IsEmpty)
{
bool chainedResult = chainedOp.Execute();
} And this is the section of code that determines the next available number. I think the logic here is fine, but because my edits aren't really getting applied (??) properly though the chainedOp, its not getting the right next number. //This will return the next FacilityID
public string GetNextFacilityID(FeatureClass fClass, string gridNum)
{
try
{
QueryFilter queryFilter = new QueryFilter();
queryFilter.WhereClause = "GRIDNO ='" + gridNum + "'";
queryFilter.SubFields = "SEQUENCENO";
//create an array to hold all of the SEQUENCENO; give it's first member the value zero
ArrayList idList = new ArrayList();
idList.Add(int.Parse("0"));
RowCursor rCursor = fClass.Search(queryFilter);
Feature feature;
while (rCursor.MoveNext())
{
using (feature = (Feature)rCursor.Current)
{
int sequencePosition = feature.FindField("SEQUENCENO");
idList.Add(Convert.ToInt32(feature[sequencePosition]));
}
}
//sort the list so we can get the highest value of SEQUENCENO
idList.Sort();
//the next # we want is the current highest number + 1
int number = (int)idList[idList.Count - 1] + 1;
sequenceNumber = number;
//convert it to a string so we can add the zero placeholders to the front of it....it needs to be 4 digits.
string finalNum = number.ToString();
switch (finalNum.Length)
{
case 1:
finalNum = "000" + finalNum;
break;
case 2:
finalNum = "00" + finalNum;
break;
case 3:
finalNum = "0" + finalNum;
break;
}
//return the full facility id, with the STRUCTURETYPE, GRIDNO, and SEQUENCENO
return structureType + "-" + gridNumber + "-" + finalNum;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
return null;
}
}
... View more
07-23-2019
05:37 AM
|
0
|
5
|
1790
|
|
POST
|
Hi, It seems like ArcGIS Pro will load custom tools with the same UID from the folder path in the Add-In Manager before it loads the same tool from the AddIns folder in the 'Documents' folder in your user profile. Is that correct? ArcMap has always worked opposite of this. Is there a setting that can be adjusted so that the custom tools in your AddIn folder take priority?? This is a problem, especially when making modifications to existing tools that may already be in use. For example, I deploy all my tools to a network shared drive. About 8 different Pro users connect to this folder path when they start ArcGIS Pro. But when I (the developer) need to update a tool I need to test it first. When VS finishes the 'Build' it places it in the AddIn folder, but when I start ArcGIS Pro the folder connection still exists and the same tool deployed there takes precedence over the tool I am trying to debug. Make sense?? If you have any suggestions on how to deal with this, I'd appreciate it. I know how to work around it, but it's a bit of a pain especially when you have tools on the folder path you need to use as you test the tool you are debugging. I constantly have to adjust the folder I am connecting to in order to load up the tools I am looking to use/test. Thanks,
... View more
07-19-2019
10:57 AM
|
0
|
2
|
1145
|
|
POST
|
Uma Harano, You are your team at esri are genius'!! This works really well and is way faster than using the GP tool Thanks so much for the sample code. I only had to make a slight modification to it, and it works perfectly. Gintautas Kmieliauskas, check it out. using ArcGIS.Desktop.Framework.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Catalog;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Core.Geoprocessing;
using ArcGIS.Core.CIM;
namespace SymbologyTool_ArcPro
{
/// <summary>
/// Interaction logic for wdwSymbology.xaml
/// </summary>
public partial class wdwSymbology : ProWindow
{
public wdwSymbology()
{
InitializeComponent();
}
private static async Task ModifyLayerSymbologyFromLyrFileAsync(IEnumerable<FeatureLayer> featureLayers)
{
await QueuedTask.Run(() => {
foreach (var featureLayer in featureLayers)
{
//Get the Layer Document from the lyrx file
var lyrDocFromLyrxFile = new LayerDocument(@"K:\DSM Shared\ArcMap Symbology\TEST\Editing Symbols\" + featureLayer.Name.ToString() + ".lyrx");
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//Get the renderer from the layer file
//This lyr file has a unique value renderer.
var rendererFromLayerFile = ((CIMFeatureLayer)cimLyrDoc.LayerDefinitions[0]).Renderer as CIMUniqueValueRenderer;
//Apply the renderer to the feature layer
featureLayer?.SetRenderer(rendererFromLayerFile);
}
});
}
async private void btnSymbolize_Click(object sender, RoutedEventArgs e)
{
try
{
Map map = MapView.Active.Map;
this.Cursor = Cursors.Wait;
await ModifyLayerSymbologyFromLyrFileAsync(map.GetLayersAsFlattenedList().OfType<FeatureLayer>());
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
}
finally
{
this.Cursor = Cursors.Arrow;
MessageBox.Show("DONE");
this.Close();
}
}
}
}
... View more
06-27-2019
11:48 AM
|
3
|
0
|
3211
|
|
POST
|
Sounds good. I will keep an eye out for the 2.4 update. Thanks for letting me know. I've been working with Nobbir to get the GP Tool code to work, but I'll check out this new class once it's available.
... View more
06-25-2019
05:03 AM
|
0
|
1
|
3211
|
|
POST
|
Hi Nobbir Ahmed, Another thing I am noticing is that when the symbology does take, it doesn't always show up right. After manually doing some testing, it seems like it's the optionsal "Update Symbology Ranges by Data" field that needs to be modified to "MAINTAIN" in order for the symbology to show up properly. I've added it to my Value Array, but when doing that it still only works once in a while. var mva = Geoprocessing.MakeValueArray(layer.Name.ToString(), @"K:\DSM Shared\ArcMap Symbology\TEST\Editing Symbols\" + layer.Name.ToString() + ".lyrx", null, "MAINTAIN"); Not sure if that helps or just makes things more confusing. Is there another way to accomplish updating the symbology without using the GP Tool?? In my ArcObjects code for ArcMap I do this same thing using the following code. Is there an equivalent method to this I should look at?? Do Until pLayer Is Nothing 'loop through all the layers
'create an object to refence GxLayer, an ArcCatalog layer
Dim gxLayer As IGxLayer = New GxLayerClass
Dim gxFile As IGxFile = CType(gxLayer, IGxFile)
If btnMapBooks.Checked = True Then
gxFile.Path = "K:\DSM Shared\ArcMap Symbology\10.2 Schema\Mapbook Symbols\" & pLayer.Name & ".lyr"
ElseIf btnEditing.Checked = True Then
gxFile.Path = "K:\DSM Shared\ArcMap Symbology\10.2 Schema\Editing Symbols\" & pLayer.Name & ".lyr"
ElseIf btnVLS.Checked = True Then
gxFile.Path = "K:\DSM Shared\ArcMap Symbology\10.2 Schema\VLS_Layers\" & pLayer.Name & ".lyr"
End If
If Dir$(gxFile.Path) <> "" Then
'if the .lyr file exists continue, else skip
Dim pGeoLayer As IGeoFeatureLayer
pGeoLayer = gxLayer.Layer
Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection
pAnnoLayerPropsColl = pGeoLayer.AnnotationProperties
pLayer.Renderer = pGeoLayer.Renderer
End If
bCanceled = Not pTC.Continue
'show a message box if the user hits ESC
If bCanceled Then
MsgBox("Operation Cancelled. Some layers may have been changed.", MsgBoxStyle.Critical, "User Interrupt")
Me.Cursor = Windows.Forms.Cursors.Arrow
Me.Close()
Exit Sub
End If
'go to the next layer
pLayer = pEnumLayer.Next
'increase the Progress Bar after each layer is processed
pBar.Value = pBar.Value + 1
Loop
... View more
06-21-2019
07:56 AM
|
0
|
0
|
3210
|
|
POST
|
Hi Nobbir Ahmed, I've modified your code to work with my filepaths and created a working .lyrx, but it makes no difference. Still the symbology does not apply. Also, for me the map.Redraw is not available. I am at 2.3.3. Are you using a different SDK?? Also, as Sean Jones mentioned, I have tried this with and without spaces in my filepath, but it doesn't seem to make any difference.
... View more
06-21-2019
05:57 AM
|
0
|
0
|
3210
|
|
POST
|
Hi Gintautas Kmieliauskas, Yes, I remember seeing that before, but removing and re-adding layers doesn't seem like a solution. More of a work-around to fix something that isn't working. Sean Jones: Is there a bug with ApplySymbologyFromLayer in .NET?? I just want to figure out what I need to do moving forward. Thanks,
... View more
06-20-2019
07:51 AM
|
0
|
3
|
4034
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-29-2026 07:40 AM | |
| 1 | 10-17-2023 07:40 AM | |
| 1 | 04-14-2026 08:54 AM | |
| 2 | 08-18-2023 08:57 AM | |
| 1 | 04-13-2018 10:07 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-29-2026
09:43 AM
|