POST
|
Hi @Katie_Clark - all appears to have gone well. I needed tech support with the process because one Group owned by the <oldemail> account had some settings related to editing or collaboration (generally speaking, not in the ESRI parlance of formally "Collaboration") that prohibited transferring content without some workarounds.
... View more
05-04-2023
07:53 AM
|
1
|
0
|
283
|
POST
|
Have you tried Recalculate Index from the properties of the feature layer in the TOC? Perhaps there is a programmatic way to do that, but it's a 15 second thing, then wait a minute + for the maps to refresh.
... View more
05-02-2023
03:29 PM
|
0
|
0
|
275
|
POST
|
@RhettZufelt is correct. You need this: workspaces = ['path/to/workspace1','path/to/workspace2','path/to/workspace3'] That's step 1. There are more steps after that to fix your code. If you are still needing help on this, please respond and I (we) can help you.
... View more
05-02-2023
09:57 AM
|
0
|
0
|
380
|
POST
|
Oh man! Glad somebody else noticed this issue. I haven't heard anything. I never reported the bug. If I do, I'll add a comment here. Is arcpy.da.updateCursor the culprit for you? with arcpy.da.<something>Cursor as cursor:
# do some stuff;
# I imagine it's when using da.UpdateCursor
del cursor
... View more
05-02-2023
09:37 AM
|
0
|
2
|
280
|
POST
|
That's reassuring, thanks. Some people posted issues related to my question in separate forum posts in this community who encountered problems with transferring content that had sharing of some sort. I'll give it a shot, dubious that something so easy on ESRI could be achieved without any major turn your computer off and go on a 2 hour walk to blow off steam kind of problem. TBD...
... View more
04-26-2023
01:18 PM
|
0
|
2
|
297
|
POST
|
For some reason I named my AGOL username as <oldemail>. Now that email has been replaced, and I want to change the username to something more current - <newusername>. Unfortunately changing usernames is not permitted. So I have been instructed by tech support to 1) create a new account with new name. 2) transfer content from outdated email-named account to the new account. 3) remove old account. Apologies if terminology is incorrect. This is all within one organizational account, and the members within it. My worry is...I have 3 years worth of content --> something bad will happen to some content. Let's say all the content solely contains content owned by <oldemail> user and will be transfered to <newusername> user. Does anybody envision any issues with this workflow? thanks, Zach
... View more
04-26-2023
09:05 AM
|
0
|
4
|
323
|
POST
|
Perhaps a new post is in order. Do either of you have experience defining an argument as a DETextFile or DEFile? For another Python Toolbox built on the same template you all helped me with (thanks!), I want to pass a path/to/csv as an argument. Spent the hour fleshing out, copying and pasting the .pyt. Looks good. Tool opens, but when I select (or try to select) the input csv in both the third and fourth arguments, it doesn't load - argument input box(es) stay blank. I've tried manually copying the path/to/file.csv into the argument, csv GIS attribute table in this case. Same thing. When I try running the tool I, an error is thrown about NoneType as would be expected. My first instinct is to think an ESRI bug, but I'll withhold judgement until digging. Just trying to pass a file as an argument.
... View more
04-24-2023
04:28 PM
|
0
|
1
|
997
|
POST
|
Tentatively found a solution. Any alternatives to the conditional logic: if parameters[1].value would be greatly appreciated! But it works. Code is commented to explain why I did this. def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
# This if statement required or else error message will for parameter[0]
# "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType".
# Apparently this method will run through ALL parameters right off the bat. So add
# conditional statements to ensure validation only performed on target parameters i.e. parameter[1] in this case
if parameters[1].value:
fp_csv = parameters[1].valueAsText
if os.path.exists(fp_csv):
parameters[1].setErrorMessage('output path already exists')
else:
parameters[1].clearMessage()
return Note that when an existing path/to/file.csv is passed for argument 2 (parameters[1]), the message will display:
... View more
04-12-2023
09:34 AM
|
0
|
1
|
1049
|
POST
|
Hi @Luke_Pinner - I appreciate your response. I suspected that may be the case. ESRI's documentation can be really frustrating. I scoured that link you included and all links therein prior to posting. Reread them just now and it's still really confusing. FYI - I am experienced with Object Oriented Programming and Classes. None of the links on that page show me a fleshed out implementation of parameter validation: 1) understanding-validation-in-script-tools 2) programming-a-toolvalidator-class which has instructions on constructing the ToolValidator Class, which I thought were not applicable with the Python Toolbox So! In the link you sent, they provide this example (below). But I'm confused. What is the parameters argument? I imagine that is params? And more confusingly, what is parameters[6]? if not parameters[6].altered The example preceding this has only 3 parameters, so 0,1,2 indices. def updateParameters(self, parameters):
# Set the default distance threshold to 1/100 of the larger of the width
# or height of the extent of the input features. Do not set if there is no
# input dataset yet, or the user has set a specific distance (Altered is true).
#
if parameters[0].valueAsText:
if not parameters[6].altered:
extent = arcpy.Describe(parameters[0]).extent
if extent.width > extent.height:
parameters[6].value = extent.width / 100
else:
parameters[6].value = extent.height / 100
return I'm REALLY appreciative of your help! Just confused and critical of the ESRI documentation that always seems to weave in and out of Pro vs Desktop vs whatever. Check reply below - I did solve this. It could be ugly. Suggestions welcome...
... View more
04-12-2023
08:48 AM
|
0
|
1
|
1053
|
POST
|
Fundamentally confused. I made a Python Script Toolbox with multiple tools (hopefully proper terminology): Each tool works fine, and the basic Python code/structure is as shown below. NOTE! I am only showing one of the Tools (metadata_mcm) and not update_attr or xml_element_csv_creator - but they are the same in basic structure. Skip to my questions below before diving into code. class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = "toolbox"
# List of tool classes associated with this toolbox
self.tools = [metadata_mcm, create_xml_element_csv, update_attr]
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
self.params[1].clearMessage()
if self.params[1].value is None:
self.params[1].clearMessage()
else:
if os.path.exists(self.params[1]):
self.params[1].setErrorMessage('output path already exists')
else:
self.params[1].clearMessage()
return
class create_xml_element_csv(object):
def __init__(self):
self.label = "xml element csv creator"
self.desciption = "create inventory of xml elements relevant to fields"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Input Feature",
name="fc_in",
datatype="Layer",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Path/to/file.csv",
name="fp_csv",
datatype="DEFile",
parameterType="Required",
direction="Input")
params = []
params.append(param0)
params.append(param1)
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
def execute(self, parameters, messages):
"""The source code of the tool."""
fc = parameters[0]
desc = arcpy.Describe(fc)
fp_fc = desc.featureClass.catalogPath
fp_csv = parameters[1].valueAsText
st0, st1 = os.path.splitext(fp_csv)
# csv
if st1 == '.csv':
pass
else:
fp_csv = '{}.csv'.format(fp_csv)
flds = [f.name for f in arcpy.ListFields(fp_fc)]
vals = np.column_stack([flds, [None] * len(flds), [None] * len(flds), [None] * len(flds)])
# attrdef = definition
# attrdefs = definition source
cn = ['attrlabl', 'attralias', 'attrdef', 'attrdefs']
df_fields = pd.DataFrame(vals, columns=cn)
df_fields.to_csv(fp_csv)
return I don't understand a couple things: 1) Can the ToolValidator Class work with multiple tools? It's odd that I have essentially hard-coded the paramaters positionally in updateMessages for ALL subsequent tools. I want to ensure that the output file does not exist prior to running tool. This is argument 1 for create_xml_element_csv but doesn't exist for the two other tools. So can I create a ToolValidator Class and only apply the validation to one tool in the toolbox? 2) Is my syntax within ToolValidator/updateMessages method correct? Found this syntax from a StackExchange response. The tools run BUT the validation of if os.path.exists(self.params[1]): self.params[1].setErrorMessage('output path already exists') is not being performed. I can pass an argument of a path that exists, and no warming is issued, tool overwrites the existing file. No bueno. Thanks, Zach
... View more
04-11-2023
04:09 PM
|
0
|
8
|
1287
|
POST
|
You definitely should not "physically draw [tons of] polygons", but Python will probably be necessary. You would need a table with the points for all polygons (x,y) as well as some way to identify the start and stop points for each polygon. For example, if each polygon is a rectangle/square you would have 4 vertices per polygon. So 3,000 polygons X 4 points/polygon = 12,000 points. That's your starting point. Note that every polygon does technically record the start and stop point twice, so you would have 3,000 X 5 points/ polygon = 15,000 points. If you can post a portion of your spreadsheet that would be helpful.
... View more
04-11-2023
03:01 PM
|
0
|
0
|
409
|
POST
|
I'm pretty low-maintenance, but at this point it's worth the 15 minutes to google, ESRI Forum, strike out, then create this post. How do I change the "Pinned" ( for lack of a non-Windows term) folders when opening a new project? "Open another Project" button shows this: I have no idea how these got set. I want to remove them and add new Favorites. Thanks, Zach Pro 3.0.2
... View more
03-20-2023
09:31 AM
|
0
|
0
|
143
|
POST
|
I'm confused. I got a new work email. I updated the email associated with my named user account using ArcGIS Online, and then yes, verified it. But my profile still displays [my name | old email] in the yellow box in the lower left under Users. Ditto for in my profile on AGOL, etc. Note that the account I am using now is my personal account. I cannot find a way to change that?? Seems like this should have automatically updated and/or have a simple solution.
... View more
03-06-2023
09:12 AM
|
0
|
1
|
246
|
POST
|
Dusted off a project from a few months ago. Pretty minimal interaction - fixed some broken paths in preparation to share as Project Package (ppkx). Hit Analyze and Errors emerge - "00001 Map does not have layers". The errors are not really the issue. The errors referred to maps that are NOT present in the Catalog. I cannot find them, delete them, open them via the catalog. I can click "Select Map in The Contents Pane" and the map opens up. I strongly suspect it's because upon opening the project today, I had to agree to format it for Pro 3.0.2 (my current version). This project was created and save in Ver. 2. I've never seen this before. Seems to be a bug? BTW, the maps are in the project: aprx = arcpy.mp.ArcGISProject("CURRENT")
m = [m.name for m in aprx.listMaps()]
m
# Prints 5 map names, including the two from the error message
# and the three in the catalog Help please? Zach
... View more
02-24-2023
11:59 AM
|
0
|
0
|
290
|
POST
|
I'm just responding here to be updated if this is ever resolved. Perhaps in another 4 years. My code and problem were pretty identical to original post - but moving from one gdb to another gdb with Feature Classes all of the same, exact name. Tried all the solutions offered here in the comments, to no avail. Honestly not a bad, temporary solution if your situation allows is as follows: 1) Disconnected drive or server containing path needing change 2) Open project 3) Click the red exclamation point from all the broken paths and fix the broken paths. In my case, much of the original data was on a gdb on an external hard drive. If within a Pro project on server 1a) copy it to external hard drive 2a) disconnect from server 3a) fix paths as above 4a) copy back to server / disconnect external hard drive 5a) fix paths again, setting them to desired new gdb. Screw it.
... View more
02-17-2023
10:44 AM
|
0
|
0
|
1064
|
Title | Kudos | Posted |
---|---|---|
1 | 2 weeks ago | |
1 | 02-16-2023 10:34 AM | |
1 | 03-04-2024 10:19 AM | |
1 | 02-21-2022 02:03 PM | |
1 | 09-14-2023 12:58 PM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|