|
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
|
2027
|
|
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
|
6293
|
|
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
|
2027
|
|
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
|
1439
|
|
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
|
1439
|
|
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
|
2844
|
|
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
|
2027
|
|
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
|
6341
|
|
POST
|
Honestly, I think your earlier code was easier to read and fairly close to working/workable. The error trapping at the end confuses me because the try statement is at the same indentation as the for statement that loops through the cursor, so cursor.next() should always generate an error by the time it gets to that line. Also, I think the break statement is prematurely breaking you out of one of your cursors. Without having access to sample data to walk through the code with, I have to bow out. Best of luck.
... View more
01-07-2015
12:42 PM
|
1
|
1
|
1856
|
|
POST
|
From 4 months ago in the beta forums for ArcGIS Pro: Charlie Macleod (Esri Staff\Beta Testers\Pro SDK Beta Testers): So, with regards to the SDK, there is no Beta SDK release with Pro Beta5 or pre-release, With regards to the API - right, so, unlike with Arcobjects where a separate set of PIAs were required - "the" Arcobject API if you like - as ArcGIS Pro is managed you already ~have~ the API. The API is part of the product. Add any Pro .Net assembly reference into to a .Net project and Intellisense will show you the API. The Core.Data namespace is indeed the fine grained API. It comes with every release - Beta5, pre-release, etc. as does every other Pro .Net assembly and its API. Each team is responsible for their respective API - mapping team for mapping API, editing team for editing API and so on. The SDK for Pro is the IDE extensibility - Visual Studio 2013 initially. It extends Pro via Pro's framework (essentially any of the UI elements you see in Pro are extensibility points). You use the SDK templates to make Addins - same as at 10x. What the Addins can do is provided by the ArcGIS Pro APIs.
... View more
01-07-2015
08:36 AM
|
0
|
0
|
599
|
|
POST
|
I will have to look at the script more later, but a quick response to your #1. What is it about u'LASTNAME' that you see as wrong? Is it all caps and it shouldn't be? Is it the Unicode notation in front of the first quote? If it is the latter, you have nothing to worry about. The 'u' isn't part of the actual string, it is simply informing you that the string has been stored as Unicode. You shouldn't have any issues passing that Unicode string back into a feature class, but on the remote chance there is an issue, you can always convert it to ASCII.
... View more
01-07-2015
07:58 AM
|
1
|
4
|
1856
|
|
POST
|
Several years back, Microsoft made an announcement that it was moving forward with more focus on ODBC and moving away from OLE DB for connecting to SQL Server. Nearly two years ago, Microsoft introduced the new Microsoft ODBC Drivers for SQL Server. Beyond introducing these new drivers, Microsoft announced the beginning of the end for the SQL Server Native Client. What's New in SQL Server Native Client (2012): SQL Server 2012 contains the final version of SQL Server Native Client. SQL Server Native Client will not be updated in future releases of SQL Server. However, as a convenience to developers, SQL Server 2012 Native Client will ship in future releases of SQL Server. Recently, I was looking over the Microsoft SQL Server database requirements for ArcGIS 10.3. Microsoft SQL Server 2012 SP1? Check. Microsoft SQL Server 2014? Check. As expected, the page addresses the software you need to connect to SQL Server. Software required to connect to a DBMS Your client machine (for example, the one running ArcMap) will need to have the appropriate client files installed for the RDBMS you are using. These client files are available from their respective RDBMS vendors, but some are also available on My Esri as a convenience. See Database clients for more information. So far, so good. Looking at the database clients page, something did grab my attention. Specifically, the page lists Microsoft SQL Server native client and Microsoft ODBC driver 11 for SQL Server. Well, maybe the deprecated native client was included for backwards compatibility with older versions of SQL Server since ArcGIS 10.3 does support back to SQL Server 2008 SP3. Unfortunately, that argument didn't hold up because the download page for Microsoft ODBC Driver 11 for SQL Server - Windows states that the ODBC driver is backwards compatible to SQL Server 2005 even older than what ArcGIS 10.3 supports. The situation got even worse when I looked at the Help pages for administering geodatabases. The Connect to SQL Server from ArcGIS page actively instructs users to install a now-deprecated client to connect to SQL Server. Connect from ArcGIS for Desktop To connect to a database or geodatabase in SQL Server from ArcGIS for Desktop, install the SQL Server native client on the ArcGIS for Desktop computer and create a connection file in the Catalog tree. First, though, be sure your SQL Server instance can accept connections from remote computers. The worst part of it all, though, is that the most appropriate driver to use isn't even mentioned once in the whole page talking about connecting to SQL Server. The SQL Server Native Client may very well work for most, if not all, situations involving ArcGIS 10.3, but it seems a better practice to move users over to the more current driver while both drivers still work rather than wait for the next version of SQL Server where connections could stop working. Microsoft has been encouraging users to switch for years, I think it is time for Esri to finally start.
... View more
01-06-2015
02:34 PM
|
8
|
0
|
11333
|
|
POST
|
On line 28, try replacing wells with wells1. The SelectLayerByLocation needs to have the selected feature(s) passed to it and not the original feature class.
... View more
01-06-2015
11:20 AM
|
0
|
1
|
3431
|
|
POST
|
There are a couple or more ways to get this working. One of the quickest to implement, although it might not be the most peformant, is to include a SelectLayerByAttribute_management statement before the select by location: # Create search cursor which will iterate through wells, selecting all centroids within a distance
with arcpy.da.SearchCursor(wells, ["OBJECTID"]) as cursor:
for row in cursor:
# select by attribute
SelectLayerByAttribute_management (wells,
"NEW_SELECTION",
"OBJECTID = {}".format(row[0]))
# select by location
arcpy.SelectLayerByLocation_management("orps09_FL",
"WITHIN_A_DISTANCE",
wells,
"0.5 kilometers",
"NEW_SELECTION") The above assumes that OBJECTID is numeric and not a string.
... View more
01-06-2015
09:17 AM
|
0
|
3
|
3432
|
|
POST
|
Are you sure the script is running at all when called from the command line by your other program? If you try printing 'hello world' from the script, does that even work from the command line?
... View more
01-05-2015
07:36 PM
|
0
|
0
|
2833
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | 2 weeks ago | |
| 1 | 4 weeks ago | |
| 1 | 12-02-2025 07:31 AM | |
| 1 | 11-03-2025 08:26 AM |
| Online Status |
Online
|
| Date Last Visited |
2 hours ago
|