|
POST
|
The shapefile has been corrupted. Normally this is due to manipulation of the .dbf file by some dBase-III+ aware utility which is NOT shapefile aware. But in this case, it's probable that you've simply exceeded the valid feature count on the shapefile format (the limit is based on vertex count [~76M vertices], so the actual feature limit is dependent on average vertices per feature; once the .shp writer exceeds 2^31 bytes, it stops trying). Your best bet to avoid this is to use file geodatabase, not shapefile (FGDB is also much smaller, since it uses compression and variable width strings). - V
... View more
09-20-2023
11:26 AM
|
1
|
0
|
11007
|
|
POST
|
I've been 64-bit Python for a while now, so I'll admit to getting complacent about caching 6-12GiB of data in an app to write 60 million complex features in a few minutes. And that was ~10 years back, when 27GiB was a large VM. My rule of thumb is to avoid nesting cursors. Cache with SearchCursor and then Insert or Update. Ba-da-bing, ba-da-boom. Generators are a wonderful trick for managing a non-cursor stream, but I worry about interaction with the underlying object via ArcObjects if selection sets and schema modifications are at play. - V
... View more
09-15-2023
06:24 PM
|
1
|
1
|
5702
|
|
POST
|
Looping on a data source that you are also running selection operations is always going to cause grief. I'd suggest you make an array or a dictionary from the search cursor, then loop on the array/dictionary contents (as Hayden has done). While it is true that selections run against layers, not sources, playing fast with both at the same time is just trouble. - V
... View more
09-15-2023
02:02 PM
|
1
|
3
|
5719
|
|
POST
|
What are you quoting there, Dan? Because "multi-part" and "multi-ring" get conflated. The rules in the underlying SgShape API are clear: A polygon is defined by one or more (non-self-intersecting) rings. One ring is clearly not multi-part, but an island with a lake (or a county with a contained city) is multi-ring, but still single-part (the underlying API calls internal rings "subparts"). What we have here is two different definitions in the same API (which can happen when three different models are merged): The arcpy.Polygon.isMultipart method uses the Boolean for "has multiple rings" The arcpy.Polygon.partCount method uses parts and subparts definition for parts This script: import arcpy
sr = arcpy.SpatialReference(4326)
sr.setFalseOriginAndUnits(-400.0,-400.0,1000)
p1r1_wkt = 'POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0))'
p1r2_wkt = 'POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4))'
p2r2_wkt = 'MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0)), ((5 5, 9 5, 9 9, 5 9, 5 5)))'
p2r3_wkt = 'MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 3 1, 3 3, 1 3, 3 3)), ((5 5, 9 5, 9 9, 5 9, 5 5)))'
for wkt in [p1r1_wkt,p1r2_wkt,p2r2_wkt,p2r3_wkt]:
geom = arcpy.FromWKT(wkt,sr)
isMulti = geom.isMultipart
partCount = geom.partCount
ringCount = geom.boundary().partCount
print(f"{wkt}\nMultipart: {isMulti}, Part Count: {partCount}, Ring Count: {ringCount}\n") returns: POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0))
Multipart: False, Part Count: 1, Ring Count: 1
POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4))
Multipart: True, Part Count: 1, Ring Count: 2
MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0)), ((5 5, 9 5, 9 9, 5 9, 5 5)))
Multipart: True, Part Count: 2, Ring Count: 2
MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 3 1, 3 3, 1 3, 3 3)), ((5 5, 9 5, 9 9, 5 9, 5 5)))
Multipart: True, Part Count: 2, Ring Count: 3 so we can see the dichotomy. If you want to use the OGC definition of Polygon, then you have to deal with three conditions: Zero rings ("POLYGON EMPTY") [In the Esri lexicon, this is a Nil-type geometry, not a Polygon] One ring One external ring and one or more internal rings So, at this point it becomes rote: geom.isMultipart really means "Has multiple rings" and, geom.partCount == 1 is really "Is single part?" If you really want to know how many rings are present, use geom.boundary().partCount - V
... View more
09-12-2023
08:45 AM
|
1
|
0
|
2306
|
|
POST
|
If you have different data sources, then the format change is not just an ArcPy quirk -- It may just be what is required by the differing SQL providers. Even file geodatabase and shapefile are different. Python treats all strings as immutable, so the expression s = 'a' + 'b' + 'c' + 'd' generates seven objects through an alloc()/free() sequence (keeping only the last), which is slower than "{:s}{:s}{:s}{:s}".format('a','b','c','d') . When you add in the frequent formatting mistakes caused by string math and failure of some objects to format as string correctly, it's easy to see why this "feature" of the language isn't encouraged (and why f"" was added at Python 3). Try it (noting that the FGDB string had a formatting error without the space between "timestamp" and the apostrophe) qry = f"REPORTDATE >= timestamp '{startdate}' AND REPORTDATE <= timestamp '{enddate}'" - V
... View more
09-11-2023
09:47 AM
|
1
|
1
|
1375
|
|
POST
|
You haven't specified the data source type, so it's difficult to know what the SQL syntax of the provider requires, and what is optional (in PostgreSQL, you'd cast the string with 'ISO_string'::timestamp). String math is not best practice (slower and difficult to layout and debug). Instead, you really ought to use "".format() or f"" formatting. - V
... View more
09-08-2023
01:39 PM
|
1
|
3
|
1419
|
|
POST
|
You haven't described how you made polygons from PDFs, or described what would constitute an accurate (or inaccurate) polygon. While it is possible to include too much information, there's no risk of that here. A screenshot, annotated in Paint to show both accurate and inaccurate features would be useful. - V
... View more
09-07-2023
07:24 AM
|
1
|
0
|
1583
|
|
POST
|
-2035 is a low-level "SG_SELF_INTERSECTING" error. -2008 is "SG_SHAPE_INTEGRITY_ERROR". You should probably convert the SDO geometries to file geodatabase, then do a Repair Geometry there, then tie them back across. - V PS: Note that there are TWO validation procedures (at least). One uses the SDO function. The other is the ArcPy Check Geometry (and its sibling, Repair Geometry) Note that some "repairs" will corrupt the original intended shape (as when a "bowtie" rectangle is converted into two touching triangles, not a properly ordered quadrilateral), so you should review any repairs.
... View more
08-28-2023
06:45 AM
|
0
|
1
|
4762
|
|
POST
|
You haven't mentioned the Oracle release in use, but I've always used SDO_UTIL.TO_WKTGEOMETRY to generate Well-Known Text out of SDO_GEOMETRY. SELECT objectid,
SDO_UTIL.TO_WKTGEOMETRY(geom) as wkt
FROM schema.tablename At one point I ran into a bug (in an Oracle 19c patch release) where the SDO_UTIL function would produce invalid scientific notation near the Equator or Prime Meridian (e.g., "0.12345e-1.0" instead of "0.12345e-1"), and I had to wrap the arcpy.FromWKT parser with a repair function. You might want to assure that the source SDO_GEOMETRY is valid before passing it into SDE.ST_GEOMETRY. - V
... View more
08-24-2023
10:23 AM
|
1
|
5
|
4850
|
|
POST
|
There's lots of variables here: The RDBMS, the frequency of data layer creation, the mechanisms used to maintain data contents, use of versioning, availability of SQL admin tool, individual DBA comfort with direct SQL queries,... I often have a SQL script to paste into a DB client (pgAdmin,...), with a follow-up ArcPy script to register as necessary. I once had an ArcPy script that loaded 40 tables into a temporary schema with FeatureClassToGeodatabase, then issued tens of thousands of SQL statements through ArcSDESQLExecute cursors to repopulate the 400M row publishing database. - V
... View more
08-22-2023
10:28 AM
|
0
|
1
|
2116
|
|
POST
|
If it's registered, then there's a layers table entry which could be UPDATEd. Personally, I mostly just use Query Layers, which don't require registration. - V
... View more
08-22-2023
08:55 AM
|
0
|
3
|
2125
|
|
POST
|
This is a really large and open-ended question. Instead of leaping into software selection and design, you probably want to do research into requirements and available data first. - V
... View more
08-18-2023
07:28 AM
|
1
|
0
|
1292
|
|
POST
|
I'm on the slide toward 35 years as an Oracle DBA, but I've mostly been using PostgreSQL the past 10. I was always multi-platform (Oracle, Oracle/Sybase, Oracle/Sybase/Informix/DB2, Oracle/Sybase/Informix/DB2/SQL-Server, Oracle/SQL-Server/DB2/PostgreSQL, PostgreSQL/SQL-Sever/Oracle/Informix, PostgreSQL/SQL-Server/Oracle), so I'm comfortable with multi-tenanted configurations, but I've been quite pleased with the maturity of PG 11/12/13/14/15. Dealing with schema names which aren't user or login names is probably the biggest pain point, but at least you don't need to try to run four different releases of ArcSDE in the same instance (on a single laptop with SQL-Server and Oracle and Informix also installed). - V
... View more
08-11-2023
09:35 AM
|
3
|
0
|
3512
|
|
POST
|
Esri supports multiple RDBMS vendors. Each have their quirks and foibles. Oracle is the only vendor who forces names to UPPERCASE, so get used to seeing lowercase in field names. A layer file pointing at an Oracle table will not work against a PostgreSQL table, but only because it's not pointing at the PostgreSQL table. You can change the source of the layer, so this is a non-issue. The majority of the burden of migrating between databases is the skills of the DBA with the new database. So it really depends on the administrator (and the management above) on whether you can drive such a requirement. - V
... View more
08-10-2023
07:52 AM
|
2
|
3
|
3554
|
|
POST
|
No, if you use double-quotes to force fields to camelCase, ArcGIS will not see the fields. Field aliases exist and are case independent in comparison. - V
... View more
08-10-2023
07:44 AM
|
3
|
0
|
3557
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 2 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 2 | a month ago |