Hello i have a mosaic dem and i have extracted contours wit interval = 2 meters. Now i want to convert contours to points xyz with distance of 1 meter from one point to another at the same contour line for each contour, any suggestion?
You can use some python to obtain the points you want:
import arcpy, os fc_in = r"C:\Forum\Pasture\gdb\Contours.gdb\contours2" fc_out = r"C:\Forum\Pasture\gdb\Contours.gdb\contour_pnts03" fld_contour = "Contour" interval = 1 # create empty output featureclass sr = arcpy.Describe(fc_in).spatialReference out_ws, out_name = os.path.split(fc_out) arcpy.CreateFeatureclass_management(out_ws, out_name, "POINT", fc_in, "DISABLED", "DISABLED", sr) # add field with contour value to output fc arcpy.AddField_management(fc_out, fld_contour, "DOUBLE") cnt = 0 with arcpy.da.InsertCursor(fc_out, ("SHAPE@", fld_contour)) as curs_out: with arcpy.da.SearchCursor(fc_in, ("SHAPE@", fld_contour)) as curs_in: for row_in in curs_in: polyline = row_in[0] contour = row_in[1] max_len = polyline.length d = 0 while d < max_len: pnt = polyline.positionAlongLine(d, False) curs_out.insertRow((pnt.firstPoint, contour, )) cnt += 1 if cnt % 100 == 0: print "Processing point: {0}".format(cnt) # pnt.firstPoint d += interval curs_out.insertRow((polyline.lastPoint, contour, )) cnt += 1
Change the lines 3 and 4 to point to your input featureclass and the output you want to create.
If you have ArcMap 10.2.x at the Advanced level try the Densify tool or try this version for lower license levels, then convert to points
thanks a lot for your help. I tried your code and i only change the path for my files (line 3 & 4) but when i run the code i get that message.
Runtime error
Traceback (most recent call last):
File "<string>", line 8, in <module>
NameError: name 'os' is not defined
What should i do? Isn't there any solution without code?
i corrected it and now i get
Parsing error Indentation Error: expected an indented block (line 18)
now an error 000732 for some reason
Hi Xander,
Can it be done for the polygons?
https://community.esri.com/thread/262214-arcpy-script-to-write-same-record-in-another-feature-layer If it can be done for polygons, then it will answer my query.
Thanks in advance.
Kind regards,
Shahriar
Hi Shahriar Rahman
The original questions extracts points from polylines (contours), but you want to extract points from a polygon? This is possible, but how should these points be distributed? Extract points from the outline of the polygon, generate random points inside the polygon, generate points at a certain distance inside the polygon?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.