POST
|
Uninstalling the standalone miniconda solved the issue. Was hoping it wouldn't come to that, as I do need that separate install for other work. I was able to reinstall it successfully without issue, however. If I ever identify what caused the two to conflict I will update here.
... View more
09-30-2020
07:45 AM
|
2
|
0
|
5528
|
POST
|
Nope. It doesn't give an error when I try to clone from the GUI, but the environment doesn't actually appear in my AppData folder. And when I restard ArcPro it is no longer listed in the GUI manage environments dialog.
... View more
09-25-2020
12:18 PM
|
0
|
2
|
5528
|
POST
|
Yes, and I can use python in the pro GUI. I can also run python scripts from the python command prompt. It really seems to be a problem with conda.exe specifically ... or rather, with my system preventing conda.exe from running properly (if I copy the conda.exe file to my second system it works fine there)
... View more
09-25-2020
11:45 AM
|
0
|
4
|
5528
|
POST
|
I can't clone the default using ESRI's conda because it doesn't work at all. Are you suggesting to clone it with non-ESRI conda? I'm skeptical of mixing them like that...
... View more
09-25-2020
10:50 AM
|
0
|
6
|
5528
|
POST
|
Thanks for your reply Tracy. I also have 2.6.1 installed on a second machine (also with a independent conda for non-ESRI python), and can confirm that it works fine there. I also suspected that the executable was being blocked due to IT policy, but am a little skeptical that this is the case for a couple reasons 1) the second machine I mentioned above is managed by the same IT, and it works there (sometimes policy updates get pushed to different computers and different times, so this is not ruled out entirely). 2) If an executable is blocked, I will generally get a warning message telling me that if I try to run it directly by double clicking it in file explorer (this does not happen when I try with ESRI's conda.exe). In the previous case you mentioned, you said that these python related executables failed to install properly. In that case, were the .exes missing entirely from ..\ArcGIS\Pro\bin\Python ? Or were they present but simply did not work as expected?
... View more
09-25-2020
10:46 AM
|
0
|
0
|
659
|
POST
|
It seems that the conda used by my ArcGIS Pro 2.6.1 install is completely broken. I have tried completely uninstalling and re-installing ArcPro, but it didn't change anything. I cannot create environments from the ArcPro GUI, nor can I run *any* conda commands from that python command prompt. For example, when I try running any of these commands: conda list
conda info --envs
conda create --clone arcgispro-py3 -n myenv It 'thinks' for a few seconds but the simply returns to a new command prompt without doing anything. No text output, nor are new environments created. I know it's not an issue with my PATH environmental variable: I've checked that it's set correctly, and even explicitly calling conda.exe with the full path does nothing : I'm lost on how to fix this. Given that reinstalling did nothing, I suspect it is some problem with my system and not with arcpro or conda themselves. I do have a separate anaconda installation on this machine, which I have been warned can cause problems. Yet on a second machine I use with an almost identical set up (2.6.1 w/ separate Anaconda install) this is not a problem, and it was not a problem on this system until recently. Any thoughts on how to diagnose and fix this?
... View more
09-25-2020
10:04 AM
|
0
|
10
|
6271
|
POST
|
I'm trying to use the region grow raster function on a DEM in ArcGIS pro. The goals is to use a single seed point to identify all the surrounding cells that are within a certain elevational range (i.e. +/- 1 5 meters) of that seed. I created a feature class with my seed point and with fields for the Maximum Growth Radius and Similarity Threshold (following the documentation here) parameters. Regardless of how I set the values in those fields, however, the output raster is always identical to the input - the region around my seed point never gets any bigger! If I inspect the values in the surrounding DEM cells, however, I can see that they are well within the similarity threshold. Any tips on how to get this tool to work?
... View more
09-23-2020
09:13 AM
|
0
|
0
|
680
|
POST
|
The non-ESRI miniconda installtion is actually pretty new, Pro was certainly installed first (although I may have had another anaconda/miniconda installed at the time). I'm a bit confused? Do you really use the conda/python that comes Pro for all your Python needs?
... View more
08-14-2020
03:40 PM
|
0
|
1
|
2961
|
POST
|
Thanks Dan, I understand how to fix the shortcut itself (in large part thanks to that exact blog post you linked to ). But again, I'm really more worried about how the conda that shipped with ArcPro was using menuinst to set it up in the first palce, as that package only exists in my non-ESRI miniconda installation. Am I missing something? Is this a valid concern? I just don't want anything ESRI related screwing up my non-ESRI python envs.
... View more
08-14-2020
02:31 PM
|
0
|
3
|
2961
|
POST
|
I was recently installing Spyder 4 using in my ArcGIS Pro (2.5) clone environment as described by Dan Patterson in this post. conda install spyder --no-pin At the very end of the install process I noticed this text pertaining to the menu shortcuts: DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\nkleinbaer\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone', env_name: 'arcgispro-py3-clone', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\NKLEIN~1\AppData\Local\Temp\1\_MEI146642\pythonw.exe, args are ['C:\\Users\\NKLEIN~1\\AppData\\Local\\Temp\\1\\_MEI146642\\cwp.py', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\pythonw.exe', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\Scripts\\spyder-script.py']
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\NKLEIN~1\AppData\Local\Temp\1\_MEI146642\python.exe, args are ['C:\\Users\\NKLEIN~1\\AppData\\Local\\Temp\\1\\_MEI146642\\cwp.py', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\python.exe', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\Scripts\\spyder-script.py', '--reset']
DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\nkleinbaer\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone', env_name: 'arcgispro-py3-clone', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\NKLEIN~1\AppData\Local\Temp\1\_MEI146642\pythonw.exe, args are ['C:\\Users\\NKLEIN~1\\AppData\\Local\\Temp\\1\\_MEI146642\\cwp.py', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\pythonw.exe', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\Scripts\\spyder-script.py']
DEBUG menuinst_win32:create(323): Shortcut cmd is C:\Users\NKLEIN~1\AppData\Local\Temp\1\_MEI146642\python.exe, args are ['C:\\Users\\NKLEIN~1\\AppData\\Local\\Temp\\1\\_MEI146642\\cwp.py', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\python.exe', 'C:\\Users\\nkleinbaer\\AppData\\Local\\ESRI\\conda\\envs\\arcgispro-py3-clone\\Scripts\\spyder-script.py', '--reset'] The menu short cut doesn't work for one, but my primary concern is that (as far as I can tell) menuinst is not installed in my ArcGIS Pro python env. The only place I can find it on my system is in a completely separate python installation (miniconda). Is it possible that the conda shipped by ESRI is using packages from a different python install? If so that is concerning to me because it might mean it could modify/break those environments ... Also, but less important, I don't understand why it is calling setting up the shortcuts to call pythonw.exe from that temp directory, rather from it's real home in the arcgispro-py3-clone directory. I think this is the reason it doesn't work off the bat, requiring me to manually fix the shortcut.
... View more
08-14-2020
01:47 PM
|
0
|
5
|
3056
|
POST
|
I changed Join_FID to Target_FID as it seems that is the key fields. It doesn't look like you actually did ... line 8 of your code still has 'JOIN_FID', and if you look at the output of your printed dictionary you can see that the keys match with 'JOIN_FID'. But that's OK, you don't need to change it. Your problem is that you swapped the polygons and the parcels in the spatial join from how I had it in my example. It's a bit counter intuitive, but you need to use the parcels as the target FC and the polys as the join FC in order for the "HAVE_THEIR_CENTER_IN" join type to work here. So just switching the polygons and parcels in the original spatial join operation should get you past that key error (at least it does for me, using your example data) The other issue, is that, as Randy mentioned, some of the polygons contain too many parcels to fit in a single field (max 250 char). One way to do that would be to just make as many fields as you need, see below. Probably not the cleanest way, but seems to work joinOutput = "join"
arcpy.analysis.SpatialJoin( buildoutParcels , buildoutPolygons, joinOutput, "JOIN_ONE_TO_MANY", "KEEP_COMMON", '', "HAVE_THEIR_CENTER_IN")
#create a dictionary to hold list of parcels w/ FID of buildoutPolygon features as key
parcel_dict = {}
with arcpy.da.SearchCursor(joinOutput , ['JOIN_FID','PARCEL']) as cursor:
for row in cursor:
parcels = parcel_dict.get(row[0])
if not parcels:
parcels = [row[1]]
else:
parcels.append(row[1])
parcel_dict.update({row[0]:parcels})
print(parcel_dict)
#find the length of longest parcel list https://stackoverflow.com/a/21839239/11434833
max_parcels = max(parcel_dict, key=lambda x: len(parcel_dict[x]))
# figure out how many fields you need @ 10 parcels per field
import math
n_fields = int(math.ceil(max_parcels/10))
# Create that new many fields ....
new_fields_list = []
for i in range(0,n_fields):
new_field_name = "PARCEL_" + str(i)
arcpy.AddField_management(buildoutPolygons, new_field_name, "TEXT")
new_fields_list.append(new_field_name)
#use this dict to update the buildoutPolygons FC (maybe a good idea to make a copy and update that instead of original?)
new_fields_list.insert(0,'OBJECTID_1')
print(new_fields_list)
with arcpy.da.UpdateCursor(buildoutPolygons,new_fields_list) as cursor:
for row in cursor:
print(row)
for i in range(1,len(row)):
row[i] = ','.join(parcel_dict[row[0]][i*10:i*10+10])
cursor.updateRow(row)
... View more
08-03-2020
04:11 PM
|
0
|
1
|
3869
|
POST
|
import collections
d = collections.defaultdict(list)
with arcpy.da.SearchCursor(joined, fields2dict) as cursor:
for key, value in cursor:
d[key].append(value)import collections
Wow this is so much cleaner, I'll have to use this in the future. Never new about collections.defaultdict() before, thanks for sharing! Also unpacking the row tuple in the for loop makes it way more readable than using row!
... View more
08-03-2020
01:28 PM
|
0
|
0
|
1143
|
POST
|
The dictionary is set up using the FID's of the buildoutPolygon features as the keys, so trying to use the value of the 'PARCELS' field as a key (i.e. changing it to parcel_dict[row[1]] ) is not going to work. It looks like there is no entry in the dictionary for the feature with FID 0. Try printing out the dictionary before running the update cursor to check that it has been properly populated.
... View more
07-31-2020
03:38 PM
|
2
|
3
|
3869
|
POST
|
I don't think arcpy.env.overwriteOutput will work - arcpy and the 'ArcGIS API for Python' are not the same thing this might be useful Overwrite existing Tile Layer Service on ArcGIS Online . There is an answer from KGerrow a ways down that has an example script maybe try something like: tile_package = { 'title': ('%s') % p[:-5], 'tags': 'Drone, Imagery', 'type': 'Tile Package', overwrite': 'true'} not sure if that would work, only looked at their script very briefly. But i think digging in to that post will send you in the right direction hopefully
... View more
07-31-2020
09:28 AM
|
1
|
0
|
13269
|
POST
|
I'm having a hard time following what is going on in those three code chunks. But maybe try something like this ``` # do the spatial join with the 'buildoutParcels' as the Target Features and the 'buildoutPolygons' as the Join features # One to many may not be necessary, as it looks like each parcel only pertains to one buildoutpoly # Keep common makes it easier in the next step by not including parcels that don't have a center within ANY buildoutpoly buildoutParcels = r"PATH\TO\YOUR\DATA\buildoutParcels1.shp" #or reference to layer buildoutPolygons = r"PATH\TO\YOUR\DATA\buildoutPolygons1.shp" joinOutput = r"PATH\TO\YOUR\DATA\spatialJoin.shp" arcpy.analysis.SpatialJoin(buildoutParcels, buildoutPolygons , joinOutput, "JOIN_ONE_TO_MANY", "KEEP_COMMON", '', "HAVE_THEIR_CENTER_IN") #create a dictionary to hold list of parcels w/ FID of buildoutPolygon features as key parcel_dict = {} with arcpy.da.SearchCursor(joinOutput , ['JOIN_FID','PARCEL']) as cursor: for row in cursor: parcels = parcel_dict.get(row[0]) if not parcels: parcels = [row[1]] else: parcels.append(row[1]) parcel_dict.update({row[0]:parcels}) #use this dict to update the buildoutPolygons FC (maybe a good idea to make a copy and update that instead of original?) with arcpy.da.UpdateCursor(buildoutPolygons,['FID','PARCELS']) as cursor: for row in cursor: row[1] = " , ".join(parcel_dict[row[0]]) cursor.updateRow(row) ```
... View more
07-30-2020
04:08 PM
|
2
|
5
|
3869
|
Title | Kudos | Posted |
---|---|---|
1 | 02-25-2020 10:18 AM | |
1 | 07-31-2020 09:28 AM | |
2 | 09-30-2020 07:45 AM | |
2 | 07-30-2020 04:08 PM | |
2 | 07-31-2020 03:38 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|