|
POST
|
This should theoretically do it: undefinedSr = arcpy.SpatialReference() #Note this DOES NOT make a 'Unknown' SR obj, see below
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
df.spatialReference = undefinedSr
mxd.save()
del mxd However, I found this is actually a bit more difficult.... The trick is to get a SR object to be of a "Unknown" coordinate system. The only way I could do this was to run the DefineProjection tool, and manually clear out the 'Coordinate System' parameter - which makes its value then default to a magic value called Unknown (note this is NOT a string value of "Unknown", but something else). Once I had a FC defined with an Unknown SR, then: undefinedSr = arcpy.Describe(unknownSrFC).spatialReference
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
df.spatialReference = undefinedSr
mxd.save()
del mxd Which worked... Anyone know a better way to create an Unknown spatial reference object? Tried all these, which do not work: undefinedSr = arcpy.SpatialReference(None)
undefinedSr = arcpy.SpatialReference(0)
undefinedSr = arcpy.SpatialReference("Unknown")
undefinedSr = arcpy.SpatialReference(Unknown) Seems like there should be a EPSG code for Unknown/Undefined, but I can't find it...
... View more
06-12-2013
02:33 PM
|
0
|
0
|
3115
|
|
POST
|
Sometimes the Union tool is confused with the Merge/Append tools... Is your intention to just move all the data into a single featureclass (aka Merge/Append) or to actually overlay the geometry (aka Union)?
... View more
06-12-2013
01:08 PM
|
0
|
0
|
763
|
|
POST
|
See the tool PointsToLine tool: http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000003s000000 That is an intereseting analysis... Seems like you would need to also "length-weight" the times for the portion of the line that lies within a particular summany grid. Some basic Python scripting knowledge would surely be a big help.
... View more
06-11-2013
02:33 PM
|
0
|
0
|
750
|
|
POST
|
What if you try to delete the FC(s) before you run all the list functions?
... View more
06-11-2013
02:25 PM
|
0
|
0
|
2938
|
|
POST
|
Hopefully the other tools mentioned in this thread that suffer from the same/simlar issue were also addressed.
... View more
06-11-2013
12:27 PM
|
0
|
0
|
446
|
|
POST
|
Not sure, but I bet FindIdentical simply rounds the values - maybe with the xy tolerance value (or some derivation of it) of the FC? All I'm really interested in is which shapes are identical to each other after a union operation on buffers. I assume to figure out overlaps? I do this too... I just round the values of the centroid x/y coordinates and the polygon area. If it helps give you ideas: #Flatten this puppy!
shatteredFC = fgdbPath + "\\shattered"
arcpy.Union_analysis(dissolveFC, shatteredFC, "ALL", "1 FEET", "GAPS"); showGpMessage()
singlePartFC = fgdbPath + "\\single_part"
arcpy.MultipartToSinglepart_management(shatteredFC, singlePartFC); showGpMessage()
searchRows = arcpy.da.SearchCursor(singlePartFC, ["SHAPE@","*"])
polyIdDict = {}
polyIdValue = 1
decimalTolerance = 2
for searchRow in searchRows:
shapeFieldValue = searchRow[searchRows.fields.index("SHAPE@")]
xCentroidValue = round(shapeFieldValue.centroid.X, decimalTolerance)
yCentroidValue = round(shapeFieldValue.centroid.Y, decimalTolerance)
areaValue = round(shapeFieldValue.area, decimalTolerance)
axyValue = (xCentroidValue,yCentroidValue,areaValue)
catagoryNameValue = searchRow[searchRows.fields.index("CATEGORY")]
releaseYearValue = searchRow[searchRows.fields.index("RELEASE_YR")]
retentionPctValue = searchRow[searchRows.fields.index("RETENTION_PCNT")]
forestedFlagValue = searchRow[searchRows.fields.index("FORESTED")]
if axyValue not in polyIdDict:
polyIdDict[axyValue] = polyIdValue, [catagoryNameValue], [releaseYearValue],[retentionPctValue],[forestedFlagValue]
polyIdValue = polyIdValue + 1
else:
polyIdDict[axyValue][1].append(catagoryNameValue)
polyIdDict[axyValue][2].append(releaseYearValue)
polyIdDict[axyValue][3].append(retentionPctValue)
polyIdDict[axyValue][4].append(forestedFlagValue)
del searchRow, searchRows
#Sort the thing the way we want it
for axyValue in polyIdDict:
polyIdDict[axyValue][1].sort() #catagory name
polyIdDict[axyValue][2].sort(reverse=True) #release year
polyIdDict[axyValue][3].sort(reverse=True) #retention percent
polyIdDict[axyValue][4].sort() #forested
arcpy.AddField_management(singlePartFC, "POLY_ID", "LONG"); showGpMessage()
arcpy.AddField_management(singlePartFC, "LCL_RSN", "TEXT", "", "", "150"); showGpMessage()
arcpy.AddField_management(singlePartFC, "RELEASE_YR_MAX", "SHORT"); showGpMessage()
arcpy.AddField_management(singlePartFC, "RETENTION_PCNT_MAX", "SHORT"); showGpMessage()
arcpy.AddField_management(singlePartFC, "FORESTED_MAX", "TEXT", "", "", "1"); showGpMessage()
arcpy.AddField_management(singlePartFC, "LCL_RP_FLG", "SHORT"); showGpMessage()
arcpy.AddField_management(singlePartFC, "LCL_UP_FLG", "SHORT"); showGpMessage()
arcpy.AddField_management(singlePartFC, "LCL_US_FLG", "SHORT"); showGpMessage()
arcpy.AddField_management(singlePartFC, "LCL_WT_FLG", "SHORT"); showGpMessage()
updateRows = arcpy.da.UpdateCursor(singlePartFC, ["SHAPE@","*"])
for updateRow in updateRows:
shapeFieldValue = updateRow[updateRows.fields.index("SHAPE@")]
xCentroidValue = round(shapeFieldValue.centroid.X, decimalTolerance)
yCentroidValue = round(shapeFieldValue.centroid.Y, decimalTolerance)
areaValue = round(shapeFieldValue.area, decimalTolerance)
axyValue = (xCentroidValue,yCentroidValue,areaValue)
updateRow[updateRows.fields.index("POLY_ID")] = polyIdDict[axyValue][0]
updateRow[updateRows.fields.index("LCL_RSN")] = ",".join(i for i in sorted(set(polyIdDict[axyValue][1])))
updateRow[updateRows.fields.index("RELEASE_YR_MAX")] = polyIdDict[axyValue][2][0]
updateRow[updateRows.fields.index("RETENTION_PCNT_MAX")] = polyIdDict[axyValue][3][0]
updateRow[updateRows.fields.index("FORESTED_MAX")] = polyIdDict[axyValue][4][0]
if "RIPARIAN_AREA" in polyIdDict[axyValue][1] or "RMZ" in polyIdDict[axyValue][1]:
updateRow[updateRows.fields.index("LCL_RP_FLG")] = 1
if "WETLAND" in polyIdDict[axyValue][1] or "WMZ" in polyIdDict[axyValue][1]:
updateRow[updateRows.fields.index("LCL_WT_FLG")] = 1
if 'SLOPE_STABILITY_ISSUE' in polyIdDict[axyValue][1] or 'SLOPE_STABILITY_POTENTIAL' in polyIdDict[axyValue][1] or 'SLOPE_STABILITY_VERIFIED' in polyIdDict[axyValue][1] or 'UNSTABLE_SLOPES' in polyIdDict[axyValue][1]:
updateRow[updateRows.fields.index("LCL_US_FLG")] = 1
#A bit of a work around just for SPS - untl the new schema is completed...
if 'AREA_REGULATION' in polyIdDict[axyValue][1] and polyIdDict[axyValue][3][0] < 50:
updateRow[updateRows.fields.index("RETENTION_PCNT_MAX")] = 50
updateRows.updateRow(updateRow)
del updateRow, updateRows
... View more
06-11-2013
11:06 AM
|
0
|
0
|
2203
|
|
POST
|
Assuming your geometries have some true curves in them, I bet that if you convert your FC to a shapefile, then look at the WKT values, they "should" then be ==. About a year ago, I had been in contact with ESRI about this issue (true curve geometry being slightly off).... didn't go anywhere though... ESRI commited to curve geometry. No plans to have an envr setting to keep the GDB geometry densified (which seems to prevent these minute geometry property differences).
... View more
06-11-2013
10:28 AM
|
0
|
0
|
2203
|
|
POST
|
I feel your pain: http://forums.arcgis.com/threads/49557-True-Curves-True-Evil http://forums.esri.com/Thread.asp?c=93&f=983&t=292699
... View more
06-11-2013
09:11 AM
|
0
|
0
|
2203
|
|
POST
|
I don't have any experence with teh WKT values, but how different are the values (you mention length)? I have had issues with geometries that include "true curve" features, that should be identical, but in fact have ever so slightly different areas/perimeters/centroid values - I am talking like a difference of 0.00001 map units. But enough to throw my script logic out of whack.
... View more
06-11-2013
08:19 AM
|
0
|
0
|
2203
|
|
POST
|
Use a Python script to repath the layers in your .mxds: http://resources.arcgis.com/en/help/main/10.1/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/
... View more
06-10-2013
02:47 PM
|
0
|
0
|
875
|
|
POST
|
You are probably using a relatively coarse cluster tolerance and/or resolution. Per my experience, unless you have a REALLY good reason to, you should endevor to use the ESRI defaults: arcpy.env.XYResolution = "0.0005 METERS" arcpy.env.XYTolerance = "0.001 METERS" Geoprocessing tools generally default to the most coarse tolerance/resolutiuon. So if you union a FC at 10ft tol with another at 1ft tol, the output will be a 10ft tol (unless you specify otherwise in the tool GUI or the tool's envr. settings). Here's some reference material: http://resources.arcgis.com/en/help/main/10.1/index.html#//003n00000005000000#GUID-69FA8570-7C64-4213-B822-68716CD9E764 (scroll down a bit more than half way down the page to get to the part about tolerance and resolution).
... View more
06-10-2013
02:18 PM
|
0
|
0
|
1378
|
|
POST
|
How about the online documentation (v10.0): http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html
... View more
06-10-2013
10:45 AM
|
0
|
0
|
820
|
|
POST
|
How about using the Con() function? In v10.0 + raster calculator syntax you have to use the Lookup() function to access fields other than the VALUE field. For example, this expresion will return a value of 1 if the NST field value is >= 50 and the DEM_FLAG field value is 0 (otherwise it returns NoData. arcpy.sa.Con((arcpy.sa.Lookup(nstGrd, "NST") >= 50) & (arcpy.sa.Lookup(nstGrd, "DEM_FLAG") == 0), 1)
... View more
06-06-2013
02:29 PM
|
0
|
0
|
1447
|
|
POST
|
If your field name is a variable, you need to use the .setValue() method. For example: myFieldName = "CRAZY_FIELD" line.setValue(myFieldName, LocationCount)
... View more
06-06-2013
01:42 PM
|
0
|
0
|
1415
|
|
POST
|
Do you know if you can obtain the results from the SNAP_EDIT, like it snaped x number of features...? I suspect there isn't a direct way to do this... I would think you would have to inspect the geometry to see what changed. Maybe there is something in the result object though, but I doubt it. You'll always be a 490 to me...
... View more
06-06-2013
10:28 AM
|
0
|
0
|
1576
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|