IDEA
|
Problem is that Apply Symbology From Layer is pretty buggy, especially when used via python or even in model builder. Many properties such as number formatting of the feature class just don't get applied.
... View more
12-13-2020
08:32 PM
|
0
|
0
|
4295
|
POST
|
I'm thinking now that the only way to address issues like this is to export the data as layer files, hack into the layer files and then redraw the whole map. e.g. https://community.esri.com/t5/python-questions/turn-off-fields-with-python/td-p/403316 I really don't know why ESRI has such limited functionality in arcpy.
... View more
12-13-2020
06:54 PM
|
0
|
2
|
3575
|
POST
|
I think this the workaround I will have to use to do most of my Geoprocessing. So much of the functionality in Pro is just not available in arcpy but hacking into the LYRX may work and then using it to redefine my layers (numeric formatting etc)
... View more
12-13-2020
06:52 PM
|
0
|
0
|
2623
|
POST
|
Changing it to 2 in the layer file is possible, then you get 2 decimal places, e.g. { "type" : "CIMFieldDescription", "alias" : "Ld", "fieldName" : "AllData_Ld", "numberFormat" : { "type" : "CIMNumericFormat", "alignmentOption" : "esriAlignRight", "alignmentWidth" : 0, "roundingOption" : "esriRoundNumberOfDecimals", "roundingValue" : 2, "useSeparator" : true }, The layerx file is saved with the correct number of decimal places if you alter the data in Fields View manually as well but then using Apply Symbology from Layer to apply those formatting settings doesn't work. The data is back at 6 decimal places so I'm looking for a way to make the changes in the Python script. The only way to change the number formatting seems to be via Fields View - select each field, alter manually.... Not an ideal workflow when preparing multiple maps a week to upload to Portal for our users. We are generating the tables via a join to excel spreadsheets and there doesn't seem to be a way to alter the number formats when we do the join either. Even if we could modify the default formatting in Pro from 6 decimal places, no comma it would help.
... View more
12-10-2020
03:55 PM
|
0
|
1
|
3609
|
POST
|
Hi All, Is there any way set the default numeric formatting s in Arcpy for pro? I am using ArcPro 2.4.0 I have a number of layers in a map that I am preparing for sharing into Portal and we wish to format the number of decimal places and enable/disable the thousands separators I am using .LRYX files to style the features and this is set in the layer file e.g.: { "type" : "CIMFieldDescription", "alias" : "SVCurr", "fieldName" : "AllData_SVCurr", "numberFormat" : { "type" : "CIMNumericFormat", "alignmentOption" : "esriAlignRight", "alignmentWidth" : 0, "roundingOption" : "esriRoundNumberOfDecimals", "roundingValue" : 0, "useSeparator" : true }, but it does not seem to be reading the layer file for this setting ( I am running Apply Symbology from Layer) https://pro.arcgis.com/en/pro-app/tool-reference/data-management/alter-field-properties.htm does not seem to have these options Thanks in advance.
... View more
12-09-2020
07:12 PM
|
1
|
13
|
4423
|
POST
|
Hi All, Is there any way to enable/disable popups in Arcpy for pro? I am using ArcPro 2.4.0 I have a number of layers in a map that I am preparing for sharing into Portal and we wish to turn off popups for some and enable them for others. I am using .LRYX files to style the features and popups are disabled in the layer file ( "htmlPopupEnabled" : false, & "showPopups" : false, ) but it does not seem to be reading the layer file for this setting ( I am running Apply Symbology from Layer) Thanks in advance.
... View more
12-09-2020
06:42 PM
|
0
|
1
|
959
|
POST
|
Nothing here https://pro.arcgis.com/en/pro-app/arcpy/classes/alphabetical-list-of-arcpy-classes.htm or here https://pro.arcgis.com/en/pro-app/arcpy/functions/alphabetical-list-of-arcpy-functions.htm so It looks like it's not available for Pro either
... View more
12-07-2020
06:56 PM
|
0
|
0
|
3436
|
POST
|
Did you ever get a solution to running the model in Python itself? I'm trying to get a Python Toolbox up and running and ApplySymbologyFromLayer isn't working from the Python toolbox but works from a Model so I'm trying that until there is a bug fix from ESRI I'm trying -> arcpy.ImportToolbox(r"C:\\Data\\7A_MAPPING\\StyleFeaturesModels.tbx") but the compiler doesn't seem to recognise it.
... View more
12-03-2020
04:48 PM
|
0
|
0
|
520
|
IDEA
|
This is an excellent idea - particularly when using existing .lyrx files to symbolise layers. Users need to see if their existing symbology ranges apply to a newer dataset. This functionality is also standard in Mapinfo and would make the transition for mapinfo users to ESRI more viable.
... View more
12-02-2020
06:12 PM
|
0
|
0
|
4174
|
POST
|
Have you tried moveLayer (https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm). I'm trying to use the command in a Python toolbox at the moment, not sure if it's working but that seems to be the command to use
... View more
11-26-2020
08:21 PM
|
0
|
0
|
4055
|
POST
|
ArcGIS Pro version 2.4.0 I have a Python Toolbox script to reorder the layers in my Current Map as follows: currentProject = arcpy.mp.ArcGISProject("CURRENT")
currentMap = currentProject.listMaps()[0] # this assumes one map
layers = currentMap.listLayers()
#LGA the very bottom
SPATIALDATA_LYR= currentMap.listLayers('SPATIALDATA_LYR')[0]
LGA_LYR= currentMap.listLayers('LGA_LYR')[0]
currentMap.moveLayer(SPATIALDATA_LYR,LGA_LYR,"AFTER") # LGA below Spatial
#Property
SPATIALDATA_LYR= currentMap.listLayers('SPATIALDATA_LYR')[0]
PROPERTY_LYR= currentMap.listLayers('PROPERTY_LYR')[0]
currentMap.moveLayer(SPATIALDATA_LYR,PROPERTY_LYR,"AFTER") #Prop below spatial
# 13 UGB_LYR All UGB line work that overlaps the LGA Layer
SPATIALDATA_LYR= currentMap.listLayers('SPATIALDATA_LYR')[0]
UGB_LYR = currentMap.listLayers('UGB_LYR')[0]
currentMap.moveLayer(SPATIALDATA_LYR,UGB_LYR,"BEFORE") #above
# 12 HERITAGE_LYR Join between SPATIALDATA and excel HEADERS
SPATIALDATA_LYR= currentMap.listLayers('SPATIALDATA_LYR')[0]
HERITAGE_LYR = currentMap.listLayers('HERITAGE_LYR')[0]
currentMap.moveLayer(SPATIALDATA_LYR,HERITAGE_LYR,"BEFORE") #above
# 11 TOP_10_LYR Top 10 Sales
SPATIALDATA_LYR= currentMap.listLayers('SPATIALDATA_LYR')[0]
TOP_10_LYR = currentMap.listLayers('TOP_10_LYR')[0]
currentMap.moveLayer(SPATIALDATA_LYR,TOP_10_LYR,"BEFORE") #above return The Layers are being moved but the results seem to be quite random and the order in my debugging doesn't match the order shown in the Drawing Order pane
... View more
11-26-2020
05:21 PM
|
0
|
6
|
2282
|
POST
|
I can't answer the specific question but have a look in C:\Program Files\ArcGIS\Pro\Resources\ArcToolBox\Toolboxes\ where I think there may be examples of Python Toolboxes that run other tools.
... View more
11-25-2020
11:13 PM
|
0
|
0
|
694
|
POST
|
I finally worked out how to do it a Python Toolbox, here's an example: In Init: # Spatial Data Layer param0 = arcpy.Parameter( displayName="Spatial Data Layer (SPATIALDATA_LYR)", name ="SPATIALDATA_LYR", datatype="GPFeatureLayer", parameterType="Derived", direction="Output") param0.value = "SPATIALDATA_LYR" # SMG (line) Layer param1 = arcpy.Parameter( displayName="SMG_LINE_LYR", name ="SMG_LINE_LYR", datatype="GPFeatureLayer", parameterType="Derived", direction="Output") param1.value = "SMG_LINE_LYR" ……... def execute(self, parameters, messages): """The source code of the tool.""" arcpy.env.overwriteOutput=True # Script arguments SPATIALDATA_LYR=parameters[0].valueAsText SMG_LINE_LYR= parameters[1].valueAsText ….. #LYRX File vars SPATIALDATA_LYRX =os.path.join(SEVENA_LYRX_DIR, "SPATIALDATA.lyrx") SMG_LYRX =os.path.join(SEVENA_LYRX_DIR, "SMG_NAME.lyrx") …... arcpy.management.ApplySymbologyFromLayer(SPATIALDATA_LYR, SPATIALDATA_LYRX) arcpy.SetParameterAsText(0, SPATIALDATA_LYR) #<--------------this!!! # SMG Line - getParameterInfo incl value, symb as os.path.join arcpy.management.ApplySymbologyFromLayer(SMG_LINE_LYR, SMG_LYRX, None, "UPDATE") arcpy.SetParameterAsText(1, SMG_LINE_LYR) I have no idea why setting the parameter again makes it work, but it works.
... View more
08-17-2020
12:38 AM
|
0
|
0
|
1340
|
POST
|
Mark Binder - I finally worked out how to do it a Python Toolbox, here's an example: In Init: # Spatial Data Layer param0 = arcpy.Parameter( displayName="Spatial Data Layer (SPATIALDATA_LYR)", name ="SPATIALDATA_LYR", datatype="GPFeatureLayer", parameterType="Derived", direction="Output") param0.value = "SPATIALDATA_LYR" # SMG (line) Layer param1 = arcpy.Parameter( displayName="SMG_LINE_LYR", name ="SMG_LINE_LYR", datatype="GPFeatureLayer", parameterType="Derived", direction="Output") param1.value = "SMG_LINE_LYR" ……... def execute(self, parameters, messages): """The source code of the tool.""" arcpy.env.overwriteOutput=True # Script arguments SPATIALDATA_LYR=parameters[0].valueAsText SMG_LINE_LYR= parameters[1].valueAsText ….. #LYRX File vars SPATIALDATA_LYRX =os.path.join(SEVENA_LYRX_DIR, "SPATIALDATA.lyrx") SMG_LYRX =os.path.join(SEVENA_LYRX_DIR, "SMG_NAME.lyrx") …... arcpy.management.ApplySymbologyFromLayer(SPATIALDATA_LYR, SPATIALDATA_LYRX) arcpy.SetParameterAsText(0, SPATIALDATA_LYR) #<--------------THIS!!! # SMG Line - getParameterInfo incl value, symb as os.path.join arcpy.management.ApplySymbologyFromLayer(SMG_LINE_LYR, SMG_LYRX, None, "UPDATE") arcpy.SetParameterAsText(1, SMG_LINE_LYR) I have no idea why setting the parameter again makes it work, but it works.
... View more
08-17-2020
12:36 AM
|
0
|
0
|
670
|
POST
|
I've worked out how to get around BUG-000119907: The Apply Symbology From Layer tool does not work if.. # Spatial Data Layer param0 = arcpy.Parameter( displayName="Spatial Data Layer (SPATIALDATA_LYR)", name ="SPATIALDATA_LYR", datatype="GPFeatureLayer", parameterType="Derived", direction="Output") param0.value = "SPATIALDATA_LYR" in the execute bit: arcpy.management.ApplySymbologyFromLayer(SPATIALDATA_LYR, SPATIALDATA_LYRX) arcpy.SetParameterAsText(0, SPATIALDATA_LYR)
... View more
08-17-2020
12:25 AM
|
0
|
0
|
1166
|
Title | Kudos | Posted |
---|---|---|
1 | 11-25-2021 08:36 PM | |
1 | 10-18-2021 04:51 PM | |
1 | 11-28-2021 04:15 PM | |
1 | 11-29-2021 05:00 PM | |
1 | 12-09-2020 07:12 PM |
Online Status |
Offline
|
Date Last Visited |
07-25-2022
12:39 AM
|