|
POST
|
Why are you commenting out the stopOperation call? According to the ArcPy Data Access Editor documentation (red emphasis added): Note: Deviating from this pattern can cause unexpected results. For example, stopEditing should not be called while an edit operation is in progress. Instead, abort the edit operation and stop the edit session.
... View more
12-21-2015
11:06 AM
|
1
|
11
|
5432
|
|
POST
|
The time it takes for your script to run is being driven by geoprocessing, not finding/listing/enumerating your rasters. You may shave a few minutes here or there, but I don't expect any real change in runtime based on ListDataSets or Walk. Regarding using Walk, can you elaborate on "did not work?" Did it generate an error? If so, what error? What backend storage is holding your raster catalog? File geodatabase? Enterprise geodatabase (SDE)?
... View more
12-21-2015
10:52 AM
|
0
|
2
|
3919
|
|
POST
|
Like all other tools, the best address parser is the one that someone else already wrote. Lately, I have been using usaddress and have been quiet happy with it. Granted, it doesn't validate addresses, but it also doesn't carry all the bulky overhead of other geocoding services when all I want to do is parse addresses.
... View more
12-17-2015
11:39 AM
|
1
|
0
|
1807
|
|
POST
|
I have a test machine with ArcGIS 10.3.1 (Desktop and SDE) and SQL Server 2014, and I don't have a problem with the versioned view getting updated after changes to the original table. I wonder if there was a bug that has been addressed in 10.3 or 10.3.1.
... View more
12-16-2015
08:10 PM
|
0
|
0
|
1585
|
|
POST
|
I am running ArcGIS 10.3.1 + SQL Server 2014 + direct connect, and arcpy.TestSchemaLock returns True for me with unversioned feature classes, as long as another process isn't accessing the data. I don't know if the difference is our ArcGIS versions, DBMS versions, DBMS configurations, etc.... It might be worth googling around for "ArcGIS issues addressed" and see if there have been any issues addressed in 10.2.x or 10.3.x related to testing schema locks.
... View more
12-16-2015
02:03 PM
|
0
|
1
|
4624
|
|
POST
|
Given the frequency and number of updates you are doing, am I correct in assuming these aren't versioned data in the enterprise geodatabase? If true, i.e., not-versioned, then you will want to use the Truncate tool. In the database world, deleting all of the records from a table and truncating a table are very different things. Deleting records involves database transactions, which can allow recovery of deleted data if needed, hence why it doesn't go as quickly as new users think it should. Truncating a table is usually much faster, but don't think about trying to recover the data.
... View more
12-16-2015
01:45 PM
|
6
|
3
|
6700
|
|
POST
|
Are you processing shape files, by chance? Since your code worked fine on a feature class I had in a file geodatabase, it got me thinking about different storage formats having different field delimiters. I know shape files use quotes, and I think file geodatabases used to or still do in some circumstances. Anyhow, I wonder if the quotes are already there and you are substituting your expression within the existing quotes, so it looks like you are passing quotes when you are not actually doing so. Since I don't have one of your MXDs to look at, that is the best guess I can come up with. Otherwise, I am stumped.
... View more
12-16-2015
08:20 AM
|
0
|
2
|
1880
|
|
POST
|
Coincidentally, another script I was working on came across the attached MXD that I downloaded and it crashed. When I ran the code earlier, it was in the interactive Python window. When I ran the code again through a stand-alone interactive Python session, it crashed. Also, I tried to run MXD Doctor on it, and it crashed MXD Doctor. I tried running ArcGIS Document Defragmenter, and it opens it but just hangs. I have run into this before, i.e., where an MXD will open in ArcMap but basically crashes when trying to open it any other way. The file is definitely corrupt, although it is frustrating because finding out why or fixing it appears to be impossible. It is frustrating, for sure, when code finds these kinds of MXDs because error trapping doesn't work so everything bombs. I guess flagging it and avoiding it are the best you can hope for at this point.
... View more
12-16-2015
08:08 AM
|
1
|
1
|
2788
|
|
POST
|
I just tried your code on an MXD I threw together and everything worked fine, the definition query was updated properly and not extraneous quotes were included. At some point is the code generating an error on your end? If so, sharing the specific error message/output might be helpful to others.
... View more
12-16-2015
07:06 AM
|
0
|
4
|
1880
|
|
POST
|
What version of ArcGIS are you running? The machine I am working on this morning has a beta build of the upcoming release, and it processed the attached MXD using the attached Python code without any issues. I ended up with the following being printed out to console along with an entry in a csv file: not sde
completed If I get a chance later today, I will get on a machine with ArcGIS 10.3.1 and try it there as well. Have you tried walking through the code with an IDE to see exactly which call is causing Python to crash?
... View more
12-16-2015
06:30 AM
|
1
|
3
|
2788
|
|
POST
|
On the surface, it seems like using OBJECTID this way should work, but I also don't understand Esri's sequencing of that field well enough to say accurate results are guaranteed. One of the classic approaches, i.e., has been around for a long time and is SQL ANSI compatible, to solving this problem in the DBMS realm uses NOT EXISTS: qry = "NOT EXISTS (SELECT 1 FROM fc f WHERE fc.id = f.id AND f.version > fc.version)"
arcpy.SelectLayerByAttribute_management(layerName, "NEW_SELECTION", qry) One note of caution with using this approach. Although the SQL reference for query expressions used in ArcGIS documentation states, "EXISTS is supported in file, personal, and ArcSDE geodatabases ...," the type of expression above provides bogus results for file geodatabases. The results are accurate for personal geodatabases and all enterprise geodatabases I have tried.
... View more
12-15-2015
06:47 PM
|
4
|
11
|
7711
|
|
POST
|
If you set your workspace to a raster catalog, then ListDatasets will list the contents of the raster catalog. It seems a bit goofy, but it works. That said, I like to use the Walk function that is part of the Data Access module. rasCatalog = # path to raster
_, _, rasterList = next(arcpy.da.Walk(rasCatalog))
... View more
12-15-2015
04:00 PM
|
1
|
4
|
3919
|
|
POST
|
If you run the code only on the problem MXD does it crash, or does it crash only when it finds it after processing other MXDs? If the former, can you attach the MXD by chance?
... View more
12-15-2015
03:34 PM
|
0
|
5
|
2788
|
|
POST
|
It is always helpful to post specific error messages, either the code and result if scripting or a screenshot in using the GUI. That said, ArcGIS for Desktop is a 32-bit application so it has some memory limitations regardless of how much memory the operating system is running. If you run task manager and watch the memory usage, how high is it getting before getting the error message?
... View more
12-15-2015
03:25 PM
|
1
|
1
|
4934
|
|
POST
|
I am guessing you are building your where clause incorrectly, but I can't say for sure unless you post the specific code and error message(s). If the maximum Version number is the same across all IDs at any given time, then it simplifies the situation and using a basic subquery with MAX will work: >>> lyr_name = 'tmpLayer'
>>> fc_name = 'tmpFC'
>>> ws = arcpy.env.workspace
>>> fc = arcpy.CreateFeatureclass_management(ws, fc_name, "POINT")
>>> arcpy.AddField_management(fc, "ID", "TEXT", field_length=1)
<Result 'C:\\Users\\bixb0012\\Documents\\ArcGIS\\Default.gdb\\tmpFC'>
>>> arcpy.AddField_management(fc, "Version", "LONG")
<Result 'C:\\Users\\bixb0012\\Documents\\ArcGIS\\Default.gdb\\tmpFC'>
>>> cur = arcpy.da.InsertCursor(fc,["ID", "Version"])
>>> [cur.insertRow([i,j]) for i in ("A", "B") for j in (1, 2)]
[1L, 2L, 3L, 4L]
>>> del cur
>>> lyr = arcpy.MakeFeatureLayer_management(fc, lyr_name, "Version = (SELECT MAX(Version) FROM {})".format(fc_name))
>>> arcpy.GetCount_management(lyr)
<Result '2'>
>>> [row for row in arcpy.da.SearchCursor(lyr, ["ID", "Version"])]
[(u'A', 2), (u'B', 2)]
>>> If the maximum Version number can be different across all IDs at any given time, then the situation gets more complicated because you will have to use a semi-join instead of a basic equality operator. I recommend looking at query layers regardless of whether the Version numbers increment uniformly. The documentation for SQL reference for query expressions used in ArcGIS points out some important limitations to using subqueries, especially with versioned data: Coverages, shapefiles, and other nongeodatabase file-based data sources do not support subqueries. Subqueries that are performed on versioned ArcSDE feature classes and tables will not return features that are stored in the delta tables. File geodatabases provide the limited support for subqueries explained in this section, while personal and ArcSDE geodatabases provide full support. For information on the full set of subquery capabilities of personal and ArcSDE geodatabases, refer to your DBMS documentation.
... View more
12-14-2015
11:44 AM
|
1
|
2
|
7710
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 4 weeks ago | |
| 2 | 07-06-2026 12:29 PM | |
| 1 | 07-06-2026 12:00 PM | |
| 2 | 06-05-2026 10:30 AM | |
| 1 | 05-29-2026 08:22 AM |
| Online Status |
Online
|
| Date Last Visited |
6 hours ago
|