|
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
|
3118
|
|
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
|
8160
|
|
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
|
8160
|
|
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
|
8160
|
|
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
|
3118
|
|
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
|
3672
|
|
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
|
2835
|
|
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
|
2973
|
|
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
|
2835
|
|
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
|
2835
|
|
POST
|
If you are willing to install comtypes, then the SDE connection properties can be extracted without actually connecting to the database. I ginned up the following function, just pass it the SDE connection file and it returns a dictionary with all of the connection properties. def GetConnectionPropertiesFromFile(in_workspace):
from comtypes.client import CreateObject, GetModule
import os
comDirectory = os.path.join(
os.path.join(arcpy.GetInstallInfo()['InstallDir']), 'com'
)
esriDataSourcesGDB = GetModule(os.path.join(comDirectory, 'esriDataSourcesGDB.olb'))
esriGeoDatabase = GetModule(os.path.join(comDirectory, 'esriGeodatabase.olb'))
pWSF = CreateObject(esriDataSourcesGDB.SdeWorkspaceFactory,
interface=esriGeoDatabase.IWorkspaceFactory)
pPropSet = pWSF.ReadConnectionPropertiesFromFile(in_workspace)
names, values = pPropSet.GetAllProperties()
connectionProperties = {}
for i in range(len(names)):
connectionProperties[names] = values
return connectionProperties
... View more
03-30-2015
01:16 PM
|
1
|
0
|
4163
|
|
POST
|
Since Application Servers are dead at ArcGIS 10.3, I don't think Esri is going to invest anything in making it easier to identify them. The "Database Platform" field you reference is relatively new-ish, starting at ArcGIS 10.1. Although the GUI shows this new field, I don't believe there were any changes with the workspace connection properties data structure on the backend. In the end, returning a Database Platform value would have to be from a function that processes the connection properties and not directly from the connection properties themselves. You raise an interesting, and annoying, part of processing SDE connection files. I primarily work with operating system authentication, so the issue of having the username/password prompt doesn't usually impact me. That said, it is frustrating that one has to fully authenticate for ArcPy to see any of the connection properties. When working with the GUI, a user can look at several connection properties without having to actually connect to the database. It would be nice to see similar behavior in ArcPy if no username or password are given.
... View more
03-30-2015
11:09 AM
|
1
|
0
|
4163
|
|
POST
|
What about passing an array variable (Cursor.arrayvar) instead of a cursor?
... View more
03-26-2015
02:28 PM
|
0
|
3
|
2525
|
|
POST
|
ListUsers() is focused on existing/current connections to an SDE database, not SDE connection files on disk, which is what I think the OP is after. I believe the connectionProperties of the Workspace properties of the Describe object will allow the OP to get the information. >>> desc = arcpy.Describe(r'Database Connections\LGDB.sde')
>>> cp = desc.connectionProperties
>>> cp.instance
u'sde:sqlserver:(localdb)\\MSSQLLocalDB' For an application server, the instance property will look something like: u'5152:SDE'
... View more
03-26-2015
02:03 PM
|
1
|
4
|
4163
|
|
POST
|
32-bit. It would be interesting whether 64-bit SciPy would make a difference. And yes, in chunks. My original NumPy code worked in chunks anyways to make the memory footprint lower at the expense of slightly slower code.
... View more
03-25-2015
02:34 PM
|
0
|
0
|
1548
|
| 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 |
Wednesday
|