|
POST
|
It is "ORDER BY", not "ORDER_BY" with the underscore between the two. What is the exact message when you try: with arcpy.da.UpdateCursor(lyrkartenausschn, seitenzkartenausschn, sql_clause=(None, "ORDER BY Nummer")) as cursor:
... View more
04-07-2015
01:08 PM
|
0
|
16
|
4941
|
|
POST
|
What if you comment out only the two mxd.dataDrivenPages lines, does the code work then?
... View more
04-07-2015
01:03 PM
|
0
|
2
|
7118
|
|
POST
|
For starters, I encourage you to read up on and use cursors from the data access module. The data access cursors are much more robust and efficient than the older style cursors. Querying dates and times is highly specific to the storage format. Have you read the SQL reference for query expressions used in ArcGIS, particularly the section on Dates and time? What storage format are you working with?
... View more
04-07-2015
11:16 AM
|
1
|
0
|
853
|
|
POST
|
You got so much help on this, and a couple other questions, it begs the question whether it is appropriate to mark your own answer correct. The "Correct" answer should be the one from another user that helped the most in rewriting your code block above, at least in my opinion.
... View more
04-07-2015
10:59 AM
|
2
|
4
|
2318
|
|
POST
|
Regarding the 1st question, it might be best to ask Esri Support since we are talking SDE system tables in a production geodatabases. For the 2nd question, does using ST_X and ST_Y not work for you?
... View more
04-01-2015
02:49 PM
|
0
|
1
|
7983
|
|
POST
|
It would be most helpful if you could provide a sample, a specific sample with both columns next to each other and 10 or so rows. It seems you are trying to index the cursor much like you do lists in Python. Although lists and cursors are both iterable, it doesn't make them the same in terms of methods and handling. I can't say I understand what you are trying to do, but I think I am starting to find the ballpark. cur = arcpy.da.UpdateCursor('SORT_B', ['MO', 'Statem'])
next(cur)
MO = row[0]
Moi = (MO - 10)
cur.updateRow([MO, Moi])
for row in cur:
Moi = (row[0] - MO)
MO = row[0]
cur.updateRow([MO, Moi])
... View more
04-01-2015
02:41 PM
|
1
|
1
|
3027
|
|
POST
|
I checked the spatial reference table in one of our Oracle 11g2 10.2.2 instances. It has 5,269 entries with only 1 below SRID of 1000, and that is SRID = 0. Interestingly enough, the name for SRID 0 is the same as for SRID 4326, i.e., GCS_WGS_1984. Regarding 6152, it looks like I fat-fingered it. Try 4152.
... View more
04-01-2015
01:55 PM
|
1
|
3
|
7983
|
|
POST
|
Your stateplane data doesn't have the same datum, i.e., NAD83 != WGS84, which is what I think is throwing the error. NAD83 and WGS84 may be very similar, and even treated the same in some transformations, but they aren't the same. St_transform appears to want the datums to be exactly the same. Try SRIDs of 6152 and 4269. I am thinking the former might work.
... View more
04-01-2015
09:46 AM
|
0
|
6
|
7983
|
|
POST
|
The SRID value for WGS84 isn't 0, it is 4326. For most systems, there is no spatial reference with an SRID value of 0, 0 is usually used by default to say there is no SRID value. If all datasets have SRID of 0, you can calculate against them but mixing SRID of 0 with other values usually causes issues. Also, you appear to be running into this issue, which I think still applies to st_transform even though the KB doesn't state it: Error: ORA-20603: Spatial References are not compatible (from ST_Transform)
... View more
04-01-2015
09:25 AM
|
0
|
8
|
7983
|
|
POST
|
You are mixing up the two different types of update cursors. You are creating an arcpy.da update cursor but are trying to work with it like an older update cursor. Also the variables "Mo" and "MO" aren't the same, Python is case sensitive. Does the following work for a test: cur = arcpy.da.UpdateCursor('SORT.shp', ['MO', 'Statem'])
for row in cur:
MO = row[0]
Moi = (MO - 10)
cur.updateRow([MO, Moi])
... View more
04-01-2015
08:27 AM
|
2
|
3
|
3027
|
|
POST
|
I encourage you to learn about Python string formatting (Format String Syntax). It is extremely robust. cursor = arcpy.da.SearchCursor(tc,["ADDR"],"SA_House_Number = {}".format(HouseNumber))
... View more
03-31-2015
06:17 AM
|
1
|
2
|
3572
|
|
POST
|
The cursor is treating Valie as a string because it is just that, a string. Overall, and especially since it looks like you are storing numbers as text, I encourage you to convert Valie from a string field to some form of numeric field. Normally I would suggest using a CAST function within your ORDER BY clause, but I have never had success getting that to work with the sql_clause of ArcPy cursors. From my read of the documentation, I am unclear whether it is supported only in subqueries for certain data formats or whether it is more generally supported. If you find out or get it working, please share. One final option that I know works with search cursors, but I don't know how it would behave with update cursors, is to use Python's built-in sorting methods. Also, this could be a big performance bust on larger data sets. In effect, you presort the cursor just before iterating over it: cur = arcpy.da.SearchCursor(in_table, field_names)
i = #index of Valie field
for row in sorted(cur, key=lambda f: int(f)):
print row Overall, your life will be much much simpler if you can convert Valie to a numeric field or create a new field that is numeric to base your sorting/ordering upon.
... View more
03-30-2015
05:26 PM
|
1
|
1
|
2732
|
|
POST
|
The error message indicates a SQL Server client is installed, just an older one that isn't compatible with the version of SQL Server on the other end. I suggest installing the Microsoft® ODBC Driver 11 for SQL Server® - Windows. I believe Esri is now packaging both the newer Microsoft ODBC Driver 11 and the older Native Client, but Microsoft has stopped updating the ODBC driver that is part of Native Client since they are moving forward using ODBC as the standard for native access to SQL Server and Windows Azure SQL Database.
... View more
03-30-2015
03:40 PM
|
0
|
0
|
2869
|
|
POST
|
If you need records processed in a certain order, don't use the system-generated and system-managed unique identifier field. For one, the insert and update cursors don't allow users to directly manage/change those fields so you aren't going to be able to do what you want to do with those field. Second, an insert cursor is more like appending to a list than inserting in a list because it doesn't allow you to specify where in the table the record will be inserted. Which leads me to my third point, you are going to have to use an ORDER BY clause on your cursors with your newly created order-processing field.
... View more
03-30-2015
03:26 PM
|
2
|
3
|
2732
|
|
POST
|
Can you explain why you are trying to do what you are trying to do? Before diving into technical specifics, I think there are some logical issues that need to be sorted out first. For example, what does inserting a new record at the "top" of the table get you? For that matter, what do you mean by "top" of a table? In SQL, the ordering of data isn't guaranteed unless you specify an ORDER BY clause. Without using an ORDER BY clause, there are no guarantees that data will be retrieved in a certain, or even consistent, manner. ArcGIS Desktop seems to present rows to the user ordered by ObjectID or FID, but I don't know if that is guaranteed. Even if it is, it is an Esri-ism and not standard with SQL or DMBSes. Looking at technical issues, what specifically are your error messages? Specific error messages are helpful. Regarding insert and update cursors, you can't manipulate the built-in unique identifier field, it is managed by the system. Just think of the mayhem that could ensue if users could arbitrarily update a system generated and managed field.
... View more
03-30-2015
02:24 PM
|
2
|
5
|
2732
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | a month ago | |
| 1 | 05-29-2026 08:22 AM | |
| 1 | 06-02-2026 06:16 AM | |
| 3 | 06-01-2026 01:55 PM | |
| 1 | 05-22-2026 05:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|