|
POST
|
Unfortunately without specifics of what the variables are when the code errors, or even the exact error text, those of us trying to help are grasping as straws to some extent.
... View more
01-13-2015
01:09 PM
|
0
|
6
|
2559
|
|
POST
|
If you print out an example using all the variables along with the error messages, it might help narrow down the issue.
... View more
01-13-2015
09:49 AM
|
0
|
0
|
2559
|
|
POST
|
As imperfect as PatchFinder may be, I think it's batting average is higher than relying on Build Numbers, especially from applications other than ArcGIS Administrator. Looking at FAQ: What are the build numbers for releases of ArcGIS Desktop?, one can see that build numbers for ArcGIS 10.1 SP1 QIP are incorrect in ArcMap and ArcCatalog. The ArcGIS 9.3.1 SP2 QIP had a similar issue. Taking the above information together with the fact that most patches don't update build numbers, our organization has moved away from using build numbers for identifying anything beyond major/full releases. In fact, we have an Esri Support Case open right now over how to definitively show the OpenSSL patch has been applied because PatchFinder isn't showing the patch on some machines that it has been applied on. Of course, the issue only gets muddier when dealing with patching Background Geoprocessing as well as Desktop. Just be aware that identifying installed patches has historically been as much an art as a science.
... View more
01-13-2015
08:44 AM
|
2
|
0
|
2658
|
|
POST
|
I encourage you to check out Python string formatting. Not only is using built-in string formatting more Pythonic than concatenating several strings together, I would also argue it is more readable. First, I would just try restructuring the expression using string formatting to see if that works: expression = "{} = '{}' AND {} = '{}'".format(SelectCriteriaF,
str(list_UV_CriteriaF ),
SplitCriteria,
str(listSplit )) If that doesn't work, then you might have to try string replacement to insert an escape character before the quote. From looking at the code, I am not sure which variable is causing the problem, so I just replaced text on both. This might work: expression = "{} = '{}' AND {} = '{}'".format(SelectCriteriaF,
str(list_UV_CriteriaF ).replace("'","\\'"),
SplitCriteria,
str(listSplit ).replace("'","\\'"))
... View more
01-13-2015
07:51 AM
|
1
|
2
|
2559
|
|
POST
|
Another idea, are both your datasets in the same workspace? That is a requirement for this tool.
... View more
01-08-2015
02:46 PM
|
0
|
0
|
4821
|
|
POST
|
There is basically a bug in the expression builder. Try removing the quotations from around the fields. Even if you verify the expression and it fails, it can still run correctly. Not sure if this is exactly your problem, but I run into the errand quotations with the expression builder all the time.
... View more
01-08-2015
02:38 PM
|
0
|
0
|
4821
|
|
POST
|
Are your keys currently row numbers from a table? If so, you are basically treating a dictionary like a list, which is more awkward to work with than if it was just a list. The focus of the dictionary key should be the BuildingID, not the row number. Assuming you want each building to have the three hazards mentioned above, and only those three hazards, the following (untested) code might work: # import functions from modules that are available but not commonly imported
from collections import defaultdict
from numpy import fromiter, dtype
# group hazards by building
haz_group = defaultdict(list)
with arcpy.da.SearchCursor(in_table, ['BuildingID', 'HazardID']) as cur:
for k, v in cur:
haz_group .append(v)
# create iterable and populate with flagged buildings
build_iter = (k for (k, v) in haz_group.iteritems() if v.sort() != [16, 17, 18])
tmp1 = fromiter(build_iter, dtype([('BuildingID', 'S10')]))
# dump numpy array to table
arcpy.da.NumPyArrayToTable(tmp1, out_table)
# or just print BuildingIDs to console
for build in build_iter:
print build Note that if you are going to just print the buildings, drop lines 13 and 16 because line 13 will exhaust the generator so lines 19 and 20 won't print anything. Instead of creating a generator expression, you could use a list comprehension and the list would persist. I tend to work with generator expressions because lists can consume large amounts of memory with very large data sets. NOTE: Updated Line 12 to address the HazardID not necessarily being sorted in original table.
... View more
01-08-2015
01:44 PM
|
1
|
1
|
4533
|
|
POST
|
Your welcome. Keeping plugging away at learning Python, I know I have really enjoyed learning and applying it, there is so much you can do with it. Cheers....
... View more
01-08-2015
01:04 PM
|
0
|
0
|
2708
|
|
POST
|
I believe Add Geometry Attributes is replacing Calculate Geometry in ArcGIS Pro, at least that was the word during beta testing. UPDATE: Since ArcGIS Pro 2.2, a comparable Calculate Geometry tool has been available.
... View more
01-08-2015
11:10 AM
|
5
|
1
|
9288
|
|
POST
|
For inserting scripts, i.e., syntax highlighting, you need to use the advanced editor that is accessed from a link in the upper-right corner of the reply window/frame. Try the following: for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.symbologyType in ["GRADUATED_COLORS", "GRADUATED_SYMBOLS"]:
labels = lyr.symbology.classBreakLabels
for i, label in enumerate(labels):
labels = label.replace("_", " ")
lyr.symbology.classBreakLabels = labels
elif lyr.symbologyType in ["UNIQUE_VALUES"]:
labels = lyr.symbology.classLabels
for i, label in enumerate(labels):
labels = label.replace("_", " ")
lyr.symbology.classLabels = labels Since the class labels are properties and return a list, you need to "get" the lists, which is what I am doing in lines 03 and 08. Since the labels are stored in a list, you need to iterate over the list and do the text replace/substitution on each element of the list. Lines 04-05 and 09-10. There are several ways to handle this part. One could create a new list, using a for loop or list comprehension I chose to edit the existing list in place, using a for loop and an enumerate object. After the label updates are done, you need to "set" the properties to the new or updated lists, which is what I am doing in lines 06 and 11.
... View more
01-08-2015
10:52 AM
|
0
|
2
|
2708
|
|
POST
|
You can also use the new-ish Walk (arcpy.da) to find geo-related files and data, including maps.
... View more
01-08-2015
08:52 AM
|
0
|
0
|
2014
|
|
POST
|
You are misunderstanding what os.path.abspath actually does. From 10.1. os.path — Common pathname manipulations — Python 2.7.9 documentation: os.path.abspath(path) Return a normalized absolutized version of the pathname path. On most platforms, this is equivalent to calling the function normpath() as follows: normpath(join(os.getcwd(), path)). New in version 1.5.2. You are joining the current working directory of the command prompt or script to the name of the file. Try replacing line 11 with: filePath = os.path.join(root, filename)
... View more
01-08-2015
08:46 AM
|
0
|
2
|
2014
|
|
POST
|
If the data is already in a table, it might be more straightforward to run Summary Statistics. Generating a count, minimum, and maximum of NextColumn against BuildingID should get you what you are after. The count will let you know if there are only three records, and the minimum and maximum will show whether any of the values are less than 16 or more than 18. Something like: arcpy.Statistics_analysis(in_table,
out_table,
[ ["NextCol", "COUNT"], ["NextCol", "MIN"], ["NextCol", "MAX"] ],
["BuildIDCol"])
... View more
01-08-2015
08:01 AM
|
1
|
1
|
4533
|
|
POST
|
The following code from the interactive Python window in ArcMap should help get you going: mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.symbologyType in ["GRADUATED_COLORS", "GRADUATED_SYMBOLS"]:
print lyr.symbology.classBreakLabels
elif lyr.symbologyType in ["UNIQUE_VALUES"]:
print lyr.symbology.classLabels The classBreakLabels and classLabels properties are read-writeable and store lists. After you get the list, update the contents, and set the properties again; you will need to run arcpy.RefreshActiveView() to see the changes.
... View more
01-07-2015
03:52 PM
|
0
|
4
|
2708
|
|
POST
|
With ArcGIS 10.2.x, Microsoft SQL Server 2008 R2 Express with Advanced Services was included/distributed for use with Personal and Workgroup SDE. I noticed with ArcGIS 10.3 that Microsoft SQL Server 2012 Express, without Advanced Services, is being included/distributed for use with Desktop Database (fka Personal SDE) and Workgroup Database. I believe it was ArcGIS 9.3 where Esri switched over to SQL Server Express with Advanced Services. The ArcGIS 10.2.x Help shines some light on why. Making sure SQL Server Express with Advanced Services is installed: The edition of Microsoft SQL Server Express being used for your database server can be determined from the database server Properties dialog box. XML columns are only supported with SQL Server Express Edition with Advanced Services that have Full-Text Search installed. The Full-Text Search component is required to support the native XML columns used by the geodatabase system tables; when installing SQL Server Express Edition with Advanced Services, you must install Full-Text Search. Other editions of SQL Server Express do not include support for full-text searching. Obviously, something has changed with ArcGIS 10.3 or SQL Server Express 2012 that is allowing Esri to drop the need for Advanced Services, but what exactly and where is it documented? I welcome the change for many reasons, one of which being Advanced Services mushroomed the download or package size from ~250MB to the ~1.5GB. Eliminating SQL Server services simplifies installation and administration and could reduce the security-related footprint of running SQL Server Express, which is good in an organization that deploys as many Desktop and Workgroup Databases as the one I work for currently. This change also piques my interest because it makes me wonder whether SQL Server Express LocalDB support is around the corner.
... View more
01-07-2015
02:48 PM
|
0
|
2
|
6743
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-11-2026 07:04 AM | |
| 1 | 07-17-2026 06:54 AM | |
| 2 | 07-06-2026 12:29 PM | |
| 1 | 07-06-2026 12:00 PM | |
| 2 | 06-05-2026 10:30 AM |
| Online Status |
Offline
|
| Date Last Visited |
8 hours ago
|