|
POST
|
You could get fancy and do this using a Python Toolbox and the onClick method. Otherwise, you could simply use the out of the box Identify or the HTML popup tools, right? My instinct is to usually try to teach users how to use the existing out of the box tools before I go off and make a custom one.
... View more
09-25-2013
02:52 PM
|
0
|
0
|
702
|
|
POST
|
Also, instead of creating a list of the"TWACs_NUMBERs", and running a seperate cursor for each one, just run a single cursor and store the lists in a dictionary, where each twacNo is a key and each key points to a list of meterNos. In v10.1 this would look like: twacDict = {}
searchRows = arcpy.da.SearchCursor(table, ["TWACs_NUMBER","METER_NUMBER"])
for searchRow in searchRows:
twacNo, meterNo = searchRow
if twacNo in twacDict:
twacDict[twacNo].append(meterNo)
else:
twacDict[twacNo] = [meterNo]
del searchRow, searchRows
twackList = twacDict.keys()
twackList.sort()
for twacNo in twackList:
meterList = twacDict[twacNo]
#make a graph here, since you now have a hook to the twacNo and it's list of meterNos
... View more
09-25-2013
01:29 PM
|
0
|
0
|
1482
|
|
POST
|
Not sure about the reason for the slow down, but some ideas to make it faster: Just run the search cursor on the on-disk table directly. Copy the table to in_memory most likely is just adding overhead processing time. In you are running v10.1+, use the data access cursors. They are about 20-30x faster than the old cursors you are using. Like Matt was saying, make sure you are restarting Python (or whatever .exe you are using) between runs of this script as to clear the RAM and remove locks.
... View more
09-25-2013
01:18 PM
|
0
|
0
|
1482
|
|
POST
|
Jim - Per the TIN idea, yes that would work great, but alas I only have access to the elevation rasters, and not the original pnts that were used... Otherwise it'd be very easy to do what I want! (which again is to identify areas that have a low desity of ground returns - using only a bare earth elevation raster as input).
... View more
09-18-2013
08:44 AM
|
0
|
0
|
741
|
|
POST
|
Thanks Curtis - that is a good idea. I should add that (unfortunatly) these elevation rasters are in integer feet, which tends to cause some "stair stepping" in the output derivative rasters (aspect, plan/prof curvature, hillshade, etc.). So for example, even the aspect pixels of one of the facets of the "crystal" does not entirely end up being a uniform value like you might expect. Had these been float rasters some of these detection methods would be quite a bit more discriminating I think. Best I have come up with is to add some additional masks - so for example, make sure it is shrubby/forested landcover & a low aspect value diversity & not a flat slope & relatively planar hillslope. Getting a bit better, but not a lot of hope for this one.
... View more
09-17-2013
12:35 PM
|
0
|
0
|
741
|
|
POST
|
Looking for some creative ideas... Here in Western WA State, we have a lot of dense forest/brush. Often the LiDAR laser has a hard time getting good ground returns in dense shrubberies - which results in a funny looking "crystal forest" shapes in the DTMs, where the facets of the ground surface TIN are readily visible due to low mass ground point densities. Here's a picture:[ATTACH=CONFIG]27414[/ATTACH]. I am trying to come up with a reasonably good/fast method of locating "crystal forest" areas like this, given ONLY the bare earth DEM (not the original LAS/ascii raw point files). The best method I have come up with is to create an aspect raster, and do a 3-5 cell radius focal variety - thus counting the "diversity" of aspect angles in a relatively small analysis window. The idea being that areas of low aspect variety (and a slope >= 5% of so) are indicative of these rather planar TIN facet shapes. One issue is that there are also areas of quite planar hill slopes where the aspect is also very similar (think a large planar hill slope facing north). So, while the aspect focal variety method does a pretty good job finding the crystal forest areas, it also is pretty good at finding the planar hillslopes as well. I already have a mask screeing out flat areas such as lakes/ag field/etc. so that's been taken care of. Super bonus points if you have any good ideas!
... View more
09-12-2013
03:56 PM
|
0
|
4
|
1940
|
|
POST
|
HA! On a lark, decided to try installing scipy v0.11 (right after I put up original post)... WORKED! >>> ArcGIS v10.1 SP1 == scipy v0.11
True The stuborn and overly time consuming 'trial and error method' wins the day once again!!!
... View more
09-05-2013
09:41 AM
|
3
|
0
|
929
|
|
POST
|
I would like to install the scipy site package (not the entire scipy "stack"), and am looking for someone's advice (a brief how-to) who has done this before and not totally whacked their ArcGIS Python 2.7 install. Idealy I want scipy to be available to both the ArcGIS 32 and 64 bit installs of Python (C:\Python27\ArcGIS10.1 and C:\Python27\ArcGISx6410.1 respectively). I am assuming ArcGIS v10.1 SP1, Python 2.7.2, which is using numpy 1.6.1. I have tried installing both scipy v0.12 and v0.10.1 from http://sourceforge.net/projects/scipy/files/scipy/, and while many of the scipy functions work, the 'stats' submodule (scipy.stats - aka the one I actually want to use!!!) does not. When I was (1st) trying this with scipy v0.12 I got the error: >>> from scipy import stats
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\stats\__init__.py", line 320, in <module>
from .stats import *
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\stats\stats.py", line 241, in <module>
import scipy.special as special
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\special\__init__.py", line 529, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found. Upon some advice here: http://forums.arcgis.com/threads/91254-ArcGIS-10.1-Python-crash-on-quot-import-arcpy-quot-after-installing-scipy-stack.?p=323887&viewfull=1#post323887, I downgraded to scipy v0.10.1 and now get a more exciting error (relating to numpy datatypes, but at least it seems to be getting closer!) >>> from scipy import stats
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\stats\__init__.py", line 322, in <module>
from stats import *
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\stats\stats.py", line 198, in <module>
import distributions
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\stats\distributions.py", line 14, in <module>
from scipy import optimize
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\optimize\__init__.py", line 135, in <module>
from nonlin import *
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\optimize\nonlin.py", line 118, in <module>
import scipy.sparse.linalg
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\sparse\__init__.py", line 182, in <module>
from csgraph import *
File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\sparse\csgraph\__init__.py", line 148, in <module>
from ._shortest_path import shortest_path, floyd_warshall, dijkstra,\
File "numpy.pxd", line 155, in init scipy.sparse.csgraph._shortest_path (scipy\sparse\csgraph\_shortest_path.c:13971)
ValueError: numpy.dtype has the wrong size, try recompiling Anyone have any advice? Jason S.? Luke P.? or ???
... View more
09-05-2013
09:30 AM
|
1
|
1
|
2450
|
|
POST
|
Advantages: speed, flexibility, awesomeness Disadvantages: none ... How about in 6 lines? d = dict([(r[0],(r[1],r[2])) for r in arcpy.da.SearchCursor(myTbl, ['pk1','origFld1','origFld2'])])
with arcpy.da.UpdateCursor('myFC', ['pk2','destFld1','destFld2']) as cc:
for rr in cc:
if rr[0] in d:
rr[1],rr[2],rr[3] = d[rr[0]][0],d[rr[0]][1],d[rr[0]][2]
cc.updateRow(rr)
... View more
08-29-2013
03:35 PM
|
0
|
0
|
540
|
|
POST
|
Yes. But why not just calculate 300 random pnts (at once), and extract the data? No need to do one pnt at a time 300 times, right?
... View more
08-22-2013
01:08 PM
|
0
|
0
|
874
|
|
POST
|
Here's an example of sorting a one-to-many by the date value. While the ESRI summary tools seem to struggle, Python does sort datetime objects correctly I think. http://forums.arcgis.com/threads/90090-List-Broken-Data-Source-s-Path?p=319811&viewfull=1#post319811
... View more
08-20-2013
08:14 AM
|
0
|
0
|
2424
|
|
POST
|
The 1st example was meant to show that if you had multiple John Smiths you could introduce a "counter" in the tuple key to keep seperate occurances of the same key "unique". This 1st example structure, I admit, is not very practical or efficient, but is a possible way of dealing with one-to-manys. I would recomend the second example... However, per the 1st example, to retreive a list of all the John Smith keys, you could use something like this: compKeyDict = {('smith, john', 1): "cat street", ('smith, john', 2): "dog street", ('smith, jack', 1): "clown street"}
johnSmithKeysList = [key for key in compKeyDict if "smith, john" == key[0]] can the composite key approach involve a list of items, or is it limited to single values and tuples? Per my understanding, the key can only be a single value or a tuple. List are not allowed, since they are mutable, and can be, for example, sorted in place - whcih would screw everything up. Lists of course can be converted to a tuple like this: testList = [1,2,3,4]
testTuple = tuple(list)
... View more
08-19-2013
03:47 PM
|
0
|
0
|
2424
|
|
POST
|
Richard - start here: https://developers.google.com/edu/python/. This is the best intro material I have seen. Watch the videos. If you want to cut to the dictionary part: http://www.youtube.com/watch?v=haycL41dAhg After you get familar with Python data structures, I think my examples will make sense.
... View more
08-19-2013
09:44 AM
|
0
|
0
|
2424
|
|
POST
|
To answer some of your questions: Does the key value have to be unique? Yes. But you can use tuples as keys as well (aka a composite key) - which of course also have to be unique. ...what happens if there are two people named John Smith that have different addresses in the look up table? You have to get creative - I routinely deal with one to many or many to manys by using either composite keys and/or composite look up values. A basic example: compKeyDict = {('smith, john', 1): "cat street", ('smith, john', 2): "dog street"}
compValDict = {'smith, john': ["cat street", "dog street"]} I would put a wager in that anything (well pretty much anything) you can do in a RDBMS you can also do much faster and cheaper using dictionaries. All it takes is imagination and a lot of conditional expressions! If it helps, here's a practical example of making use of a composite value dictionary where the sorted order of the many values are important to the overal analysis: http://forums.arcgis.com/threads/89835-brainteaser-viewshed-wind-turbines-the-more-you-see-the-worse-it-gets...?p=320549&viewfull=1#post320549
... View more
08-19-2013
09:02 AM
|
0
|
0
|
2424
|
|
POST
|
Recommended couse of action: Uninstall everything and anything ArcGIS Delete the folder C:\Program Files\ArcGIS (or C:\Program Files x86\ArcGIS if using a 64 bit OS) Uninstall everything and anything Python, including any Python IDEs like PythonWin Delete any and all Python2* folders that are directly under C:\ (example: C:\Python27). Reinstall ArcGIS v10.2 (which will automatically install the correct version of Python) Reinstall any 3rd party ArcGIS software (like Xtools or whatever). You remebered to uninstall these in Step #1, right? Reinstall your Python IDEs if any. Use this same process eveytime you upgrade ArcGIS (don't need to do that for the service packs of course). DO NOT use/install a different version of Python than that which comes with whatever version of ArcGIS you are using
... View more
08-15-2013
12:42 PM
|
0
|
0
|
1077
|
| 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
|