|
POST
|
There are several ways to do this. The nice thing about having spatial information is that you can treat it as such. Since you are evaluating difference in height for the "same" location you could process parts of the file (selected by location). Now this will be a little less slow, however creating a spatial selection might be slow anyway when processing 13 million points (in a shapefile which is I believe slower than a file geodatabase that is properly indexed). Now what I wonder is this; the 13 million points sound as LiDAR data. If you have a LAS file you can create a LAS dataset and use the LAS Point Statistics as Raster tool (ArcGIS Help (10.2, 10.2.1, and 10.2.2) ) which has an option to extract the Z_RANGE. If you don't have the LAS file, you can create one using LAStools converting a text file to a LAS file.
... View more
01-20-2015
06:44 PM
|
0
|
2
|
3017
|
|
POST
|
It seems that your output workspace is a folder so you are creating Esri grid files. There are some limitations regarding the naming of grid files and the folder they are created in. The maximum number of characters is 13 It cannot have spaces It cannot use special characters other than underscore ( "_" ) The name should start with a letter, not a number (recommendation) Try to use this also for the naming of the folders the raster will be stored in. So probably the dash in the main folder is causing this: C:/SPreAD-GIS/source_data Some more reading: ArcGIS Help (10.2, 10.2.1, and 10.2.2)
... View more
01-20-2015
06:30 PM
|
0
|
0
|
3834
|
|
POST
|
Not sure what the Patch Analyst is, but you could indeed convert the raster to polygons and use a union to create a featureclass with all the combinations (habitats vs counties). Then you can join the areas of the original counties to the result and determine the percentage for each habitat x county combination. If you have access to Spatial Analyst you could also do this in raster format. The tool that you would need is the Combine tool. The resulting raster has an attribute table with the combinations (a unique value will be created for each unique combination of habitat and county).
... View more
01-20-2015
06:18 PM
|
1
|
4
|
1457
|
|
POST
|
I wouldn't go for label classes in this case, since in the example above, with a simple line I am tackling 4 classes,,,
... View more
01-20-2015
06:08 PM
|
1
|
0
|
5067
|
|
POST
|
You could change the expression to: def FindLabel([LOT] ,[SUBDIVISION]):
return "{0}\n{1}".format([LOT], [SUBDIVISION]) It suppresses the error. However, this will return None if there is no data: The nice part of using the python expression is that you can enhance the result, replacing the None for a different text def FindLabel([LOT] , [SUBDIVISION]):
return "{0}\n{1}".format([LOT] if [LOT] != None else "No LOT", [SUBDIVISION] if [SUBDIVISION] != None else "No SUBDIVISION") ... will result in: ... or adding some formatting to the text: def FindLabel([LOT] , [SUBDIVISION]):
return "{0}\n{1}".format([LOT] if [LOT] != None else "<CLR red='255'>No LOT</CLR>", [SUBDIVISION] if [SUBDIVISION] != None else "<CLR red='255'>No SUBDIVISION</CLR>") will give:
... View more
01-20-2015
06:02 PM
|
1
|
2
|
5067
|
|
POST
|
wait... the lines are without Z... in the previous version. Yep this is better: Please find attached a new version of the lines. You will still have to set the projection of the data, since I do not know what projection your data is in.
... View more
01-19-2015
01:43 PM
|
0
|
0
|
3121
|
|
POST
|
OK, just in case you're interested, but I'm sure Dan will come up with a better solution: import arcpy
import os
import math
txt = r"D:\Xander\GeoNet\PointCloud\sample.txt"
fc_pnt = r"D:\Xander\GeoNet\PointCloud\gdb\test.gdb\points05"
fc_lines = r"D:\Xander\GeoNet\PointCloud\gdb\test.gdb\lines05"
max_dist = 25
arcpy.env.overwriteOutput = True
# sr = arcpy.SpatialReference()
# create empty fc
pnt_ws, pnt_name = os.path.split(fc_pnt)
arcpy.CreateFeatureclass_management(pnt_ws, pnt_name, "POINT", "#", "DISABLED", "ENABLED")
fld_X = "X"
fld_Y = "Y"
fld_Z = "Z"
fld_A = "Att"
fld_dist = "Dist"
arcpy.AddField_management(fc_pnt, fld_X, "Double")
arcpy.AddField_management(fc_pnt, fld_Y, "Double")
arcpy.AddField_management(fc_pnt, fld_Z, "Double")
arcpy.AddField_management(fc_pnt, fld_A, "Integer")
arcpy.AddField_management(fc_pnt, fld_dist, "Double")
flds = ("SHAPE@", fld_X, fld_Y, fld_Z, fld_A, fld_dist)
lst_lines = []
with arcpy.da.InsertCursor(fc_pnt, flds) as curs:
# open txt file
arr_line = arcpy.Array()
i = 0
with open(txt, 'r') as f:
for r in f.readlines():
i += 1
r = r.replace('\n', '')
lst = r.split(' ')
if i % 1000 == 0:
print "Processing line: {0}".format(i)
if i == 1:
x = float(lst[3])
y = float(lst[5])
xp = x
yp = y
else:
xp = x
yp = y
x = float(lst[3])
y = float(lst[5])
z = float(lst[10])
a = int(lst[12])
dist = math.hypot(xp-x, yp-y)
pnt = arcpy.Point(x, y, z)
pnt_g = arcpy.PointGeometry(pnt)
curs.insertRow((pnt_g, x, y, z, a, dist, ))
## if dist < max_dist:
## # add to line
## arr_line.add(pnt)
## else:
## # add previous line to list
## if arr_line.count > 1:
## polyline = arcpy.Polyline(arr_line)
## lst_lines.append(polyline)
##
## # create a new line
## arr_line = arcpy.Array()
## arr_line.add(pnt)
if a == 1:
# add to line
arr_line.add(pnt)
else:
# add previous line to list
if arr_line.count > 1:
polyline = arcpy.Polyline(arr_line)
lst_lines.append(polyline)
# create a new line
arr_line = arcpy.Array()
arr_line.add(pnt)
arcpy.CopyFeatures_management(lst_lines, fc_lines)
... View more
01-19-2015
12:19 PM
|
2
|
0
|
6822
|
|
POST
|
That makes more sense... I first started to play with the max distance between two vertices and with 10 meters it started to make sense, yet created some errores. With the 0 as beginning of a new line it is much better: If you're interested I can include the code. Is is ugly, but it worked.
... View more
01-19-2015
12:16 PM
|
0
|
2
|
3121
|
|
POST
|
Hi Tanya, Quick question... what is in the forth column (the 0 and 1 values)?
... View more
01-19-2015
10:27 AM
|
0
|
4
|
3701
|
|
POST
|
Hi Benjamin, First of all, congratulation on the detailed description you provided (this must be ne of the largest I've seen). There are a few things I notice: In the zoomed in image (# 3 with the selected lines) I notice the scale value (1:0,44) and the coordinates in the lower right corner (95,305 8,899433e+015 Decimal Degrees). Also other images present geografic coordinate outside the range of -180 to +180 (longitud) and -90 to +90 (latitud). Although your coordinate system of your data frame might be WGS_1984_UTM_Zone_19S, it seems that they may be interpreted as decimal degrees. In the georeferencing window I notice the X Map and Y Map coordinates to be te small. The comma is a decimal while the coordinates plotter in the Google Eartch screem dump seem to be a factor 1000 higher. Please re-enter the coordinates in the columns X Map and Y Map or edit the existing ones, and make sure that the correct coordinate system is used. Maybe something happened with the definition of you decimal symbol (point or comma) on your system in the mean time...
... View more
01-19-2015
10:04 AM
|
1
|
1
|
7647
|
|
POST
|
Looking at the screendumps you included, I can imagine that the conversion to raster was not useful. Is it possible to include (part of) the points? I would like to see if playing with the maximum length of the line could work for your data to get the result you are looking for.
... View more
01-19-2015
09:11 AM
|
0
|
0
|
3701
|
|
POST
|
It is not necessary to create a double loop, but to provide a sample that does not have that much changed see the script below. I introduced a dictionary "dct" holding the input name and the output name as key, value pair in the second loop the fc is split into the workspace and the featureclass name if the old name is in the dictionary (in the keys) then it is renamed import arcpy
import os
workspace = "D:\GIS\ZOne1\Zone1A"
feature_classes = []
walk = arcpy.da.Walk(workspace, datatype="FeatureClass", type="Polygon")
dct = {'featureclassName': 'featureclassName_renameTest',
'featureclassName1': 'featureclassName1_renameTest',
'another input name': 'corresponding output name'}
for dirpath, dirnames, filenames in walk:
for filename in filenames:
feature_classes.append(os.path.join(dirpath, filename))
for fc in feature_classes:
fc_ws, fc_name = os.path.split(fc)
if fc_name in dct:
arcpy.Rename_management(fc, os.path.join(fc_ws, dct[fc_name]))
... View more
01-19-2015
04:49 AM
|
2
|
1
|
1487
|
|
POST
|
Hi, First of all you should really use syntax highlighting: Posting Code blocks in the new GeoNet To recursively loop through folder and sub folder and detect the layerfiles (.lyr) you can use the arcpy.da.Walk functionality (asuming you have a recent version of ArcGIS). import arcpy
import os
workspace = r"D:\Xander\GeoNet"
walk = arcpy.da.Walk(workspace, datatype="Layer")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
print (os.path.join(dirpath, filename)) This prints each .lyr file it finds: D:\Xander\GeoNet\StackedLabels\aLayer.lyr D:\Xander\GeoNet\StackedLabels\subfolder\subsubfolder\subsubsubfolder\AnotherLayer.lyr In case you want to add all the layer found to an existing MXD you should open the MXD before the loop and add put the add layerfile logic inside the loop. Adding a lot of layer to an MXD will probably make it very slow. Your code might look like this (in case you run this inside a session of ArcMap and want to add the layers to the current session of ArcMap, hence the keyword "CURRENT"): import arcpy
import os
# suppose you want to add it to the current MXD (open MXD)
mxd = arcpy.mapping.MapDocument("CURRENT")
dataFrame = arcpy.mapping.ListDataFrames(mxd, "*")[0]
# base folder
workspace = r"D:\Xander\GeoNet"
walk = arcpy.da.Walk(workspace, datatype="Layer")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
layerfile = os.path.join(dirpath, filename)
addlayer = arcpy.mapping.Layer(layerfile)
arcpy.mapping.AddLayer(dataFrame, addlayer, "BOTTOM")
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
del addlayer, mxd In case you want to run it as a standalone script and/or add the layers to a different existing MXD, you should replace the keyword "CURRENT" on line 5 by a reference (string containing path and filename) to the MXD.
... View more
01-19-2015
04:33 AM
|
1
|
4
|
3106
|
|
POST
|
Maybe we could write a python script that will skip a line between vertices when it is larger than a certain length. In that case you could play with that tolerance (max length) and get a result that works for you. I think the points maybe in the right order, but just lacking an ID for the parts.
... View more
01-18-2015
06:52 PM
|
0
|
0
|
3701
|
|
POST
|
Maybe you could convert the point cloud to raster (each point the same value) and then convert the raster to polygons (or line if possible) and use that as pattern. Dan Patterson is absolutely right and yes it would be interesting to see what this pattern looks like. It will also to see if what I'm suggesting will work for your case or not...
... View more
01-18-2015
10:03 AM
|
0
|
0
|
3701
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|