POST
|
Sorry for the delayed response. Nope, I didn't really find a solution in ArcMap. I'm really trying to avoid ArcMap now and instead using ArcGIS Pro for anything related to AGOL editing. No downloading or synchronizing required so works much better with Model Builder and arcpy.
... View more
11-11-2019
05:30 PM
|
0
|
1
|
834
|
POST
|
A handy trick from myself is if you open something and it doesn't appear (i.e. is hidden off the screen somewhere), press and hold the Windows button and press the Left or Right Arrow key. This will move the active Window to automatically fill half of the screen that it is on, making the window visible if it is hiding somewhere. Windows + Up will make the active window fill the whole screen.
... View more
09-25-2019
11:41 PM
|
24
|
8
|
8915
|
POST
|
That ol' chestnut. Thankfully, whoever wrote the sample code I used took that into consideration and they're filtered out!
... View more
03-07-2019
08:33 PM
|
0
|
0
|
1052
|
POST
|
Hi Dan. Not exactly. The GDB does contain a single feature class, though what this script is intended to do is zip all of the files within a gdb as if you were viewing it through windows explorer (i.e. below). A colleague has helped out and found the solution was with the Return call at the end being incomplete. It should have looked like this [Zipfgdb() as the last line]; #Close zipfile object
ZIP.close()
#Return zipfile full path
return zipfl
Zipfgdb() GDB; ZIP;
... View more
03-07-2019
04:44 PM
|
0
|
2
|
1052
|
POST
|
I have a basic python code that is intended to take the contents of a File GDB and ZIP them (not that actual .gdb itself though). When I test the code it says it's all good. When I run the code however, it goes straight to "Exit Code 0" and nothing happens. No new ZIP file, nothing. Any ideas where I'm going wrong? import os
import shutil
import zipfile
# Creates a zip file containing the input shapefile
# inFileGDB: Full path to FileGDB folder to be zipped
# Delete: Set to True to delete fileGDB files after zip
# Creates a zip file containing the contents of a filegeodatabase
def Zipfgdb(inFileGDB = r'\\my\data\pathway\MyData.gdb', Delete = 'False'):
print inFileGDB + " : Delete original files = " + Delete
#Directory of file geodatabase
inLocation = os.path.dirname (inFileGDB)
print "inLocation: " + inLocation
#Base name of shapefile
inName = os.path.basename (os.path.splitext(inFileGDB)[0])
print "inName: " + inName
#Create the zipfile name
zipfl = os.path.join (inLocation, inName + ".zip")
print "New ZIP file: " + zipfl
#Create zipfile object
ZIP = zipfile.ZipFile (zipfl, "w")
print "ZIP file created"
#Iterate files in shapefile directory
for fl in os.listdir (inFileGDB):
#Get full path of file
inFile = os.path.join (inFileGDB, fl)
#Add file to zipfile. exclude any lock files
if os.path.splitext(fl)[1][1:] <> 'lock':
ZIP.write(inFile,fl)
print "files added to ZIP file"
#Delete filegeodatabase if indicated
if Delete == True:
shutil.rmtree(inFileGDB)
print "Original file deleted"
#Close zipfile object
ZIP.close()
#Return zipfile full path
return zipfl
... View more
03-06-2019
09:04 PM
|
0
|
4
|
1158
|
POST
|
Can someone please explain to me what the perceived benefits of using Contingent Values are instead of using SubTypes? Contingent values—Geodatabases | ArcGIS Desktop I understand that by using Contingent values you essentially have 2 lists (Domains), with the 2nd list being filtered by the selection from the first list. This compares to Subtypes where the selection of the first list would determine which secondary list another field looks to (multiple lists to pick from). Also, what I can't find anywhere is if I setup data using Contingent Values and publish the layer as a service to ArcOnline, will the Contingent values be honoured (and be editable via the Data tab on the service overview page as you can with Domains)?
... View more
02-04-2019
07:00 PM
|
1
|
4
|
3592
|
POST
|
Thanks for the tip. Linkkey should be unique as well so this shouldn't be an issue for us. Good to know how to deal with it if this were the case though.
... View more
11-25-2018
04:33 PM
|
0
|
1
|
1063
|
POST
|
I have 2 dictionaries (A and B). A is a new list of keys which is being checked against B. If a key is in B but not A (is an old value), I'm attempting to get the first value from the associated key in the dictionary (in this case an OBJECTID). The issues I'm having are with line 32. As far as I can tell, this should iterate through all the keys in B, see if they're in A, and if not, write their value to a text file. As it happens, the text file is just getting the full list of old values (dictionary B) instead of only the ones not in both feature classes/dictionaries. Where are we going wrong? I've attached the output text file import arcpy
# Set environmental variables
arcpy.env.overwriteOutput = True
new = r"W:\Mapping\ArcGIS Online\ArcGIS Online Features.gdb\Collector_patch" #new feature class
old = r"W:\Mapping\ArcGIS Online\Upload.gdb\AGOL_Export" #old feature class
field = 'LinkKey', 'OBJECTID' #feature class fields to compare & return
fout = r"W:\Mapping\ArcGIS Online\FPC Plantations Features to Delete.txt" #output text file
a = {}
b = {}
#The old feature class is loaded into dictionary b
with arcpy.da.SearchCursor(old, (field)) as rows:
for row in rows:
if row[0] not in b:
b[row[0]] = [row[1]]
#The new feature class is loaded into dictionary a
with arcpy.da.SearchCursor(new, (field)) as rows:
for row in rows:
if row[0] not in a:
a[row[0]] = [row[1]]
#Below compares the dictionaries and extracts features with old Linkkeys"
fo = open(fout, "w")
for k, v in b.iteritems():
if k not in a.items()[0]:
print k
print v
fo.write(str(v[0]) + ',')
print "Linkkeys not in new feature class exported"
fo.close()
... View more
11-23-2018
12:13 AM
|
1
|
5
|
1286
|
POST
|
I think it must have been the pathway. It was meant to be a complete path but I think the "gis" part was an alternative to the actual path of "bun-gis-01". I tweaked it and it worked so hopefully it keeps working. Thanks!
... View more
10-10-2018
12:38 AM
|
0
|
0
|
618
|
POST
|
I've got a pretty simple script that looks for the latest/newest file in a folder and copies it into a new location. The script works fine when run through a python GUI, but when run as a part of an Arc model, fails. Can someone translate the error for me? I don't understand why this is happening? import glob
import os
import shutil
import time
date = time.strftime("%Y-%m-%d")
dst = "//10.253.2.161/cddp/Bunbury Use Only/GeoMasterPatchArchives/" + date
list_of_files = glob.glob('//gis/Geomaster/*.bak') # * means all if need specific format then *.csv
latest_file = max(list_of_files, key=os.path.getctime)
shutil.copy(latest_file, dst)
print latest_file + " copied to backup folder"
... View more
10-09-2018
07:28 PM
|
0
|
2
|
721
|
POST
|
Where did you change these settings? I can't see anything in our Organisations AGOL account on the web.
... View more
09-20-2018
05:23 PM
|
0
|
1
|
1598
|
POST
|
I found a solution. I had a niggling feeling that it was the comparisons between original and current extent that was not behaving the way I expected. I originally thought this would be the best indication of the map having moved/changed based on the features in the layers. After seeing the scale print statements and how fine they were (i.e. oldscale = 404659.559547) I figured it would be highly unlikely these would ever occur twice. Thus, I changed the code from comparing original and current extent to scales and now it works as expected. Can't thank you enough for your help with this!
... View more
09-18-2018
07:08 PM
|
0
|
0
|
359
|
POST
|
Thanks for your help. Glad we at least got the index issues sorted! I'll have to look into python 3. Anything in particular here that won't talk in the new version? I'm guessing the syntax has changed?
... View more
09-18-2018
07:03 PM
|
0
|
1
|
359
|
POST
|
That makes sense and works (insert face plant here). The part that I must have been getting hung up on though is the desire for this to be returning a typical scale concentrated on a small area (i.e. 1:20,000), meaning that the logic I've used to get the map to focus on the grouped features isn't working as expected. Fore example. Before running the script, the map is focused on a selection of polygons in one location (EIG > 0 and EIGA = 0). I run this script to change the definition query to look at a different selection of polygons in a different location (where EIG = 0 and EIGA > 0). The code should examine the if query at Line 43 as False and skip to the next ELIF (Line 47) resulting in an unchanged dataframe extent (at this point). Next it should examine the if EIGA > 0 (Line 51) as TRUE then set the current extent variable. Line 54 sees the current extent compared to the original extent (should result in TRUE) and proceed to Line 55. It would apply the layer extent to the dataframe and step up to the next in the list. That should be the end of it but for some reason it is progressing through to the elif at Line 61 and finding that TRUE. I would expect this to be FALSE because the current_ext and orig_ext variables are unchanged (to my knowledge) despite the dataframe extent being updated so should result in no further action being taken. What actually seems to be happening is the code is running the ELIF (Line 61) as TRUE and comparing the min/max values from the old extent and the new extent resulting in a huge scale. This should only be getting run if there are new features in both layers which will be similarly geolocated. This does work as expected when both layers > 0.
... View more
09-18-2018
06:40 PM
|
0
|
4
|
3372
|
POST
|
I've eliminated a big chunk of code that doesn't apply to this MXD so the lines are different from the original but I've been trying to factor that into my post/responses. Still looks correct to me though here? I added in the print statements and this is the result when running a query where EIG = 0 and EIGA > 0 (sorry if I'm formatting this wrong - trying to break it up into the info/error sections). Executing: UpdateDefinitionQueries "Lake Muir 2" LM2 # # MLM7AFC
Start Time: Wed Sep 19 08:48:54 2018
Running script UpdateDefinitionQueries...
Entered In GeoMaster definition query updated
Entered In GeoMaster Archive definition query updated
scalelist: [5000, 7500, 10000, 12500, 20000, 25000, 30000, 40000, 50000, 60000, 70000, 75000, 80000, 90000, 100000]
old scale: 404659.559547
Failed script UpdateDefinitionQueries...
Traceback (most recent call last):
File "W:\Mapping\ToolboxPythonCodes\SCRIPTS\Update Definition Queries.py", line 78, in <module>
newscale = scalelist[bisect(scalelist, oldscale)] # bisect old scale to get new scale
IndexError: list index out of range
Failed to execute (UpdateDefinitionQueries). Failed at Wed Sep 19 08:49:05 2018 (Elapsed Time: 10.25 seconds)
... View more
09-18-2018
05:54 PM
|
0
|
6
|
3372
|
Title | Kudos | Posted |
---|---|---|
1 | Wednesday | |
1 | Monday | |
3 | Monday | |
1 | 11-16-2023 09:24 PM | |
1 | 05-22-2024 09:18 PM |
Online Status |
Offline
|
Date Last Visited |
Friday
|