POST
|
Hi EricG, It depends on the context. I think what you are saying is that you have a dataset that has a geoid field and want to do this: -- Add a TRACT field to the dataset. -- Set the tract field to the last 6 characters of the geoid. Again without more context, it's difficult to guide you on the details, but assuming you're talking about a field in a dataset that is iterable with a cursor, you could do something like this: import arcpy
arcpy.env.workspace = "C:/mydatapath.gdb" # modify to reflect your workspace
theData = "/mydata" # modify to dataset with a geo_id column
theGEOIDfield = "GEOID" # modify to geo id column name
arcpy.management.AddField(theData, "TRACT", "TEXT")
with arcpy.da.UpdateCursor(theData, [theGEOIDfield, "TRACT"]) as uc:
for row in uc:
row[1] = row[0][-6:] # Set TRACT to the last 6 digits of the GEOID.
uc.updateRow(row) # Commit the change.
del uc
... View more
05-04-2023
01:31 PM
|
0
|
1
|
635
|
POST
|
Thank you for the reply, @ChristopherAllen. I look forward to exploring "arcpy.charts", not to be confused with the old-fashioned "arcpy.Chart" class.
... View more
04-28-2023
03:42 AM
|
1
|
0
|
711
|
POST
|
For the record, they solved this problem in later versions of ArcGIS Pro. I just tested the same forward slash example in 2.8 and it works. d2 = "C:/gispy/data/ch02/park.shp"
proj = arcpy.mp.ArcGISProject("CURRENT")
m = proj.listMaps()[0]
m.addDataFromPath(d2)
... View more
04-28-2023
03:32 AM
|
0
|
0
|
556
|
POST
|
I'm having the same problem with an ESRI GRID raster, except I'm trying it from a stand-alone script (not the "CURRENT" project).
... View more
11-19-2022
08:54 AM
|
0
|
0
|
919
|
POST
|
Yes, it wastes my time, as I have to go through this every time the machine is restarted and some other times when it just stops working for no reason that I can detect. I hope to find a better solution.
... View more
11-19-2022
08:53 AM
|
0
|
0
|
1822
|
POST
|
Thank you to everyone who replied. I got it working. For the purposes of this description, I will say the user that runs the process is "batch_runner". Here's what I did: 1) Log in to the server machine as batch_runner. (This was a bottleneck for a while, but had nothing to do with ArcGIS) and download a single user license file executable. 2) Run the single user license file and when prompted, oog in to ArcGIS Pro as a named user with my own account credentials. 3) Switch ArcGIS Pro to a single user license (in that log in session) a) Select "Configure your licensing options". b) Change the License Type to "Single Use License". c) Click Authorize and follow the steps in the Software Authorization Wizard. Click Ok. d) Restart ArcGIS Pro. 4) Et voila! It worked. 🙂 I believe this created a profile under batch_runner, because after this, it could run the arcpy processes. I am still trying to find out what I'll need to renew the license which will expire in July. But at least it's working for the moment. Thank you for all the responses and helpful information!
... View more
10-17-2022
07:33 PM
|
1
|
0
|
1900
|
POST
|
Hi Chintakandel, I can run as administrator. Can you tell me which system tools are involved?
... View more
09-12-2022
02:22 PM
|
0
|
0
|
2620
|
POST
|
Hi, Thank you for posting this information. I tried to follow this procedure, but perhaps when you said "Task Manager", you meant "Task Scheduler"? The Task Manager doesn't have an Action option, but the Scheduler does. It looks like this solution will not work for me, as I'm not triggering the script through a scheduled task.
... View more
09-12-2022
02:19 PM
|
0
|
0
|
2621
|
POST
|
Though related, my target functionality is a bit different from what is posted here. I'm not triggering the run from a Task Manager. It's triggered by PHP code. I can't figure out what the equivalent of setting the task manager's privileges would be.
... View more
09-09-2022
11:18 AM
|
0
|
2
|
2630
|
POST
|
Thanks, our IT is setting up such an account. I hope it works. I'll post again either way.
... View more
09-08-2022
07:10 AM
|
0
|
0
|
2637
|
POST
|
Hi RickMomsen1, I'm facing a similar issue and your setup sounds similar to ours. It's a server machine that needs to trigger some Python scripts. But I'm not sure what you mean by "service account". Does that require a special kind of license?
... View more
09-08-2022
05:43 AM
|
0
|
1
|
6958
|
POST
|
Hi all, I see the date/size info is now there. But I landed on this conversation because I was looking for how to make it possible to see Python (.py) file types in the catalog pane. That used to be a Customize option for ArcCatalog too. Do you know if it's possible to do that in Pro?
... View more
08-24-2022
04:40 AM
|
0
|
0
|
487
|
POST
|
Okay, thanks. Your suggestions gave me some ideas that eventually led me to the solution. My first 2 tries were failures: 1) c = arcpy.Chart("chart1", rotated = True) gave me the following error: TypeError Traceback (most recent call last)
In [25]:
Line 1: c = arcpy.Chart("chart1", rotated=True)
TypeError: __init__() got an unexpected keyword argument 'rotated' (BTW, I also tested using rotate = True in case it's a typo in the documentation) But I guess the keyword arguments only work if you are calling it on the Bar chart object. 2) I added a c.updateChart() before the last line and got this exception: Exception Traceback (most recent call last)
In [28]:
Line 15: c.updateChart()
File c:\program files\arcgis\pro\Resources\arcpy\arcpy\_chart.py, in updateChart:
Line 522: return convertArcObjectToPythonObject(self._arc_object.updateChart(*gp_fixargs((), True)))
Exception: Invalid layer or table.
--------------------------------------------------------------------------- 3) Here's what worked: After setting type to bar, set the bar chart object to rotated (c.bar.rotated = True) c = arcpy.Chart("chart1")
c.title = "Land cover in Gettysburg Battlefield"
c.type = "bar"
c.bar.rotated = True # Rotated is a bar property, not a chart property.
c.xAxis.field = "COVER"
c.bar.aggregation = "COUNT"
c.xAxis.title = "Land cover"
c.yAxis.title = "Number of polygons"
prj = arcpy.mp.ArcGISProject("CURRENT")
mxd = prj.listMaps()[0]
thelayer = mxd.listLayers()[0]
c.dataSource = thelayer
c Bottom line? rotated is a bar property, not a chart property (since not all chart types can be rotated). This was confusing since all the other properties I used are both chart and bar properties. By the way, I tried code similar to that example at the bottom of the page and got an error. This code generated the error you see below it. bar = arcpy.chart.Bar(x="COVER",
aggregation="COUNT",
title="Land cover in Gettysburg Battlefield",
xTitle = "Land cover",
yTitle = "Number of polygons",
rotated=True,
dataSource=theLayer)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
In [42]:
Line 6: bar = arcpy.chart.Bar(x="COVER",
AttributeError: module 'arcpy' has no attribute 'chart'
---------------------------------------------------------------------------
... View more
01-07-2022
11:08 AM
|
0
|
2
|
1038
|
POST
|
Based on my understanding, setting the rotated property of a bar chart to True should draw the bars horizontally. Adding c.rotated to the code below still generates verticle bars. Is this functionality broken? c = arcpy.Chart("chart1")
c.title = "Land cover in Gettysburg Battlefield"
c.rotated = True
c.type = "bar"
c.xAxis.field = "COVER"
c.bar.aggregation = "COUNT"
c.xAxis.title = "Land cover"
c.yAxis.title = "Number of polygons"
prj = arcpy.mp.ArcGISProject("CURRENT")
mxd = prj.listMaps()[0]
thelayer = mxd.listLayers()[0]
c.dataSource = thelayer
c Here's the chart From this documentation page, here's the description of the bar chart rotated property: Indicates whether the chart is viewed vertically or horizontally. The chart displays vertically by default. True rotates the chart horizontally. False displays the chart vertically.
... View more
01-07-2022
10:01 AM
|
0
|
4
|
1059
|
POST
|
Good find! Probably the same underlying issue though. This begs a few questions...This was submitted 14 years ago and the status is "Not in Current Product Plan"? What could this mean? Maybe a new bug report needs to be submitted. Can any old shmo create a bug report? Were they really working on ArcGIS Pro in 2006? Forward slashes have never been a problem before in Desktop, why start now?
... View more
11-25-2020
06:43 PM
|
0
|
2
|
1469
|
Title | Kudos | Posted |
---|---|---|
1 | 04-28-2023 03:42 AM | |
1 | 10-17-2022 07:33 PM | |
6 | 07-19-2020 10:19 AM |
Online Status |
Offline
|
Date Last Visited |
05-12-2023
05:58 AM
|