|
POST
|
In order for the task to run (when you're logged off) you need to right-click on Pro, run as different user, use the logon for the service account running the task, log that service account into AGOL (Portals). This is significantly different than how to run a schedule python task in the ArcMap world, which only required a headless account baked into the py script to be able to interact with AGOL, and one I hope ESRI changes soon, as this hokey workaround is not sustainable. https://community.esri.com/thread/221292-python-script-as-sheduled-task-arcgis-pro https://community.esri.com/thread/197493-python-3x-scheduled-task-fails From https://pro.arcgis.com/en/pro-app/arcpy/get-started/installing-python-for-arcgis-pro.htm Authorizing Python outside the application If you run Python scripts that use ArcGIS Pro functionality outside of the ArcGIS Pro application, such as a Python IDE, from a command prompt, or running scripts through scheduled tasks, one of the following conditions must be true: Sign me in automatically is checked when signing in to ArcGIS Pro. ArcGIS Pro is currently open. ArcGIS Pro has been authorized to work offline. is false, as, in meeting "ArcGIS Pro has been authorized to work offline." and "Sign me in automatically is checked when signing in to ArcGIS Pro.", the scheduled task fails unless Pro is "ArcGIS Pro is currently open.", which means all three conditions must be met, not just one.
... View more
07-16-2019
09:27 AM
|
3
|
0
|
9141
|
|
POST
|
With SQL, yes, the domain service account running the server needs to have permissions to the DB.
... View more
07-16-2019
06:48 AM
|
1
|
0
|
3423
|
|
POST
|
I might be missing the Captain Obvious here...I did: import arcpy import random in_point = arcpy.GetParameterAsText(0) def radarBufferPoint(in_point, num_vertices, distance, spread=0.3, seed=None, srid=None): random.seed(seed) if num_vertices > 360: num_vertices = 360 if not isinstance(in_point, arcpy.PointGeometry): in_point = arcpy.PointGeometry(in_point, arcpy.SpatialReference(srid)) pts = [ in_point.pointFromAngleAndDistance( angle, random.uniform((1-spread)*distance, (1+spread)*distance) ) for angle in range(0, 360, 360/num_vertices) ] pg = arcpy.Polygon( arcpy.Array([pt.firstPoint for pt in pts]), in_point.spatialReference ) return pg and...nothing.. I suspect I need a few more code blocks, but I can't even write a python print statement without help from Dan Patterson
... View more
07-15-2019
01:16 PM
|
0
|
3
|
2357
|
|
POST
|
I'm well aware of the random point tool....I have many points for which I need to create an irregular, random-shaped buffer around each point. No requirements on the buffer other than it can't be a perfect geometric shape (square, circle, rectangle, etc...). More like a mutated starfish.
... View more
07-15-2019
10:58 AM
|
0
|
6
|
2797
|
|
IDEA
|
As a workaround, this will add users from multiple groups to a PTL group. Run nightly as a scheduled task. import subprocess
import os, sys, string, calendar, datetime, traceback, smtplib
import csv
from os import listdir
from os.path import isfile, join
from arcgis.gis import GIS
import itertools
from collections import Counter
import arcpy
from arcpy import env
# Use this script when you need to add members of multiple AD groups to one or more PTL groups
# All scripts and files should read/write to the same directory
##########################
#Begin variables
ptl ="https://portal.com/portal"
#Coded to work with headless account
# Additional parameters will need to be defined to use enterprise account or token
user = "bigfoot"
passw = "sasquatch!"
workdir = 'C:\PRODUCTION\PTL_GROUPS\IANDM'
# List of PTL Groups that will include members of the multiple AD groups lists in adgroups.txt
ptllist = ['GRSM IandM Map Editors','GRSM IandM Workspace','GRSM Vital Signs Editors','GRSM Vital Signs Workspace','GRSM Wetlands Editors','GRSM Wetlands Workspace','GRSM Sochan Workspace']
# a text file titled "adgroups.txt" containing the name of multiple AD groups (one per line, no delimiters or
# seperators) is required to be in the workdir
# Output file containing UPN of AD members from the groups listed in adgroups.txt
admembers = 'GRSM_IANDM_USERS.csv'
# Define log setting
try:
d = datetime.datetime.now()
log = open("C:\PYTHON_LOGS\\iandmLOG."+admembers+".txt","a")
log.write("----------------------------" + "\n")
log.write("----------------------------" + "\n")
log.write("Log: " + str(d) + "\n")
log.write("\n")
# Start process...
starttime = datetime.datetime.now()
log.write("Begin process:\n")
log.write(" Process started at " + str(starttime) + "\n")
log.write("\n")
### Start setting variables
# Mail Server Settings
SERVER = "mail.server"
PORT = "25"
FROM = "me"
MAILDOMAIN = '@portal.com'
# Data Steward getting the email. Needs to be their email address...without @nps.gov at the end
userList=["the_man"]
# get a list of usernames from the list of named tuples returned from ListUsers
userNames = [u for u in userList]
# take the userNames list and make email addresses by appending the appropriate suffix.
emailList = [name + MAILDOMAIN for name in userNames]
TO = emailList
# Grab date for the email
DATE = d
#End variables
##########################
try:
os.remove(admembers)# Remove AD names list if it exists
except OSError:
pass
#PS command to get members of ad group(s)
command = '$groups = Get-Content '+workdir+'\\adgroups.txt ;foreach($Group in $Groups) {Get-ADGroupMember -Id $Group | \
Where { $_.objectClass -eq "user" }|%{Get-ADUser $_.SamAccountName | select UserPrincipalName} | Export-CSV '+workdir+'\\'+admembers+' \
-NoTypeInformation -append}'
process=subprocess.Popen(['powershell',command],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
out, err = process.communicate()
print(process.returncode, out, err)
#Remove any special charactes, including quotes, from AD names list
input_file = workdir+'\\'+admembers
chars = '$%^*"_\n' # etc notice the \n (linefeed)
with open(input_file) as f:
lines = [x.strip(chars) for x in f]
with open(input_file,"w") as f:
f.writelines("{}\n".format(x) for x in lines)
#Initialize GIS connection to PTL
gis = GIS(ptl, user, passw)
#Loop through all PTL groups and do the following:
for item in ptllist:
#Get PTL group name
group = gis.groups.search('title: "'+item+'"', '')
print(group)
#Add AD users to PTL group
readCSV = list(csv.reader(open(workdir+'\\'+admembers)))
for row in readCSV:
group[0].add_users(row)
else:
print ('done')
#Get list of all members in PTL group
members = group[0].get_members()
members_list = members['users']
#Get list of authorized members in PTL group
allowed_list = list(itertools.chain(*readCSV))
#Figure out who doesn't belong
c1 = Counter(allowed_list)
c2 = Counter(members_list)
diff = list((c2 - c1).elements())
#Remove unauthorized group members
for j in diff:
group[0].remove_users([str(j)])
# Write nothing to log if success.
endtime = datetime.datetime.now()
log.write(" Completed successfully in "
+ str(endtime - starttime) + "\n")
log.write("\n")
log.close()
######################################################################
#Delete below if not want email on success
#Define email message if success
## SUBJECT = "Notification of Successful Update of "+str(ptllist)
## MSG = "Finished updating:"+str(ptllist)+" at "+ str(DATE)
## print (MSG)
## print (emailList)
##
## # Send an email notifying steward of successful archive
## #MESSAGE = "\ From: %s To: %s Subject: %s %s" % (FROM, ", ".join(TO), SUBJECT, MSG)
## MESSAGE = "Subject: %s\n\n%s" % (SUBJECT, MSG)
## try:
## try:
## print("Connecting to Server...")
## server = smtplib.SMTP(SERVER,PORT)
## try:
## print("Login...")
## try:
## print("Sending mail...")
## server.sendmail(FROM, TO, MESSAGE)
## except Exception as e:
## print("Send Error Mail\n" + e.message)
## except Exception as e:
## print("Error Authentication Server: check the credentials \n" + e.message)
## except Exception as e:
## print("Error Connecting to Server : check the URL of the server and communications port ( 25 and ' the default ) \n" + e.message)
##
## print("Quit.")
## server.quit()
##
## except Exception as e:
## print (e.message)
#Delete above if not want email on success
######################################################################
# Something with wrong
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate information together concerning
# the error into a message string
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
# Return python error messages for use in
# script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
# Print Python error messages for use in
# Python / Python Window
log.write("" + pymsg + "\n")
log.write("" + msgs + "")
log.close()
# Define email message if something went wrong
SUBJECT = "Notification of Un-Successful Update of "+str(ptllist)
MSG = "This horrible thing happend:"+ str(DATE)+ "; " +pymsg + "; " + msgs
print (MSG)
print (emailList)
# Send an email notifying steward of successful archive
#MESSAGE = "\ From: %s To: %s Subject: %s %s" % (FROM, ", ".join(TO), SUBJECT, MSG)
MESSAGE = "Subject: %s\n\n%s" % (SUBJECT, MSG)
try:
try:
print("Connecting to Server...")
server = smtplib.SMTP(SERVER,PORT)
try:
print("Login...")
try:
print("Sending mail...")
server.sendmail(FROM, TO, MESSAGE)
except Exception as e:
print("Send Error Mail\n" + e.message)
except Exception as e:
print("Error Authentication Server: check the credentials \n" + e.message)
except Exception as e:
print("Error Connecting to Server : check the URL of the server and communications port ( 25 and ' the default ) \n" + e.message)
print("Quit.")
server.quit()
except Exception as e:
print (e.message)
... View more
07-15-2019
10:17 AM
|
0
|
0
|
3636
|
|
POST
|
Sadly, the Magnetic Calculator (which includes the drift component) is not supported in Pro, and the lack of "In Product Plan" status is discouraging: https://community.esri.com/ideas/14394-pro-add-the-magnetic-calculator-tool However, I'm curious as to how you're making this a dynamic text element in Arc Map (if you are). If you're ambitious you can try https://github.com/cayetanobv/declinationmap/blob/master/declinationmap/decmap.py
... View more
07-15-2019
08:57 AM
|
0
|
3
|
1830
|
|
POST
|
Is your certificate signed by a CA? Pretty sure you're having SSL errors, best solution is to call tech support.
... View more
07-15-2019
05:34 AM
|
0
|
0
|
4794
|
|
POST
|
sddraft.overwriteExistingService = True Is your service in a "folder" on the GIS Server? Is it stand-alone or federated?
... View more
07-15-2019
05:27 AM
|
1
|
1
|
2123
|
|
POST
|
https://community.esri.com/docs/DOC-13504-sasquatchs-annual-what-computer-should-i-buy-for-pro-recommendations
... View more
07-15-2019
05:22 AM
|
1
|
1
|
24393
|
|
POST
|
What are the exact steps to reproduce? Every little detail is important...I ask because...there is a known issue when copying layouts where there is a basemap in the map being brought into the copied layout: depending on how you're calling for the map, the map will zoom to the default extent of the basemap, which blows up even my 48 core on-a-fiber-network machine, which sadly is the default behavior. Your mention of the scale changing confirms my suspicion. Try the same operation with maps that have no base map, and the only data is coming from a local FGDB.
... View more
07-15-2019
05:19 AM
|
1
|
0
|
5510
|
|
POST
|
Were you able to resolve any issues with your server? That's where the problem is.....
... View more
07-15-2019
05:13 AM
|
0
|
3
|
10029
|
|
POST
|
The two-point line tool (continue) doesn't really work in this situation, which calls for a single-part closed line with many vertices-that workaround creates many separate line segments The 5-step workaround......sure seems like a lot of extra mouse clicks...... This works perfectly fine in ArcMap: I can start digitizing my line, drop a bunch of vertices, when I move to the first vertex (to close the loop), and take all the time I want to decide if that is really my last vertex, the "snap" remains, and the last line segment doesn't disappear. Which leads to the oft-asked question..carpal-tunnel suffers want to know......why the change? Why not throw a funct key on top of the "...if a vertex needs to be moved, you can simply hover over it" that users can hit if they desire this function, and revert to the default, efficient editing behavior? Great hearing that improvements will be forthcoming, hopefully we'll see the return of the ArcMap functionality.
... View more
07-15-2019
05:12 AM
|
0
|
0
|
3886
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2022 12:19 PM | |
| 1 | 03-14-2019 06:24 AM | |
| 1 | 07-12-2018 09:29 AM | |
| 1 | 06-27-2019 12:08 PM | |
| 2 | 09-23-2019 11:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-26-2026
07:12 AM
|