|
POST
|
Hi Dan Unfortunately not yet, I started working through your code and got stuck in understanding your reasoning behind reshaping the array from two dimensional to three dimensional lines 31 to 36. I still have quiet a bit to learn about NumPy and haven't needed to work with anything more than a two dimensional array.
... View more
08-23-2017
06:12 AM
|
0
|
1
|
783
|
|
POST
|
Hi Xander Thanks for the solution, this will definitely work and the approach is clean and simple, not over complicated.
... View more
08-11-2017
07:56 AM
|
0
|
2
|
1978
|
|
POST
|
Hi Xander I'm looking to mosaic the smaller areas, as you mentioned the following wouldn't be a problem if I mosaiced the tiles into a single image. The group mosaic's are a lot smaller in file such and easier to load within the AutoCAD software.
... View more
08-11-2017
04:02 AM
|
0
|
4
|
1978
|
|
POST
|
Hi Dan Thanks for the advice, I'll have look graph groupings let you know what I finally use to solve the following.
... View more
08-10-2017
03:02 AM
|
0
|
6
|
1978
|
|
POST
|
I have created a index grid feature class that represents the tiles of images that I have for a project study area. What I'm looking to do, is mosaic the raster tiles into a suitable number of tile groups that will reduce the Raster extent of the overall Raster study area extent to reduce the amount of NoData and overall image size. At first thought the problem to solve is the number of tiles to generate that will optimally reduce the overall raster extent thereby reducing the NoData and overall image size. Index Grid Polygon Feature Class Index Grid Groups I've attached the Index Grid Shapefile. Any advice in possible methods that I could apply to determine the most optimal groupings to reduce the NoData and overall Image Size. How the find the balance between the number of tile groups and overall image size.
... View more
08-09-2017
03:55 PM
|
0
|
8
|
2303
|
|
POST
|
Hi Joshua Thanks for the following, sorry I should have been more clear in my post. I'm trying to re-write an existing Python module based on a previous post Extract Polyline Geometry Z and M - Equal Area Slope where I'd like to replace the use of ArcPy "SplitLine_Management" with NumPy arrays and Pandas DataFrames. I wan't to remove the need for and Advanced Licence for the end user.
... View more
07-14-2017
12:47 PM
|
0
|
1
|
3385
|
|
POST
|
Hi Dan I actually need the distance between each vertices. I'm trying to re-write the Python module to calculate the "Equal Area Slope" using NumPy and Pandas and not ArcPy "SplitLine_Management" based on my previous post: Extract Polyline Geometry Z and M - Equal Area Slope.
... View more
07-14-2017
12:39 PM
|
0
|
0
|
3385
|
|
POST
|
Hi Dan, Thanks this will get me started. I'll post shortly what I come up with and if I get stuck.
... View more
07-14-2017
08:08 AM
|
0
|
0
|
3385
|
|
POST
|
Hi Joshua I've attached a copy of the polylines unsplit as well as a copy of the polylines split with the output fields and values that I'm trying to achieve.
... View more
07-14-2017
08:03 AM
|
0
|
0
|
3385
|
|
POST
|
I have converted a feature class (polylines) to a numpy array and have expoded the polylines to vertices using the "explode_to_points" method. I would like to convert the output numpy array to a pandas dataframe that will replicate the line segments that make up the polyline so that I land up with the following columns: The table above was achieved by using "Split Line At Vertices". The fields "STElev" and "EndElev" are the Start Elevation and End Elevation of the line segments determined using "Calculate Geometry". The field "STElevation" and "EndElevation" is the change in elevation determined by subtracting the elevation from the first "STElev" which in this case is 355.8495. The output numpy array from converting my feature class (polylines) and exploding the features to vertices is: The values are: [(DrainID, X, Y, Z)....] for each vertice '''
Created on 01 Jul 2017
@author: PeterW
'''
# import modules and site-packages
import numpy as np
import pandas as pd
from pathlib import Path
import arcpy
# set environment settings
arcpy.env.overwriteOutput = True
# check out extensions
arcpy.CheckOutExtension("3D")
def longestflowpath_3d(dtm, lfp_2d):
"""Generate LongestFlowPath 3D
from LongestFlowPath 2D and DTM"""
output_gdb = str(Path(lfp_2d).parents[0])
lfp_3d = "{0}\\{1}".format(output_gdb, "lfp_3d")
lfp_3d = arcpy.InterpolateShape_3d(dtm, lfp_2d, lfp_3d, vertices_only=True)
arcpy.FlipLine_edit(lfp_3d)
return lfp_3d
def area_under_profile(lfp_3d):
"""Determine the Equal Area Slope
for each Drainage Area's Longest
Flowpath"""
arr = arcpy.da.FeatureClassToNumPyArray(lfp_3d, ["DrainID", "SHAPE@X", "SHAPE@Y", "SHAPE@Z"], explode_to_points=True) # @UndefinedVariable
print(arr)
def equal_area_slope(dtm, lfp_2d):
"""Determine the Equal Area Slope
for each Drainage Area's Longest
Flowpath"""
lfp_3d = longestflowpath_3d(dtm, lfp_2d)
area_under_profile(lfp_3d)
if __name__ == "__main__":
dtm = r"E:\Projects\2016\G113665\geoHydro\DTM2\raw1"
lfp_2d = r"E:\Projects\2016\G113665\geoHydro\Model02\Results.gdb\LongestFlowPath_2D_Orig"
equal_area_slope(dtm, lfp_2d) My current Python Module How can I convert the current numpy array to a pandas dataframe that will restructure the vertices (DrainID, X, Y, Z) to (DrainID, STElevation (change in elevation), EndElevation (change in elevation), DistM (Length of segment)?
... View more
07-14-2017
02:21 AM
|
0
|
13
|
12672
|
|
POST
|
Hi Dan Thanks for the following. In order to get the following solved before my deadline. I extracted the Z values from the DTM using the InterpolateShape_3d. I then split the polylines using SplitLine_management to split the polyline in segments. I added the the following fields: ["STElev", "EndElev", "STElevation", "EndElevation"]. I then calculated the Start Elevation and End Elevation using Calculate Geometry. Thereafter I calculated the "STElevation" by subtracting each elevation by the initial STElev (i.e. 355.9268 - 355.8495), "EndElevation" (i.e. 355.6268 - 355.9268). I then used a Search Cursor and calculated the area for each trapezoid using the following formula: '''
Created on 22 Jun 2017
@author: PeterW
'''
# import modules and site packages
import arcpy
# set environment settings
arcpy.env.overwriteOutput = True
def equal_area_slope(lfp_3d, lfp_3d_split):
"""Determine the Equal Area Slope
for each Drainage Area's Longest
Flowpath"""
slope_area_dict = {}
with arcpy.da.SearchCursor(lfp_3d_split, ["DrainID", "STElevation", "EndElevation", "SHAPE@LENGTH"]) as scur: # @UndefinedVariable
for row in scur:
trap_area = ((row[1]+row[2])/2)*row[3]
slope_area_dict.setdefault(row[0], []).append(trap_area)
with arcpy.da.UpdateCursor(lfp_3d, ["DrainID", "EASlope", "SHAPE@LENGTH"]) as upcur: # @UndefinedVariable
for row in upcur:
if row[0] in slope_area_dict:
slope_area = sum(slope_area_dict[row[0]])
right_ordinate = (slope_area*2)/row[2]
ea_slope = (right_ordinate/row[2])*100
row[1] = ea_slope
upcur.updateRow(row)
if __name__ == "__main__":
lfp_3d = r"E:\Projects\2016\G113665\geoHydro\Model02\Results.gdb\LongestFlowPath_3D"
lfp_3d_split = r"E:\Projects\2016\G113665\geoHydro\Model02\Results.gdb\LongestFlowPath_3D_split"
equal_area_slope(lfp_3d, lfp_3d_split) I've started re-writing the following using NumPy arrays. I've converted the 3D polyline into a NumPy array. The array contains the "DrainID" X Coordinate, Y Coordinate, Z Coordinate for each point. How do I go about replicating the following using NumPy arrays? I trying to figure out the most Pythonic way of creating an array of "DrainID", "STElevation", "EndElevation" and "SegmentLength" Current Code: ''
Created on 01 Jul 2017
@author: PeterW
'''
# import modules and site-packages
import numpy as np
import pandas as pd
from pathlib import Path
import arcpy
# set environment settings
arcpy.env.overwriteOutput = True
# check out extensions
arcpy.CheckOutExtension("3D")
def longestflowpath_3d(dtm, lfp_2d):
"""Generate LongestFlowPath 3D
from LongestFlowPath 2D and DTM"""
output_gdb = str(Path(lfp_2d).parents[0])
lfp_3d = "{0}\\{1}".format(output_gdb, "lfp_3d")
lfp_3d = arcpy.InterpolateShape_3d(dtm, lfp_2d, lfp_3d, vertices_only=True)
arcpy.FlipLine_edit(lfp_3d)
return lfp_3d
def area_under_profile(lfp_3d):
"""Determine Area Under Profile"""
arr = arcpy.da.FeatureClassToNumPyArray(lfp_3d, ["DrainID", "SHAPE@X", "SHAPE@Y", "SHAPE@Z"], explode_to_points=True) # @UndefinedVariable
print(arr)
def equal_area_slope(dtm, lfp_2d):
"""Determine the Equal Area Slope
for each Drainage Area's Longest
Flowpath"""
lfp_3d = longestflowpath_3d(dtm, lfp_2d)
area_under_profile(lfp_3d)
if __name__ == "__main__":
dtm = r"E:\Projects\2016\G113665\geoHydro\DTM2\raw1"
lfp_2d = r"E:\Projects\2016\G113665\geoHydro\Model02\Results.gdb\LongestFlowPath_2D_Orig"
equal_area_slope(dtm, lfp_2d)
... View more
07-01-2017
11:41 AM
|
0
|
0
|
1172
|
|
POST
|
I'm currently busy writing a Python Module to determine the Equal-Area Slope of the Longest Flowpath of each catchment. I need to generate a Python Dictionary for each Longest Flowpath within the polyline Feature Class with the following format. v = vertex z = Change in height (i.e. 0, 1, 2,....150) seq = segment length between vertices (i.e. v1 - v2, 200m, v2 - v3, 300m,....v100 - v101, 500m) longestflowpath_dict = {DrainID: [(v1(Z), v2(Z), seg1(M)),(v2(Z), v3(Z), seg2(M)),...(v100(Z), v101(Z), seq100(M)) What approaches could I use to extract the geometry Z and M between each vertices to determine the lengths between each vertices. The Z values stored are the accumulated difference in height between each vertices. I've included the documentation from the engineering manual with the manual methodology of determining the Equal Area Slope.
... View more
06-21-2017
09:01 AM
|
0
|
2
|
1734
|
|
POST
|
Hi Dan, Thanks for the following, worked like a charm. MST - Minimum Spanning Tree Peano Curve - Space-Filling Curve
... View more
06-20-2017
03:16 PM
|
1
|
1
|
2110
|
|
POST
|
I'm currently busy with setting up a Household Income Survey for a project that we have in Dar es Salaam. I have created clusters of house locations with the help of Curtis Price based on the following post https://community.esri.com/thread/195972-how-to-group-points-into-optimal-clusters-proximity-and-timeframe My next challenge is that I'd like to create an optimal path for each cluster by creating the shortest path between each point for each cluster so that the shortest path is depicted for the surveyors to take to eliminate time wasted and the possibility of not completing any of the household surveys.. What approach or methodology could I follow to create the shortest polyline joining the points for each cluster separately that would depict the best path to take to complete the Household Income survey for each cluster separately. We have allocated 24 devices to 24 surveyors that will carry out the survey for each cluster over a period of eight days. Study Area: 24 Clusters Study Area Group1: Optimal Path Example
... View more
06-03-2017
01:22 AM
|
0
|
6
|
2968
|
|
POST
|
Hi Curtis The following has worked perfectly, with a few minor manual adjustments to the clusters. Thanks so much for the following. Same group for some reason, not sure why.
... View more
06-01-2017
12:23 PM
|
0
|
1
|
2151
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | 01-16-2012 02:34 AM | |
| 1 | 05-07-2016 03:04 AM | |
| 1 | 04-10-2016 01:09 AM | |
| 1 | 03-13-2017 12:27 PM | |
| 1 | 02-17-2016 02:34 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-04-2021
12:50 PM
|