|
POST
|
Did you define your new OID field as a Short Integer? If so, make sure it's a Long Integer.
... View more
06-06-2013
10:05 AM
|
0
|
0
|
2368
|
|
POST
|
Hmmm.... I think you would then have to use Network Analyst or some other "routing" approach. The trick is having a way to establish flow direction. In the Hydrology Spatial Analyst tools this is done using a D8 (8 possible dircetions) flow direction raster (created from a Filled DEM). In Network Analyst it is done via defining a route, destinations, and source/incidents. Another option: Do all your stream segments "flow" in the correct orientation (i.e the from node is upstream of the to node)? If so, then you could just parse the geometry in a cursor to establish "distance from headwater".
... View more
06-05-2013
03:54 PM
|
0
|
0
|
2489
|
|
POST
|
Note there are no more system-based .prj file in v10.1 anymore (!!!!) But you can manufacture one via the SR's exportToString() method and then write it to a file.
... View more
06-05-2013
03:43 PM
|
0
|
0
|
3596
|
|
POST
|
Seems like a bug to not have that property available...
... View more
06-05-2013
03:11 PM
|
0
|
0
|
3596
|
|
POST
|
Yes, the tool is in Spatial Analyst and called Flow Length: http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000053000000
... View more
06-05-2013
02:49 PM
|
0
|
0
|
2489
|
|
POST
|
Per your original question, your code will require substatial rewrites to make it work via Python... slapping an import arcpy on the top ain't gonna cut it... It does look somewhat complicated, but the programatic flow is basically already there. This one would take a while to rewrite though, and is probably not as simple as some might think. For example, as far as I know there is no .rotate method property for geometry objects in Python (but I bet ESRI whats to make one!), so you would have to write the code to do that.
... View more
06-05-2013
01:42 PM
|
0
|
0
|
2708
|
|
POST
|
How about just some derivation of SelectByLocation as part of the validation? As in if the featureset point "INTERSECT" your network, then you are good to go. This post: http://forums.arcgis.com/threads/35323-ArcPy-amp-SelectLayerByLocation-Performance?p=119305&viewfull=1#post119305 might give you some ideas to make the SelectByLocation be more efficient. Also, when your users create the points in your featureset in v10.0 +, the "auto snapping" should be turned on (unless you have "traditional snapping" turned on), so using the snap_edit tool might be redundant, but maybe not. P.S. Shouldn't you be 461 or something?
... View more
06-05-2013
01:23 PM
|
0
|
0
|
1576
|
|
POST
|
If it helps, I use this method to run large jobs using SA tools. Note I am using the subprocess module and not multiprocessing - but same difference. I found the secret is to reset the TEMP environment variables for every subprocess run (see the stuff relating to os.environ in the launchProcess function in the "master" script). These scripts are a bit of a hack job, but they work great for what I need it to do. Lights up 12 (out of 16) 3.8GHz cores and runs smooth for 12 hrs. SSDs help too :).
... View more
06-05-2013
10:38 AM
|
0
|
0
|
3187
|
|
POST
|
Something changed.... And it's often pretty hard to figure out what it was... I see you are using float files (.flt)... anything change in that regard?
... View more
06-04-2013
12:27 PM
|
0
|
0
|
3016
|
|
POST
|
What does gp.GetMessages() say? Probably won't be very helpfull though... Would it be possible to "image" your odd machine as one of the others? These sorts of issues are pretty quirky somethimes. I recall an issue a while back when I set my Raster AttributeLimit value(AdvancedArcMapSettings.exe) to be some large number like 999,999,999. Some (not all) Spatial Analyst tools freaked out and started bombing... Soon as I set it to a smaller number like 900,000,000 it stared working fine. As I recall, an ESRI guy could replicate the issue on only some of his machines.
... View more
06-04-2013
10:36 AM
|
0
|
0
|
3016
|
|
POST
|
One of these computers is not like the other... time to play that game. What is the error on your odd computer?
... View more
06-04-2013
10:04 AM
|
0
|
0
|
3016
|
|
POST
|
but you will find that it doesn't allow floating point input Eric - Using v10.1 SP1 with a 32-bit float (grid format) as input. Points correctly get a GRID_CODE field of type Float containing floating point values (example: -1.0675).
... View more
06-04-2013
09:59 AM
|
0
|
0
|
3375
|
|
POST
|
The proper tool is RasterToPoint: http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000007000000
... View more
06-04-2013
08:23 AM
|
0
|
0
|
3375
|
|
POST
|
I like cursors too, but your original code was actually almost there. Rember that the '\\' is the Python path delimiter in Windows, and an index of [-1] will grab the last item. !PicForward!.split('\\')[-1] so regardless of how many folders deep your file is, if the field value is 'C:\temp\myimage.jpg', the code above will return 'myimage.jpg'.
... View more
06-03-2013
03:20 PM
|
0
|
0
|
2937
|
|
POST
|
Using the cursor sort parameter is "slow"... Assuming you have v10.1, this would be the fastest (untested) way I can think of doing it. Otherwise if you have v10.0, you are best off using the SummaryStats tool... Another thing to consider in v10.1 is that the sort option for the .da cursors ONLY works with Geodatabases (not shapefiles, INFO tables, etc.). That said, since this method doesn't rely on the cursor sort option, shapefiles would work fine (actually a bit faster usually than FGDB). inPts = "C:\ArcGIS\Temp\Tester.shp"
animalField = "AnimalNum"
sortField = "MSTTime"
arcpy.AddField_managment(inPnts, "LAST_FLAG", "SHORT")
animalDateDict = {}
searchRows = arcpy.da.SearchCursor(inPnts, [OID@, animalField, sortField])
for searchRow in searchRows:
oidValue, animalValue, sortValue = searchRow
if animal in animalDateDict:
animalDateDict[animal].append(sortValue, oidValue)
else:
animalDateDict[animal] = [(sortValue, oidValue)]
del searchRow, searchRows
lastOidsList = [max(animalDict[animal])[-1] for animal in animalDict]
oidFieldName = arcpy.Describe(inPnts).oidFieldName
queryExp = oidFieldName + " in (" + ",".join(str(lastOid) for lastOid in lastOidsList) + ")"
updateRows = arcpy.da.UpdateRows(inPnts, ["LAST_FLAG"], queryExp)
for updateRow in updateRows:
updateRow[0] = 1
updateRows.updateRow(updateRow)
del updateRow, updateRows
... View more
06-03-2013
02:14 PM
|
0
|
0
|
1178
|
| 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
|