|
POST
|
No tool that I know of, but you could do this somewhat easily via a Python script. I assume the points represent the centers of the plots. So all you would need to do is (using a cursor) compare the offset between the rectangle's centroid (x&y coordinate) and the matching (GPSed?) point's x&y coordinate). This difference represents the necessary shift for that particular plot. Then you just need to use an update cursor to alter (aka "shift") the vertices.
... View more
02-23-2011
12:43 PM
|
0
|
0
|
1638
|
|
POST
|
What is your definition of a historical marker? I guess a marker would have to be over 50 years old to be considered historic, but these are half way there: http://www.manylittleblessings.com/2010/10/i-love-a-set-of-25-year-old-markers/
... View more
02-17-2011
06:56 AM
|
1
|
0
|
1998
|
|
POST
|
The attached python script will do it. Note this is a newer version of this script: http://arcscripts.esri.com/details.asp?dbid=16700. This new version has some extra (optional) parameters that concatenate the overlapping polygon values. So per your Venn-like diagram, a new field can optionally be added to the "regionalized/planarized" output polygon FC and will contain values like 'A','A,B','B,C','A,B,C', etc. depending on what region it is describing.
... View more
02-16-2011
03:01 PM
|
0
|
1
|
3785
|
|
POST
|
Hmmm... I remeber a while back that processor affinity was an issue: http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDM0MTgx.
... View more
02-16-2011
02:16 PM
|
0
|
0
|
2443
|
|
POST
|
Glad it worked - I like your hybrid approach. FYI: The .replace() only works on text strings - not lists, so you would have to convert the fieldList to a string (or accumulate a string by looping through the list items which is what I do in my code with the deleteString variable). p.s. I don't see an option to mark question as answered but maybe you can't do that in the new forums?) Nope - ESRI is still working on that...
... View more
02-15-2011
07:06 AM
|
0
|
0
|
1365
|
|
POST
|
Just a suggestion, but if this is part of a Python script, you are WAY better off using an updatecursor instead. The benefit is readability, codeability, and debugging. The code block for the FieldCalculator is notoriously hard to write code for, while the updatecursor has very clear and clean syntax: http://forums.esri.com/Thread.asp?c=93&f=1729&t=262236#806786
... View more
02-14-2011
01:45 PM
|
0
|
0
|
6291
|
|
POST
|
Two options: 1. Use a try except loop: fieldList = gp.listfields(fc)
for field in fieldList:
try:
gp.DeleteField(fc, field.name)
except:
print "Couldn't delete " + field.name #because it was OBJECTID, SHAPE, SHAPE_AREA, etc. 2. dsc = gp.describe(fc)
keepList = [dsc.oidfieldname, dsc.shapefieldname, "MY_FAV_FIELD", dsc.shapefieldname + "_Length", dsc.shapefieldname + "_Area"]
deleteString = ""
fieldList = gp.listfields(fc)
if field.name not in keepList:
deleteString = deleteString + field.name + ";"
gp.DeleteField(fc, deleteString[:-1])
... View more
02-14-2011
09:02 AM
|
0
|
0
|
1365
|
|
POST
|
Two options: 1. Use a try except loop: fieldList = gp.listfields(fc) for field in fieldList: try: gp.DeleteField(fc, field.name) except: print "Couldn't delete " + field.name #because it was OBJECTID, SHAPE, SHAPE_AREA, etc. 2. dsc = gp.describe(fc) keepList = [dsc.oidfieldname, dsc.shapefieldname, "MY_FAV_FIELD", dsc.shapefieldname + "_Length", dsc.shapefieldname + "_Area"] deleteString = "" fieldList = gp.listfields(fc) if field.name not in keepList: deleteString = deleteString + field.name + ";" gp.DeleteField(fc, deleteString[:-1])
... View more
02-14-2011
09:01 AM
|
0
|
0
|
1365
|
|
POST
|
merging single and multipart features is not permitted Kim, I don't seem to have any issues creating a FC with mixed states of single and multipart (made a singlepart dissolve, and then a multipart dissolve, and merge together - no error). What error do you get? I think maybe I'm not grasping your issue? My understanding is that the stupid ArcGIS Dissolve tool ALWAYS makes a multipart FC, and then depending on what you want, will break it into singlepart as a post process. Unfortunately I've found that that doesn't even work sometimes, and that you need to run the MultipartToSinglepart tool after you run the Dissolve (singlepart) tool to fully break it up. There is some logged bug about this... Coverages were easier as everything was always singlepart - no surprises! Relates: I found a pretty slick way of doing large relates in a FGDB... The cool thing is you can pass EXTREEMLY large SQL statements to a FGDB - like millions of characters long... I never did find a limit... So instead of relying on the ArcGIS Relate "tool". I just gather the "key" field values in a search cursor, and use that to build a SQL expression to select the relate table with. It's even more efficient when using the OBJECTID fields cause you can use the .fidset describe property to gather the selected OIDs.
... View more
02-14-2011
08:50 AM
|
0
|
0
|
2443
|
|
POST
|
I have dealt with this for quite a long while. I don't think it is necessarily a bug, but I agree it's annoying. At the most basic level though, if you have a feature that is exactly on the border, it should probably be identified as being a member of both, right? For example, if I am right on the US/Canada border, I tend to think I am in both contries at the same time. I find this a common problem with my stream layer and my forest inventory unit layer since the stream layer was actually used to edit/split the forest unit layer (since streams seem like a pretty obvious boundary). The easiest way to MINIMIZE the problem is to simply use the smallest possible XY tolerance in the overlay (i.e. don't use a 10ft tolerance!!!). The other (harder but better) option is to find the duplicate features and randomly choose (or maybe using some sort of logic-based algorithm) and then delete all but one of them.
... View more
02-11-2011
11:40 AM
|
0
|
0
|
1617
|
|
POST
|
How about building a custom spatial reference that is the same as your standard one but just with different FalseEasting and FalseNorthing values? Then you could use this custom SR in a cursor (or just the project command for that matter)...
... View more
02-10-2011
03:00 PM
|
0
|
0
|
1568
|
|
POST
|
One point I forgot to mention: Maybe you just need to force the creation of the RasterAttributeTable (a requirement for the zonal stats tool). As memory serves, the .vat (the old name for teh RasterAttributeTable) isn't automatically created if the unique value count in the raster is > the number that is set in the advancedarcmapsettings.exe registry editor (which for you sounds like it is 50k). So I think you might not have to break it up into pieces (although doing so would probably result in smaller/faster grids).
... View more
02-09-2011
03:36 PM
|
0
|
0
|
2354
|
|
POST
|
need to calculate Zonal Statistics for a large number of polygons (400,000+++) I have some experience with this... I have a large dataset of ~2 million polygons (many are small) that I do some zonal stats on to get the mean elevation, slope, etc. of each poly. I found that many of the polys are in fact too small to be represented by a single pixel (I use a 10m DEM), so of the 2 million polys, only 1.5 million of them make it into the raster layer (the rasterized version of the polygons). Since I want stats for all of the records (even the very small ones) I take the ones that didn't make it into the raster (aka the zones) and convert them to their constituent centroid points, Then I use the "Sample" tool on them. If it helps, here is an excerpt of some Python code that I use. Note the use of the .difference property of a Python set() object - a very handy function in this case. #Blah blah.....
#Sets the rasters to use
inDemGrd = root + "\\gis_layers\\dem10m"
slopePctGrd = root + "\\gis_layers\\dem10m_slp"
inSlpstabGrd = root + "\\gis_layers\\slpstab"
#Process: Define the LDO fc to use
overlayFC = root + r"\ldo_" + str(ldoIterationDate) + r"\ldo_database.gdb\ldo_database"
#Sets some more gp settings
dsc = gp.describe(inDemGrd)
gp.cellsize = inDemGrd
gp.extent = overlayFC
gp.snapraster = inDemGrd
#Process: Converts overlayFC to a grid and creates a vat
oidFieldName = gp.describe(overlayFC).oidfieldname
overlayGrd = "remsoftid"
gp.CalculateField_management(overlayFC, "REMSOFT_ID", "[" + oidFieldName + "]", "VB"); showGpMessage() #REMSOFT_ID acts as a temporary unique id since you can't rasterize on OBJECTID
gp.FeatureToRaster_conversion(overlayFC, "REMSOFT_ID", overlayGrd, gp.cellsize); showGpMessage()
if os.path.exists(gp.workspace + "\\" + overlayGrd + "\\vat.adf") == False:
gp.BuildRasterAttributeTable_management(overlayGrd, "OVERWRITE"); showGpMessage()
#Process: Clears the gp.extent
gp.extent = ""
#Process: Figures out what OBJECTIDs from overlayFC didn't make it into overlayGrd
message = "Compiling list of overlayFC OBJECTIDs..."; showPyMessage()
objectidSet = set()
searchRows = gp.searchcursor(overlayFC, "", "", oidFieldName, "")
searchRow = searchRows.next()
while searchRow:
objectidSet.add(searchRow.getvalue(oidFieldName))
searchRow = searchRows.next()
del searchRow
del searchRows
message = "Compiling list of pixel values..."; showPyMessage()
valueSet = set()
searchRows = gp.searchcursor(overlayGrd, "", "", "VALUE", "")
searchRow = searchRows.next()
while searchRow:
valueSet.add(searchRow.VALUE)
searchRow = searchRows.next()
del searchRow
del searchRows
diffSet = set.difference(objectidSet, valueSet)
oidList = []
for item in diffSet:
oidList.append(item)
oidList.sort()
selOidTbl = overlayFC[0:-len(overlayFC.split("\\")[-1]) - 1] + "\\sel_oid"
gp.CreateTable_management(overlayFC[0:-len(overlayFC.split("\\")[-1]) - 1], "sel_oid", "", ""); showGpMessage()
gp.AddField_management(selOidTbl, "SEL_OID", "LONG"); showGpMessage()
insertRows = gp.insertcursor(selOidTbl)
for oid in oidList:
insertRow = insertRows.newrow()
insertRow.SEL_OID = oid
insertRows.insertrow(insertRow)
del insertRow
del insertRows
del oidList
del diffSet
del objectidSet
del valueSet
#Process: Some of the REMSOFT_IDs don't get preserved in overlayGrd so lets make a point FC for them
overlayFL = "overlay_feature_layer"
gp.MakeFeatureLayer_management(overlayFC, overlayFL, "", "", ""); showGpMessage()
gp.SelectLayerByAttribute_management(overlayFL, "NEW_SELECTION", gp.describe(overlayFC).oidfieldname + " IN (SELECT SEL_OID FROM sel_oid)"); showGpMessage()
polyCentersFC = fgdbPath + "\\polygon_centers"
gp.FeatureToPoint_management(overlayFL, polyCentersFC, "CENTROID"); showGpMessage()
gp.SelectLayerByAttribute_management(overlayFL, "CLEAR_SELECTION", ""); showGpMessage()
gp.Delete_management(selOidTbl, ""); showGpMessage()
gp.CalculateField_management(overlayFC, "REMSOFT_ID", "-1", "VB"); showGpMessage()
#Process: Change the gp.extent
gp.extent = gp.describe(inDemGrd).extent
#Process: Create a eucliduan distance grid for the roads we care about
transFC = root + "\\gis_layers\\state_land_trans.gdb\\state_land_trans"
distanceRoadsFC = fgdbPath + "\\distance_roads"
gp.Select_analysis (transFC, distanceRoadsFC, "ROAD_STATUS_LBL in ('Active','Closed','Decommissioned','Orphaned','Planned','Unknown','') OR ROAD_STATUS_LBL IS NULL"); showGpMessage()
roadGrd = "roads"
gp.FeatureToRaster_conversion(distanceRoadsFC, "OBJECTID", roadGrd, gp.cellsize); showGpMessage()
roadDistGrd = "road_dist"
somaExp = "int(eucdistance(" + roadGrd + ") + .5)"
oldCellSize = gp.cellsize
gp.cellsize = "35" #WORKAROUND: Briefly make the cell size a bit larger so that the now-memory-intensive eucdistance function doesn't throw a memory allocation error (works with 35, bombs at 33.842092, 30, 34)
gp.SingleOutputMapAlgebra_sa(somaExp, roadDistGrd); showGpMessage()
gp.cellsize = oldCellSize
#Process: Does some zonal stat calculations
#For elevation
zonalElevMeanGrd = "zn_elev_mean"
gp.ZonalStatistics_sa(overlayGrd, "VALUE", inDemGrd, zonalElevMeanGrd, "MEAN", "NODATA"); showGpMessage()
#For slope
zonalSlpMeanGrd = "zn_slp_mean"
gp.ZonalStatistics_sa(overlayGrd, "VALUE", slopePctGrd, zonalSlpMeanGrd, "MEAN", "NODATA"); showGpMessage()
#For road distance
zonalRoadDistMeanGrd = "zn_rdis_mean"
gp.ZonalStatistics_sa(overlayGrd, "VALUE", roadDistGrd, zonalRoadDistMeanGrd, "MEAN", "NODATA"); showGpMessage()
#Process: Combines the overlayGrd, zonalElevMeanGrd, zonalSlpMeanGrd, and zonalRoadDistMeanGrd so we can report on the REMSOFTID (aka "value" field in overlayGrd)
combo1Grd = "combo1"
gp.Combine_sa(overlayGrd + ";" + zonalElevMeanGrd + ";" + zonalSlpMeanGrd + ";" + zonalRoadDistMeanGrd, combo1Grd); showGpMessage()
if os.path.exists(gp.workspace + "\\" + combo1Grd + "\\vat.adf") == False:
gp.BuildRasterAttributeTable_management(combo1Grd, "OVERWRITE"); showGpMessage()
#Process: Converts combo1Grd.vat to a real table that we can actually index
vatTV = "vat_table_view"
gp.MakeTableView_management(combo1Grd, vatTV, ""); showGpMessage()
combo1GridVatTbl = fgdbPath + "\\combo1_grid_vat"
gp.CopyRows_management(vatTV, combo1GridVatTbl, ""); showGpMessage()
gp.AddIndex_management(combo1GridVatTbl, "remsoftid", "remsoftid_index", "UNIQUE", "ASCENDING"); showGpMessage()
#Process: Uses the Sample tool to get at the REMSOFTIDs that didn't make it into overlayGrd
sample1Tbl = fgdbPath + "\\sample1"
gp.Sample_sa(inDemGrd + ";" + slopePctGrd + ";" + roadDistGrd, polyCentersFC, sample1Tbl, "NEAREST"); showGpMessage()
gp.AddField_management(sample1Tbl, "REMSOFTID", "LONG"); showGpMessage()
tableTV = "table_view"
gp.MakeTableView_management(sample1Tbl, tableTV, ""); showGpMessage()
gp.AddJoin_management(tableTV, "OBJECTID", polyCentersFC, "OBJECTID", "KEEP_COMMON"); showGpMessage()
gp.CalculateField_management(tableTV, "REMSOFTID", "[polygon_centers.REMSOFT_ID]", "VB"); showGpMessage()
gp.RemoveJoin_management(tableTV, "polygon_centers"); showGpMessage()
gp.AddIndex_management(sample1Tbl, "REMSOFTID", "remsoftid_index", "UNIQUE", "ASCENDING"); showGpMessage()
#Process: Clears the gp.extent
gp.extent = ""
#Process: Populates the DEM_ELV and DEM_SLP fields in overlayFC
#For values in combo1GridVatTbl
gp.MakeFeatureLayer_management(overlayFC, overlayFL, "", "", ""); showGpMessage()
gp.AddJoin_management(overlayFL, gp.describe(overlayFC).oidfieldname, combo1GridVatTbl, "REMSOFTID", "KEEP_COMMON"); showGpMessage()
gp.CalculateField_management(overlayFL, "DEM_ELV", "[combo1_grid_vat.ZN_ELEV_MEAN]", "VB"); showGpMessage()
gp.CalculateField_management(overlayFL, "DEM_SLP", "[combo1_grid_vat.ZN_SLP_MEAN]", "VB"); showGpMessage()
gp.CalculateField_management(overlayFL, "ROAD_DIST", "[combo1_grid_vat.ZN_RDIS_MEAN]", "VB"); showGpMessage()
gp.RemoveJoin_management(overlayFL, "combo1_grid_vat"); showGpMessage()
#For values in sample1Tbl
gp.MakeFeatureLayer_management(overlayFC, overlayFL, "", "", ""); showGpMessage()
gp.AddJoin_management(overlayFL, gp.describe(overlayFC).oidfieldname, sample1Tbl, "REMSOFTID", "KEEP_COMMON"); showGpMessage()
gp.CalculateField_management(overlayFL, "DEM_ELV", "[sample1.dem10m]", "VB"); showGpMessage()
gp.CalculateField_management(overlayFL, "DEM_SLP", "[sample1.dem10m_slp]", "VB"); showGpMessage()
gp.CalculateField_management(overlayFL, "ROAD_DIST", "[sample1.road_dist]", "VB"); showGpMessage()
gp.RemoveJoin_management(overlayFL, "sample1"); showGpMessage()
#Blah blah....
... View more
02-09-2011
02:30 PM
|
0
|
0
|
2354
|
|
POST
|
I do it like: scriptName = sys.argv[0].split("\\")[-1][0:-3] #the script without the .py extension
dateTimeStamp = time.strftime('%Y%m%d%H%M%S') #in the format YYYYMMDDHHMMSS
userName = string.lower(os.environ.get("USERNAME"))
logFile = rootDir + "\\" + scriptName + "_" + userName + "_" + dateTimeStamp + ".log" So the log file is named something like: "super_pivot_v93_csny490_20110209134455.log"
... View more
02-09-2011
02:06 PM
|
0
|
0
|
2185
|
| 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
|