|
POST
|
I want to fill a symbol or on a map or a filled shape chart using esri data. I have been requested to make it like a tea cup diagram. I know this is a static image but was wondering if there is a way to do this dynamically. https://www.usbr.gov/pn/hydromet/roguetea.html
... View more
04-30-2021
09:56 AM
|
1
|
7
|
2412
|
|
DOC
|
@JakeSkinner Probably not the best way to do this but here it is: import requests, json, datetime, time, smtplib
from datetime import timedelta
import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# Disable warnings
requests.packages.urllib3.disable_warnings()
print('This file is from sendEmail_addfields.py')
# Variables
username = '' # AGOL Username or Portal username
password = '' # AGOL Password or Portal password
URL = '' # Feature Service URL
uniqueID = 'objectid' # i.e. OBJECTID
dateField = 'created_date' # Date field to query
hoursValue = 0.083 # Number of hours to check when a feature was added
#0.083
fromEmail = '' # Email sender
TO = [''] # Email receiver
smtpServer = '' # SMTP Server Name
portNumber = 25 # SMTP Server port
AGOL = True # True if service is hosted in AGOL, False if service is hosted in Portal
portalServer = 'portal.esri.com' # Server name portal is installed on (not web adaptor)
# Create empty list for uniqueIDs
datesighted = []
name = []
phone = []
email = []
aggressive = []
numanimal = []
animaldoing = []
reaction = []
probtype = []
oidList = []
publicview = []
details = []
# Generate AGOL token
if AGOL == True:
try:
print('Generating Token')
tokenURL = 'https://www.arcgis.com/sharing/rest/generateToken'
params = {'f': 'pjson', 'username': username, 'password': password, 'referer': 'http://www.arcgis.com'}
r = requests.post(tokenURL, data=params, verify=False)
response = json.loads(r.content)
token = data['token']
except:
token = ''
else:
# Generate Portal token
tokenURL = '/'.format(portalServer)
params = {'f': 'pjson', 'username': username, 'password': password, 'referer': ''.format(portalServer)}
r = requests.post(tokenURL, data = params, verify=False)
response = json.loads(r.content)
token = response['token']
# Query service and check if created_date time is within the last hour
params = {'f': 'pjson', 'where': "1=1", 'outFields' : '*', 'statisticType' : 'count', 'returnGeometry' : 'false'}
r = requests.post(URL, data=params, verify=False)
response = json.loads(r.content)
print(params)
for feat in response['features']:
createDate = feat['attributes']['created_date']
createDate = int(str(createDate)[0:-3])
t = datetime.datetime.now() - timedelta(hours=hoursValue)
t = time.mktime(t.timetuple())
if createDate > t:
datesighted.append(str(feat['attributes']['datesighted']))
name.append(str(feat['attributes']['name']))
phone.append(str(feat['attributes']['phone']))
email.append(str(feat['attributes']['email']))
animaldoing.append(str(feat['attributes']['animaldoing']))
numanimal.append(str(feat['attributes']['numanimal']))
aggressive.append(str(feat['attributes']['aggressive']))
reaction.append(str(feat['attributes']['reaction']))
probtype.append(str(feat['attributes']['probtype']))
oidList.append(str(feat['attributes']['objectid']))
details.append(str(feat['attributes']['details']))
publicview .append(str(feat['attributes']['publicview']))
print(oidList)
mergelist = zip(probtype, details, publicview)
print(mergelist)
# Email Info
FROM = fromEmail
SUBJECT = 'New Wildlife Sighting Has been Reported'
Total= "Features with " + " " + str(publicview) + " " + " were added."
TotalAnimals = (Total.count("Yes"))
print(TotalAnimals)
#TEXT = "There were " + " " + str(TotalAnimals) + " " + " sighting(s) added the Cougar Map within the past hour."
#TEXT = '<a href="http://maps.google.com/maps?z=12&t=m&q=loc:'+str(p['latitude'])+'+'+str(p['longitude'])+'">Click Here</a>'
tom = datesighted[0]
chosen_number = int(tom)
s = chosen_number / 1000.0
print s
dFormat = "%Y-%m-%d %H:%M:%S.%f"
datesightedconvert = datetime.datetime.fromtimestamp(s).strftime('%Y-%m-%d %H:%M:%S')
# Create the body of the message (a plain-text and an HTML version).
TotalSighted = "There were " + " " + str(TotalAnimals) + " " + " reports(s) added the Wildlife Map within the past 5 min."
Sighted = "\nAnimal Sighted : " + str(probtype)
TheDateSighted = "\nDate Sighted : " + str(datesightedconvert) + " " + " ***\n"
reported = "\nReporter Name: " + str(name)
PhoneNumber = "\nReporter Phone Number: " + str(phone)
ReportedEmail = "\nReporter Phone Email: " + str(email)
Aggressiveness = "'\n'Was animal Aggressive?: " + str(aggressive)
ReportedReaction = "'\nWhat was the animal Reaction?: " + str(reaction)
ReportedDetails = "'\n'More Details about the sighting: " + str(details)
AnimalDoing = "'\n'What was the Animal(s) Doing?: " + str(animaldoing)
AnimalSeen = "'\n'How Many were seen?: " + str(numanimal)
Link = "'\n\n'View more information on the : \ \n\n\n ***if there are more than 1 reports then only the first Date Sighted will be in this Email.***"
Text = TotalSighted + TheDateSighted + Sighted + reported + PhoneNumber + ReportedEmail + Aggressiveness + ReportedReaction + ReportedDetails + AnimalDoing + AnimalSeen + Link
print ''.join(Text)
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, Text)
# If new features exist, send email
if len(oidList) > 0:
smtpObj = smtplib.SMTP(host=smtpServer, port=portNumber)
smtpObj.sendmail(FROM, TO, message)
print("Successfully sent email")
smtpObj.quit() Here is some of the output. Is there a way to remove the [] 'Was animal Aggressive?: ['No']' What was the animal Reaction?: ['Didnt see me']' 'More Details about the sighting: ['Mama and two cubs filmed by the motion-detecting doorbell camera as they passed across the yard']'
... View more
04-28-2021
06:41 AM
|
0
|
0
|
11076
|
|
DOC
|
@JakeSkinner Thanks again for this awesome resource. I am getting an error that you might be able to help me with. Someone put "didn't" in a field and the script did not like the '. Any idea how to get around this? Error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 4: ordinal not in range(128)
... View more
04-27-2021
01:54 PM
|
0
|
0
|
12995
|
|
DOC
|
@ScottOppmann @ChrisBuscaglia I am looking for a solution to keep track of our reservoir water level for the year with a draw down curve. As well as how much water our treatment plant is producing a day. I am looking for a public facing webapp like a dashboard. Here is all the data we are collecting. We live in a drought area and want to show citizens how we are doing water wise. WATERSHED & PRODUCTION DATA CITY DATE W. F. MGD E. F. MGD TOTAL W.& E. MGD TID FLOW MGD GENERATOR MGD TOTAL TAILRACE MGD RESERVIOR % FULL TAP FLOW MGD PLANT PRODUCTION MGD HIGH TEMP F LOW TEMP F RAIN INCHES HIGH TEMP F LOW TEMP F RAIN INCHES Do you have anything that would work for this?
... View more
04-21-2021
01:38 PM
|
0
|
0
|
11361
|
|
IDEA
|
@Anonymous User Thank you for implementing this. I will try it out and let you know if I have any issues.
... View more
04-20-2021
06:46 AM
|
0
|
0
|
2650
|
|
POST
|
@AmandaBeck Can you post the arcade script you have so far?
... View more
04-13-2021
08:34 AM
|
0
|
1
|
6254
|
|
POST
|
@ScottRobinson You could write a python script that would run every night (or how frequently you would like) to run that calc
... View more
04-09-2021
10:32 AM
|
1
|
1
|
2637
|
|
POST
|
@ScottRobinson Are you trying to do this on ArcGIS Online, ArcGIS PRO, or desktop?
... View more
04-09-2021
07:46 AM
|
0
|
1
|
2719
|
|
POST
|
@JoshuaBixby I don't know where to start with Dan's suggestion
... View more
04-08-2021
11:31 AM
|
0
|
2
|
3657
|
|
POST
|
@DanPatterson Unfortunately I cannot get your suggestions to work.
... View more
04-08-2021
10:37 AM
|
0
|
1
|
3660
|
|
POST
|
@jcarlson I got the time to display right by changing to 17 for time. But it keeps adding a month to the calculated value. this is what my field looks like and this is what I get after running the script you suggested var oldDate = $feature.reinspect_date
var y = Text(oldDate, 'Y')
var m = Text(oldDate, 'MM')
var d = Text(oldDate, 'DD')
var newDate = Date(y, m, d, 17)
return newDate
... View more
04-07-2021
11:44 AM
|
0
|
0
|
3714
|
|
POST
|
@jcarlson Thanks for the quick reply. What language is this in Arcade? When I run the script as arcade it adds one day and sets the time to 7:00:00AM
... View more
04-07-2021
11:13 AM
|
0
|
2
|
3723
|
|
POST
|
So I have some old data that has time in the date field. I do not want time in the date field. I know that I can set the time to 12:00:00AM to make the time disappear from the field. I need a way to update all the records (different days) to have the same time of day but keep the original date. Any suggestions on how to do this?
... View more
04-07-2021
10:07 AM
|
0
|
10
|
4259
|
|
POST
|
@JamesONeill Some templates are hit and miss. Have you used webapp builder? https://doc.arcgis.com/en/web-appbuilder/create-apps/widget-smart-editor.htm you could try survey123 https://doc.arcgis.com/en/survey123/desktop/create-surveys/prepareforediting.htm https://doc.arcgis.com/en/survey123/desktop/create-surveys/survey123withexistingfeatureservices.htm
... View more
04-07-2021
10:03 AM
|
0
|
0
|
471
|
|
POST
|
@JamesONeill After I added this setting I was able to edit using that webapp template. I dont think you need Add Toolbar to Editor checked
... View more
04-07-2021
09:06 AM
|
0
|
2
|
3178
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-28-2025 01:53 PM | |
| 1 | 08-24-2022 09:40 AM | |
| 1 | 07-19-2018 04:41 PM | |
| 1 | 04-05-2024 03:12 PM | |
| 1 | 07-04-2024 11:42 AM |