POST
|
The documentation covers enterprise. Is it possible with azure DefaultEndpointsProtocol, AccountKey etc I can access a blob container and read json file into an Arcpro API notebook? Any other way I can go about it? Thanks in advance
... View more
09-14-2020
11:33 PM
|
0
|
0
|
648
|
POST
|
This was resolved when I was set up for notebook beta. All good.
... View more
07-21-2020
02:01 AM
|
0
|
1
|
576
|
POST
|
I have always run spatially supported datafarames directly from Jupyter. I attempted and successfully shared a notebook in ArcGIS online. I tried to double click and open to use the notebook and it threw the following error; There seems to be no literature on installation and configuration on ArcGIS online. Any help?
... View more
01-19-2020
11:03 PM
|
0
|
3
|
664
|
POST
|
@hziegler-esristaff way is what I have always used. ArcPro 2.15 now allows toggling between desktop and spatially enabled dataframes. Additionally from the python API you can now launch, code within spatially referenced dataframes and save and share as an item in ArcOnline. Apart from using numpy, can also use pandas. import pandas as pd df = pd.read_csv(r'file directory') df.isna().sum() # for entire dataframe df.fieldname.isna() The advantage with spatially dataframes is it levarages numpy and pandas to access statistical abilities that can otherwise be accessed 'cumbersomely' in arcpy. It also accords excellent visualization in matplotlib and seaborn python libraries.
... View more
01-13-2020
08:06 PM
|
0
|
0
|
370
|
POST
|
I am trying Parcel Fabric for the first time. It has gone in well except the directions and distances are only displaying at very low scales. At 1:50000 which is a normal view on my screen, the dimensions do not appear. I have re-tweaked the expression in arcade window as highlighted below but that does not quite help. Tweak to change spacing and to change text size If someone knows what needs to be done shall be highly appreciated? Lastly, split of the record does not directly update the affiliated subtypes. Is there a more direct way than split parent method? Cheers
... View more
11-14-2019
08:23 PM
|
0
|
0
|
198
|
POST
|
Optionally, you can execute the flavor of python .exe you want in the Program/script window, and call the .py file as an argument... Quoted suggestion seems to work. I ran the ESRI's given code below import sys
import platform
import imp
print("Python EXE : " + sys.executable)
print("Architecture : " + platform.architecture()[0])
print("Path to arcpy : " + imp.find_module("arcpy")[1])
and it pointed me to the following exe file When changed to:\python.exe, it all went fine. I too think, it was executing in cd and not in the background (within task scheduler when logged off the server) because I had input mapped directory paths as opposed to the full directory paths.
... View more
10-31-2019
09:11 PM
|
0
|
0
|
2460
|
POST
|
The server has internet connection. Multiple other python 2 scripts running well. Issue was new script runs on python 3, I changed to redirect the exe file to 3 and that is causing issues.
... View more
10-31-2019
09:03 PM
|
0
|
0
|
2460
|
POST
|
This script downloads a feature service from ArcGIS online and saves it to a local server. So not an SDE database.
... View more
10-30-2019
08:23 PM
|
0
|
3
|
2460
|
POST
|
I have a script that runs well and as scheduled on a pc. It cant however be executed when scheduled on the server. It starts of and indicates it is complete within 2 seconds Looked at all options discussed in this forum. Not able to resolve issue though. Last I tried to use is ESRI Support- Scheduling Tasks and cant seem to understand what the highlighted below is and where it needs to be put in the task scheduler. Would highly appreciate help.
... View more
10-29-2019
10:24 PM
|
0
|
7
|
2893
|
POST
|
Code ok. Typo ; rows at line 80 and 81 noted and rectified. It was meant to be row. corrected code below: import arcpy
from datetime import datetime
from datetime import datetime as dt
from datetime import timedelta
import time
from datetime import date
#Variables Start
arcpy.env.workspace = r'E:\Patch\New File Geodatabase.gdb'
fc= 'patchjoin212'
field =['Conc','ID']
fields = ['start', 'finish', 'DateRange', 'Cat']
Classifyjoin = "Classifyjoin"
Classifyjoin__2_ = Classifyjoin
def min_cat(b=datetime.now() , m=datetime.now(), x = 2, y=-1):
"""This function calculates the date range between earliest start in a category to the exact finish date of an individual member"""""
#return(b-m).days
lg =[2]
e = (b-m).days
f = {True: x, False: y} [e <= 60]#(y, x) [e <=60 ] # [ x if e<=60 else -1]
return [ e, f]
#cb = min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-11-29', '%Y-%m-%d').date(), x= [9])
print min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-11-29', '%Y-%m-%d').date(), x= [9], y=[-1])
temp_lyr= arcpy.MakeTableView_management(fc, "temp_lyr")
ud = {}
with arcpy.da.SearchCursor(fc, field) as rows:
for row in rows:
if row[0] not in ud:
ud[row[0]] = row[1]
for k in ud:
where_clause="Conc IN( '%s')" % k #+ "AND ID IN( '%s')" %v
#print(where_clause)
kala = arcpy.SelectLayerByAttribute_management(temp_lyr, 'NEW_SELECTION', where_clause)#Carry out the selection
cnt = arcpy.GetCount_management(temp_lyr) # Counting the selected and copied features
print("The number of selected records is: " + str(cnt))
listdates = []
listCat =[]
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
listCat.append(row[3])
jp =max(listCat)
kp = int('{}'.format(jp))
kp +=1
if row[3]==-1:
listdates.append(row[0])
pg =min(listdates)#.date()
jup = '{}'.format(pg)
jop = dt.strptime(jup, '%Y-%m-%d %H:%M:%S').date()
bg = '{}'.format(row[1])
job = dt.strptime(bg, '%Y-%m-%d %H:%M:%S').date()
a =min_cat(b= job, m=jop, x= kp, y=-1)
row[2] = a[0]
cursor.updateRow(row)
#u = categories(k)
row[3] = a[1]
cursor.updateRow(row)
del cursor, row
print ("finished") Thanks
... View more
07-16-2019
05:07 AM
|
0
|
0
|
317
|
POST
|
9/10 spatial analysis I do involve mathematical expressions. Users want me to execute recursive math functions,to aid spatial analysis and clustering. I have challenges passing such expressions into arcpy.da and Code Blocks in calculate field. A simple case in point; I have the table below. I need the code to recursively calculate minimum start date and find the Date range between this date and finishdate. If the range is <=60, the Cat should increment by 1 else it should remain as -1. The challenge is, ternary operator in the def function refuses to update because my method does not assign item at line 62. OBJECTID_1 * Conc * ID start finish DateRange Cat 1 ASPELBJNMI LAPMT 6/27/2018 8/11/2018 100 -1 2 ASPELBJNMI KLKIY 8/22/2018 8/31/2018 100 -1 3 ASPELBJNMI HDOKK 8/12/2018 9/30/2018 100 -1 4 ASPELBJNMI XMCZW 8/22/2018 10/20/2018 100 -1 5 BKRKAVQTZC FCBES 7/1/2018 8/15/2018 100 -1 6 BKRKAVQTZC NHQGW 8/24/2018 9/4/2018 100 -1 7 BKRKAVQTZC LVUSS 8/9/2018 10/4/2018 100 -1 8 BKRKAVQTZC RQVNN 8/18/2018 10/24/2018 100 -1 9 FKKTHEJGCY IHORM 7/2/2018 8/20/2018 100 -1 10 FKKTHEJGCY AZFEV 8/28/2018 9/8/2018 100 -1 11 FKKTHEJGCY YAVOY 8/4/2018 9/29/2018 100 -1 12 FKKTHEJGCY AMWAX 8/16/2018 10/22/2018 100 -1 13 JUNRNEXCRG QCOWV 6/30/2018 8/25/2018 100 -1 14 JUNRNEXCRG AOYNL 8/25/2018 9/9/2018 100 -1 15 JUNRNEXCRG CGCHK 8/4/2018 10/3/2018 100 -1 16 JUNRNEXCRG IQYGJ 8/12/2018 10/26/2018 100 -1 import arcpy
from datetime import datetime
from datetime import datetime as dt
from datetime import timedelta
import time
from datetime import date
#Variables Start
arcpy.env.workspace = r'E:\Patch\New File Geodatabase.gdb'
fc= 'patchjoin212'
field =['Conc','ID']
fields = ['start', 'finish', 'DateRange', 'Cat']
Classifyjoin = "Classifyjoin"
Classifyjoin__2_ = Classifyjoin
#Def function
def min_cat(b=datetime.now() , m=datetime.now(), x = 2, y =-1):
"""This function calculates the date range between earliest start in a category to the exact finish date of an individual member"""""
#return(b-m).days
e = (b-m).days
f = ( x if e<=60 else y)
return {'e': e, 'f':f}
#print ['e']
#print ['f
#print min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-11-29', '%Y-%m-%d').date(), x= 9, y=-1)
#temp_lyr = arcpy.MakeFeatureLayer_management(fc, "temp_lyr") #If using a fc in gdb
temp_lyr= arcpy.MakeTableView_management(fc, "temp_lyr")
#Variables end
ud = {}
with arcpy.da.SearchCursor(fc, field) as rows:
for row in rows:
if row[0] not in ud:
ud[row[0]] = row[1]
for k in ud:
where_clause="Conc IN( '%s')" % k #+ "AND ID IN( '%s')" %v
#print(where_clause)
kala = arcpy.SelectLayerByAttribute_management(temp_lyr, 'NEW_SELECTION', where_clause)#Carry out the selection
cnt = arcpy.GetCount_management(temp_lyr) # Counting the selected and copied features
print("The number of selected records is: " + str(cnt))
listdates = []
listCat =[]
bv =[]
#k = [row[3] for row in arcpy.da.SearchCursor(fc, ["start", "finish", "DateRange", "Cat"]) if row [2]<60]
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
listCat.append(row[3])
jp =min(listCat)
kp = int('{}'.format(jp))
kp +=1
#while row[3]==0:
if row[3]==-1:
listdates.append(row[0])
pg =min(listdates)#.date()
jup = '{}'.format(pg)
jop = dt.strptime(jup, '%Y-%m-%d %H:%M:%S').date()
bg = '{}'.format(row[1])
job = dt.strptime(bg, '%Y-%m-%d %H:%M:%S').date()
a =min_cat(b= job, m=jop, x= kp, y=-1)
row[2] = a['e']
cursor.updateRow(row)
#u = categories(k)
rows[3] = a['f']
cursor.updateRow(rows)
del cursor, row
print ("finished")
How can I best call recursive spatial stat approaches of mathematical nature encapsulated in ternary operators, comprehensions etc into arcpy or arcpy.da.? Any way out? Any other approach? Or is this outside the spatial stat world? Also posted https://stackoverflow.com/questions/56945606/passing-a-ternary-operator-recursively-returns-method-does-not-support-item-assi
... View more
07-11-2019
05:34 AM
|
0
|
1
|
482
|
POST
|
I have made several attempt to get the code working. Not successful. First Option: Runs well, updates first loop correctly and does nothing to the rest of items in the selection import arcpy
from datetime import datetime
from datetime import datetime as dt
from datetime import timedelta
import time
from datetime import date
#Variables Start
arcpy.env.workspace = r'C:\Users\williamk\Desktop\Delete\datap\New File Geodatabase.gdb'
fc= 'Classifyjoin212'
field =['Conc','ID']
fields = ['start', 'finish', 'DateRange', 'Cat']
Classifyjoin = "Classifyjoin"
Classifyjoin__2_ = Classifyjoin
#Def function
def min_cat(b=datetime.now() , m=datetime.now() ):
"""This function calculates the date range between earliest start in a category to the exact finish date of an individual member"""""
return(b-m).days
#print min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-07-26', '%Y-%m-%d').date())
#temp_lyr = arcpy.MakeFeatureLayer_management(fc, "temp_lyr") #If using a fc in gdb
temp_lyr= arcpy.MakeTableView_management(fc, "temp_lyr")
#Variables end
ud = {}
with arcpy.da.SearchCursor(fc, field) as rows:
for row in rows:
if row[0] not in ud:
ud[row[0]] = row[1]
for k in ud:
where_clause="Conc IN( '%s')" % k #+ "AND ID IN( '%s')" %v
#print(where_clause)
kala = arcpy.SelectLayerByAttribute_management(temp_lyr, 'NEW_SELECTION', where_clause)#Carry out the selection
cnt = arcpy.GetCount_management(temp_lyr) # Counting the selected and copied features
print("The number of selected records is: " + str(cnt))
listdates = []
listCat =[]
bv =[]
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
#while row[3]==0:
if row[3]==-1:
listdates.append(row[0])
pg =min(listdates)#.date()
jup = '{}'.format(pg)
jop = dt.strptime(jup, '%Y-%m-%d %H:%M:%S').date()
bg = '{}'.format(row[1])
job = dt.strptime(bg, '%Y-%m-%d %H:%M:%S').date()
a =min_cat(b= job, m=jop)
row[2] = a
cursor.updateRow(row)
#del cursor, row
with arcpy.da.UpdateCursor(fc, fields) as innercursor:
for rows in innercursor:
if rows[2] <=60:
listCat.append(rows[3])
jp =min(listCat)
kp = int('{}'.format(jp))
kp +=1
rows[3] = kp
innercursor.updateRow(rows)
#del innercursor, rows
print ("finished")
Second option throws a traceback on line 79: rows[3] = u TypeError: 'da.SearchCursor' object does not support item assignment >>> import arcpy
from datetime import datetime
from datetime import datetime as dt
from datetime import timedelta
import time
from datetime import date
#Variables Start
arcpy.env.workspace = r'C:\Users\williamk\Desktop\Delete\datap\New File Geodatabase.gdb'
fc= 'Classifyjoin212'
field =['Conc','ID']
fields = ['start', 'finish', 'DateRange', 'Cat']
Classifyjoin = "Classifyjoin"
Classifyjoin__2_ = Classifyjoin
#Def function
def min_cat(b=datetime.now() , m=datetime.now() ):
"""This function calculates the date range between earliest start in a category to the exact finish date of an individual member"""""
return(b-m).days
#print min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-07-26', '%Y-%m-%d').date())
l =[]
def categories (l):
jp =min(l)
kp = int('{}'.format(jp))
kp +=1
return kp
#k = [row[3] for row in arcpy.da.SearchCursor(fc, ["start", "finish", "DateRange", "Cat"]) if row [2]<60]
#print categories(k) #(fc, field)
#temp_lyr = arcpy.MakeFeatureLayer_management(fc, "temp_lyr") #If using a fc in gdb
temp_lyr= arcpy.MakeTableView_management(fc, "temp_lyr")
#Variables end
ud = {}
with arcpy.da.SearchCursor(fc, field) as rows:
for row in rows:
if row[0] not in ud:
ud[row[0]] = row[1]
for k in ud:
where_clause="Conc IN( '%s')" % k #+ "AND ID IN( '%s')" %v
#print(where_clause)
kala = arcpy.SelectLayerByAttribute_management(temp_lyr, 'NEW_SELECTION', where_clause)#Carry out the selection
cnt = arcpy.GetCount_management(temp_lyr) # Counting the selected and copied features
print("The number of selected records is: " + str(cnt))
listdates = []
listCat =[]
bv =[]
k = [row[3] for row in arcpy.da.SearchCursor(fc, ["start", "finish", "DateRange", "Cat"]) if row [2]<60]
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
#while row[3]==0:
if row[3]==-1:
listdates.append(row[0])
pg =min(listdates)#.date()
jup = '{}'.format(pg)
jop = dt.strptime(jup, '%Y-%m-%d %H:%M:%S').date()
bg = '{}'.format(row[1])
job = dt.strptime(bg, '%Y-%m-%d %H:%M:%S').date()
a =min_cat(b= job, m=jop)
row[2] = a
cursor.updateRow(row)
u = categories(k)
rows[3] = u
innercursor.updateRow(rows)
del cursor, row
print ("finished") @joshua Bixby , @Anonymous User Fairhurst Is there away I can make the list comprehension mutable for it to allow me update cursor using the value I call at line 78? I tried lots of @Anonymous User Fairhurst's Turbo Charging Data with Python but haven't been successful? Any one with an idea?
... View more
07-04-2019
07:15 PM
|
0
|
0
|
1202
|
POST
|
I put the code through ArcPro 2.4 and didnt loop through either. I am looking into the inner loop because thats where I believe I have an issue. Any help will be appreciated.
... View more
06-30-2019
08:20 PM
|
0
|
0
|
1202
|
POST
|
Thanks Joshua, this is happenning in both ArcMap 10.5.1 Advansed and ArcPro. Havent updated Pro for two months. Will try that.
... View more
06-29-2019
05:56 PM
|
0
|
3
|
1202
|
POST
|
I have the following table of objects OBJECTID Conc ID start finish DateRange Cat 2 ASPELBJNMI LAPMT 27/06/2018 11/8/2018 100 0 9 ASPELBJNMI KLKIY 22/08/2018 31/08/2018 100 0 16 ASPELBJNMI HDOKK 12/8/2018 30/09/2018 100 0 23 ASPELBJNMI XMCZW 22/08/2018 20/10/2018 100 0 6 BKRKAVQTZC FCBES 1/7/2018 15/08/2018 100 0 13 BKRKAVQTZC NHQGW 24/08/2018 4/9/2018 100 0 20 BKRKAVQTZC LVUSS 9/8/2018 4/10/2018 100 0 27 BKRKAVQTZC RQVNN 18/08/2018 24/10/2018 100 0 7 FKKTHEJGCY IHORM 2/7/2018 20/08/2018 100 0 14 FKKTHEJGCY AZFEV 28/08/2018 8/9/2018 100 0 21 FKKTHEJGCY YAVOY 4/8/2018 29/09/2018 100 0 28 FKKTHEJGCY AMWAX 16/08/2018 22/10/2018 100 0 5 JUNRNEXCRG QCOWV 30/06/2018 25/08/2018 100 0 12 JUNRNEXCRG AOYNL 25/08/2018 9/9/2018 100 0 19 JUNRNEXCRG CGCHK 4/8/2018 3/10/2018 100 0 26 JUNRNEXCRG IQYGJ 12/8/2018 26/10/2018 100 0 I need to recursively run through calculating the min start date from 'start ' for a group of 'Conc' and finding the 'DateRange' by subtracting the min start date from 'finish'. Every time the DateRage becomes equal or less than 60 days, the Cat should increase by 1 for each group of Concs. Consequent loop should then calculate a new min start date. This should continue till when it is not possible to get a new DateRage for for a group of 'Conc. At the start, my code defaults DateRange to 100 and Cat to 0 at the start. I have come up with the following code. It runs but seems to honor the outer loop on line 40 but exits without executing executing aspects of inner loop at line 54. import arcpy
from datetime import datetime
from datetime import datetime as dt
from datetime import timedelta
import time
from datetime import date
#Variables Start
arcpy.env.workspace = r'E:\Classify\New File Geodatabase.gdb'
fc= 'Classifyjoin212'
field =['Conc','ID']
fields = ['start', 'finish', 'DateRange', 'Cat']
Classifyjoin = "Classifyjoin"
Classifyjoin__2_ = Classifyjoin
#Def function
def min_cat(b=datetime.now() , m=datetime.now() ):
"""This function calculates the date range between earliest start in a category to the exact finish date of an individual member"""""
return(b-m).days
#print min_cat(b=dt.strptime('2019-06-26', '%Y-%m-%d').date(), m=dt.strptime('2018-07-26', '%Y-%m-%d').date())
#temp_lyr = arcpy.MakeFeatureLayer_management(fc, "temp_lyr") #If using a fc in gdb
temp_lyr= arcpy.MakeTableView_management(fc, "temp_lyr")
listdates = []
listCat =[]
#Variables end
ud = {}
with arcpy.da.SearchCursor(fc, field) as rows:
for row in rows:
if row[0] not in ud:
ud[row[0]] = row[1]
for k in ud:
where_clause="Conc IN( '%s')" % k #+ "AND ID IN( '%s')" %v
#print(where_clause)
kala = arcpy.SelectLayerByAttribute_management(temp_lyr, 'NEW_SELECTION', where_clause)#Carry out the selection
cnt = arcpy.GetCount_management(temp_lyr) # Counting the selected and copied features
print("The number of selected records is: " + str(cnt))
with arcpy.da.UpdateCursor(kala, fields) as cursor:
for row in cursor:
if row[2]>60:
listdates.append(row[0])
pg =min(listdates)#.date()
jup = '{}'.format(pg)
jop = dt.strptime(jup, '%Y-%m-%d %H:%M:%S').date()
bg = '{}'.format(row[1])
job = dt.strptime(bg, '%Y-%m-%d %H:%M:%S').date()
a =min_cat(b= job, m=jop)
row[2] = a
cursor.updateRow(row)
#continue
elif row[2]<=60:
listCat.append(row[3])
jp =min(listCat)
kp = int('{}'.format(jp))
kp +=1
row[3] = kp
cursor.updateRow(row)
continue
#break
arcpy.SelectLayerByAttribute_management(temp_lyr, "CLEAR_SELECTION")
#del row
del cursor
print ("finished")
The outcome with the code as it is; updates both the DateRange and cat ones. Any other way around it?
... View more
06-28-2019
08:19 PM
|
0
|
5
|
1609
|
Title | Kudos | Posted |
---|---|---|
1 | 12-01-2020 03:57 PM | |
1 | 11-18-2020 10:44 PM | |
1 | 09-28-2020 10:07 PM | |
1 | 03-06-2019 05:31 PM |
Online Status |
Offline
|
Date Last Visited |
05-03-2023
09:10 PM
|