|
POST
|
I'd stick to editing Alex Tereshenko's code. The main thing to edit is the template line coordinates used for cutting the polygons: pnt_arr.add(arcpy.Point(x_min, y_max)) # top left
pnt_arr.add(arcpy.Point(x_min, y_min)) # bottom left Suppose you want a cut line 45 degrees from NW to SE. You'd change the coordinates to: x_diff = math.tan(math.radians(45)) * (y_max - y_min)
pnt_arr.add(arcpy.Point(x_min - x_diff, y_max))
pnt_arr.add(arcpy.Point(x_min, y_min)) ... then keep trying cutting as you go right. Like picture below (maybe makes it more confusing...). Unfortunately, I don't believe there's any way to avoid coding on this one. You'd also have to do some extra coding to accommodate all possible line angles.
... View more
01-15-2018
01:56 PM
|
2
|
1
|
7958
|
|
POST
|
Sure, there are lots of ways to do it. I was thinking just changing the output table name each time through, like below. Of course, you could substitute in your value for 'drainline' or whatever is most useful. Just so you realize the reason your table keeps getting overwritten is that if the name doesn't change, it overwrites the previous file. outStatsTable = "C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity"
for i in range(10): # numbers 0-9
print outStatsTable + str(i)
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity0
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity1
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity2
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity3
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity4
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity5
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity6
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity7
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity8
C:/_LOCALdata/AB_ARCHYDRO/AB_ARCHYDRO_NOP.GDB/DrainageDensity9
... View more
12-22-2017
02:50 PM
|
1
|
1
|
2818
|
|
POST
|
You can either: a.) Calculate a unique ID to differentiate your lines in each feature class, Merge together, and calculate all the stats at once. b.) Change the output name of your stats table each time through the loop so it doesn't get overwritten, and Merge all those together afterwards. edit: I suppose you could also run Append each time through the loop to add to the stats table. General rule of thumb is to try not to run a tool each time through a loop, but it may be okay for just a few...
... View more
12-20-2017
03:44 PM
|
1
|
3
|
2818
|
|
POST
|
Thanks, Dan_Patterson. I was asking for a friend massaging data into a format suitable for their specific R package-dictated needs, which I gather relies on coordinates, not distances, from which it calculates distance via Pythagoras. In any case, they compared all the distances described above against geodesic, and both UTM and custom Polar azimuthal were extremely close to geodesic, so either of those seem adequate, as opposed to stock Polar, which seems to have more much more distortion near its edges than the distortion of almost completely crossing the next UTM zone. Thanks again.
... View more
11-29-2017
09:51 PM
|
1
|
0
|
1129
|
|
POST
|
Here’s the situation: need to calculate distances from a central point to several destination points. The distances would often cross a UTM boundary (usually by a few hundred km). The Polar azimuthal equidistant projection is attractive, but apparently distorts near 60 degrees, which is also near the central point. I figured I could use a custom version of Polar azimuthal equidistant, centred at the central point. My confusion is that the distances calculated in the custom projection are much more similar to the UTM distances than the original Polar CRS. So, if I accept that the UTM distances are distorted, that would lead me to believe that the custom CRS distances are also distorted. I suppose my main question is: how do I create a “good” equidistant projection, at about 60 degrees N? Please help, Melita Kennedy!
... View more
11-29-2017
07:47 PM
|
0
|
2
|
1245
|
|
POST
|
my_string = '<img src="X:\UB_Routing\images\ServiceOrders\150 E MAIN ST.png"><br>150 E MAIN ST'
print my_string.split('<br>')[1]
150 E MAIN ST
... View more
11-29-2017
01:30 PM
|
1
|
0
|
10877
|
|
POST
|
Have you considered using (or spatially enabling) your database do a point-in-polygon comparison, rather than pre-populating every possible point? Alternatively, calling a geometry service to do the comparison for you? for example: Geoprocessing - Point in polygon search | ArcGIS API for JavaScript 3.22
... View more
11-24-2017
11:25 AM
|
2
|
0
|
2580
|
|
POST
|
You only get one Excel file with the results from the last iteration because the whole model runs on each iteration, overwriting the final Excel file each time. You could get multiple Excel files if you varied the file name like you did with the Spatial Join output. Or, you could get a single output in the end by using Collect Values and merging the results before exporting to Excel. It probably won't be the exact result you're looking for, but that's the trade-off using model builder rather than Python...
... View more
11-21-2017
10:28 AM
|
1
|
0
|
1252
|
|
BLOG
|
Totally appreciate you rolling your own here, but just to be annoying, I happened to be doing something like this, and came across generic filters in scipy you can use for focal stats. from scipy.ndimage.filters import generic_filter as gf
kernel = np.ones((3,3))
my_min = gf(data, np.nanmin, footprint=kernel)
my_max = gf(data, np.nanmax, footprint=kernel) array([[1, 1, 0, 0, 0, 2, 1, 1, 0, 0],
[1, 1, 0, 0, 0, 2, 1, 1, 0, 0],
[2, 2, 2, 0, 0, 0, 1, 0, 0, 0],
[2, 2, 2, 0, 0, 0, 1, 0, 0, 0],
[3, 3, 4, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 1, 2, 0, 0],
[0, 0, 0, 0, 0, 1, 1, 2, 0, 0],
[0, 0, 0, 0, 0, 3, 2, 2, 0, 0],
[2, 2, 2, 3, 3, 3, 2, 2, 0, 0],
[2, 2, 2, 3, 3, 3, 2, 2, 0, 0]])
array([[5, 9, 9, 9, 9, 9, 9, 7, 3, 3],
[7, 9, 9, 9, 9, 9, 9, 7, 7, 7],
[9, 9, 9, 9, 9, 9, 9, 8, 7, 7],
[9, 9, 9, 8, 9, 9, 9, 9, 9, 7],
[9, 9, 9, 9, 9, 9, 9, 9, 9, 7],
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
[5, 5, 5, 9, 9, 9, 9, 9, 9, 9],
[6, 6, 9, 9, 9, 8, 8, 8, 8, 7],
[6, 6, 9, 9, 9, 8, 8, 8, 7, 7]])
... View more
11-20-2017
05:35 PM
|
0
|
0
|
627
|
|
POST
|
How to create a script tool: Create a script tool—ArcGIS Pro | ArcGIS Desktop Couldn't find the ArcGIS Pro help page for this, but I assume it's the same in Pro: Integrating scripts within a model—Help | ArcGIS for Desktop
... View more
11-20-2017
10:20 AM
|
0
|
0
|
722
|
|
POST
|
Can you just replace the word "Highway " (include space) with nothing (i.e. "")? See the examples here for replace syntax: Specify text for labels—ArcGIS Pro | ArcGIS Desktop
... View more
11-17-2017
02:12 PM
|
0
|
0
|
718
|
|
POST
|
First change your data frame to WGS84, then: Calculating area, length, and other geometric properties—Help | ArcGIS Desktop
... View more
11-17-2017
09:13 AM
|
1
|
0
|
1174
|
|
POST
|
Working backwards, you need to use SQL in your where clause, something like: StreetName not in ('BLVD', 'AVE', 'CIR') So, you need to somehow format your dictionary keys into a list of quoted strings, like in the final line below: typeDict = {"AVE":1,"BLVD":2,"CIR":3}
print typeDict
print typeDict.keys()
print ','.join(typeDict.keys())
print ','.join("'{}'".format(w) for w in typeDict.keys())
...
{'BLVD': 2, 'AVE': 1, 'CIR': 3}
['BLVD', 'AVE', 'CIR']
BLVD,AVE,CIR
'BLVD','AVE','CIR'
... View more
11-15-2017
03:28 PM
|
1
|
4
|
7053
|
|
POST
|
Include the full error message. There shouldn't be a problem trying to cast an existing string to a string (e.g. str("my_string")).
... View more
11-15-2017
10:15 AM
|
1
|
1
|
3986
|
|
POST
|
Zone 4 overlaps with two pixels, 3 and NoData. It looks like it doesn't quite explain it in the help, but the NoData is not counted in the COUNT output, nor considered in any of the other fields (e.g. MIN and MAX both equal 3).
... View more
11-15-2017
08:54 AM
|
2
|
1
|
3490
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|