|
POST
|
I'm not sure why this isn't working correctly. I want to export the layouts of the APRX files I have in a folder as PDFs and save them in the same place. It will run with no errors but there is no PDF saved in the outfolder. There is, however, one PDF saved one place back in the path. import arcpy, os
rootDir = r"path\to\TestFolder"
outfolder = r"path\to\TestFolder"
for dirName, subdirList, fileList in os.walk(rootDir):
for file in fileList:
if file.endswith(".aprx"):
current_aprx = arcpy.mp.ArcGISProject(os.path.join(rootDir, file))
pdf_name = os.path.join(outfolder, file[:-4])+".pdf"
for lyts in current_aprx.listLayouts():
lyts.exportToPDF(outfolder)
print("exporting APRX to PDF: {}".format(pdf_name))
del file Here's the print statements in the Interpreter window: exporting APRX to PDF: path\to\TestFolder2\MUNICIPAL_LIMITS_A - Copy..pdf
exporting APRX to PDF: path\to\TestFolder2\MUNICIPAL_LIMITS_A..pdf
... View more
01-25-2019
02:47 PM
|
0
|
3
|
2778
|
|
POST
|
Thanks for the help. Apologies if I wasn't too clear. I wanted to list any and all projects (APRXs) in a folder. Sometimes spelling it out answers your own question. It looks like you can use the same environment variable as you would with ArcPy in ArcMap. This worked: ws = arcpy.env.workspace = r"path\to\folder" Whole thing: import arcpy, os
ws = arcpy.env.workspace = r"path\to\folder"
#list the APRXs of the workspace folder
for root, dirs, files, in os.walk(ws):
for f in files:
if f.endswith(".aprx"):
print("current project being checked is " + f)
... View more
01-23-2019
12:25 PM
|
0
|
0
|
6351
|
|
POST
|
I'm in the process of migrating my stand-alone python scripts from ArcMap to ArcGIS Pro. Using PyScripter as an IDE, I was able to successfully set up my environment. I'm using Python 3.6.2 that came with Pro 2.1. I want to simply list the files in the workspace folder. Line 3 causes an OSError. import arcpy, os
aprx = arcpy.mp.ArcGISProject(r"Path\to\folder")
#list the APRXs of the workspace folder
for root, dirs, files, in os.walk(aprx):
for f in files:
if f.endswith(".aprx"):
mxd = arcpy.mp.ArcGISProject(os.path.join(root, f))
print("current map being checked is " + f)
How do I create a variable for the workspace folder for Pro? Here's how I would've done it for ArcMap: ws = arcpy.env.workspace = r'path\to\folder'
... View more
01-23-2019
11:44 AM
|
0
|
3
|
6553
|
|
POST
|
Leon, Thanks for that. I'm looking for a way to include text/highway number inside the shield in Pro? This was something you could do pretty easily in ArcMap.
... View more
01-17-2019
08:21 AM
|
1
|
1
|
12238
|
|
POST
|
https://webapp.willcountyillinois.com/gisweb/crowdsource/index.html My office has tasked me with modifying the crowdsource storymap even though it's was depreciated last year. I'm having a lot of trouble hosting it on our server. It won't get past the splash page and there are a few errors in the console. I need to get the app up before I even begin to do the modifications. All I've done so far was use the appID (b1efb597739840bf9f89140a45f4da23) from an old Crowdsource Storymap Web Mapping Application of ours. Then I downloaded the sourcecode from GitHub and deployed it with the appID entered in the index.html file. And since I can't get much help with this I'm not sure what's wrong with it. If I create a current Story Map and run through the same process I can host it with no problems. But, I'm stuck trying to revive this old one.
... View more
01-04-2019
07:52 AM
|
0
|
0
|
554
|
|
POST
|
Justin, Yes, those five lines are not pasted. I did run the entire script. Now I'm getting an HTTPError. RuntimeError: HTTPError: this service url encountered an HTTP Error: The HTTPError happens when I include the token at the end of the feat_layer_url. And there doesn't seem to be a problem with the URL. It works fine when I put it in the browser window(s). If I remove the token I get a RuntimeError on line 22. RuntimeError:
This operation is not supported.
Unable to update the features.
This operation is not supported.
(Error Code: 400)
... View more
12-31-2018
08:22 AM
|
0
|
0
|
4243
|
|
POST
|
Here's how the script looks; minus the correct URL. #get the feature layer from the feature layer URL
feat_layer_url = r'https://services.arcgis.com...'
feat_layer = FeatureLayer(feat_layer_url)
# query/get a list of features from the feature layer:
# an empty query string will return all the features or the first 1000 which ever is smaller
existing_feats = feat_layer.query()
#loop through the features and update an attribute value in each
for feat in existing_feats:
#create a copy of the feature
#this will be used to update the current feature in the Feature Layer after editing
edit_feat = feat
#here is where the changes are made to the attribute value
#use any Python string mehtods you need, i.e.. replace() or slice, to update the field value
ptname = feat.attributes['Photo']
newptname = ptname.replace('http://www.willcogis.org/website2014/gis/images/harrahs.png', 'https://webapp.willcountyillinois.com/gisweb/images/cretelibrary.png')
edit_feat.attributes['Photo'] = newptname
# use the changed copy of the feature to update the attributes of the current feature
feat_layer.edit_features(updates=[edit_feat])
print('finished')
... View more
12-28-2018
02:18 PM
|
0
|
2
|
4243
|
|
POST
|
My mistake, I wasn't the originator of that Feature Layer. I couldn't edit it in AGOL either. So, I added a copy and ran the script on it. Now I'm getting a NameError. NameError: name 'FeatureLayer' is not defined But, here's how I have it: feat_layer = FeatureLayer(feat_layer_url) And the feat_layer_url is the new URL, which is valid.
... View more
12-28-2018
12:54 PM
|
1
|
4
|
4243
|
|
POST
|
Justin, Thanks. I've been attempting your code. It seems as though it almost ran. But there was an error of sorts, something about 'no permission'. {'addResults': [],
'deleteResults': [],
'updateResults': [{'error': {'code': 1009,
'description': 'No permission to edit the specified feature.'},
'globalId': None,
'objectId': 52,
'success': False,
'uniqueId': 52}]}
... View more
12-28-2018
08:27 AM
|
0
|
6
|
4243
|
|
POST
|
Xander, Yes, I have a single hosted feature layer with 2 fields and 100+ records. Ok, good to know. Thanks.
... View more
12-28-2018
07:02 AM
|
0
|
1
|
818
|
|
POST
|
Will County Attractions I have an app that works as it should in Chrome and IE. In FireFox it doesn't. The error in the console is pointing to a specific line (line 2:15 here) of the html: attTypeSelect.addEventListener("change", function () {
var type = event.target.value;
setattractionsDefinitionExpression(type);
}); Here's what is (or isn't) happening: When you choose a Type from the dropdown menu it will not populate on the map.
... View more
12-27-2018
02:04 PM
|
0
|
2
|
4988
|
|
POST
|
I'm looking for a way to change the file path of 100+ fields in a table of a feature layer. I have Jupyter Notebook installed. I'm guessing it can be done with Python? I'm pretty familiar with arcpy, but I've never used python inside AGOL before. We recently set up a new server. This 'Attractions' layer (below) has pop-ups and in the pop-ups are links to images. But the file path to these images is to the old server. I want to use python to replace this old path with the updated one.
... View more
12-19-2018
08:17 AM
|
0
|
11
|
5407
|
|
POST
|
How would I create a list from a handful of images in a folder? I need the full file path to each one included. For example, Image files: C:\data\images\image.jpeg C:\data\images\image.jpeg2 C:\data\images\image.jpeg3 How do I avoid using the full path for each element: list = [r'C:\data\images\image.jpeg', r'C:\data\images\image.jpeg2', r'C:\data\images\image.jpeg3']
... View more
12-14-2018
01:29 PM
|
0
|
1
|
1710
|
|
POST
|
Robert, Does it matter where proxy.ashx lives? Where does it normally go?
... View more
12-13-2018
06:56 AM
|
0
|
1
|
1456
|
|
POST
|
I was able to set up a proxy. I set it up on the same server that's hosting the apps. I tested that it's installed and that it is able to forward requests directly in the browser. I've been using the Guide and the README file. For the last step, I added the following to an app: require(["esri/config"], function(esriConfig) {
esriConfig.request.proxyUrl = "";
}); I'm not sure what to put as the url.
... View more
12-11-2018
02:23 PM
|
0
|
3
|
1658
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | a month ago | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM | |
| 1 | 11-12-2025 08:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|