Picking points in a specific distance interval Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Point to point distance over specified distanceHow to intersect shapefiles with elevation models?Questions about EPSG:6372Repairing link between shapefile and layer file?Calculating distance between latitude and longitude points using pythonDistance unit between line and point shapefilePoints along one or more lines at a time, with rotationScale difference between WGS84 WebMercator and Lambert projectionArcMap, creating lines from a set of points that connect to the other lineDerive Distance between Points and Polygons within Radius ArcMap
How can I make names more distinctive without making them longer?
8 Prisoners wearing hats
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
Is it common practice to audition new musicians 1-2-1 before rehearsing with the entire band?
Novel: non-telepath helps overthrow rule by telepaths
Using libraries other than PyQGIS to develop plugin for QGIS?
Why aren't air breathing engines used as small first stages
Why are there no cargo aircraft with "flying wing" design?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
How to answer "Have you ever been terminated?"
Generate an RGB colour grid
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
Significance of Cersei's obsession with elephants?
Fundamental Solution of the Pell Equation
T-test, ANOVA or Regression, what's the difference?
How to react to hostile behavior from a senior developer?
How to down pick a chord with skipped strings?
Using audio cues to encourage good posture
What is the meaning of the simile “quick as silk”?
What causes the direction of lightning flashes?
Is "Reachable Object" really an NP-complete problem?
Can a new player join a group only when a new campaign starts?
What does "lightly crushed" mean for cardamon pods?
Quick way to create a symlink?
Picking points in a specific distance interval
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Point to point distance over specified distanceHow to intersect shapefiles with elevation models?Questions about EPSG:6372Repairing link between shapefile and layer file?Calculating distance between latitude and longitude points using pythonDistance unit between line and point shapefilePoints along one or more lines at a time, with rotationScale difference between WGS84 WebMercator and Lambert projectionArcMap, creating lines from a set of points that connect to the other lineDerive Distance between Points and Polygons within Radius ArcMap
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a line of points in .shp file and the distance of the points varies. There can be 20 points in same place and then the distance can be something between 1 to 25 meters.
How can I pick points from the line every approx. 10m or 20 or 25 meters, so that
instead of cluster of 10000 points in one line I would have a nice line with 1000 points every 20 meters?
arcmap shapefile
add a comment |
I have a line of points in .shp file and the distance of the points varies. There can be 20 points in same place and then the distance can be something between 1 to 25 meters.
How can I pick points from the line every approx. 10m or 20 or 25 meters, so that
instead of cluster of 10000 points in one line I would have a nice line with 1000 points every 20 meters?
arcmap shapefile
1
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49
add a comment |
I have a line of points in .shp file and the distance of the points varies. There can be 20 points in same place and then the distance can be something between 1 to 25 meters.
How can I pick points from the line every approx. 10m or 20 or 25 meters, so that
instead of cluster of 10000 points in one line I would have a nice line with 1000 points every 20 meters?
arcmap shapefile
I have a line of points in .shp file and the distance of the points varies. There can be 20 points in same place and then the distance can be something between 1 to 25 meters.
How can I pick points from the line every approx. 10m or 20 or 25 meters, so that
instead of cluster of 10000 points in one line I would have a nice line with 1000 points every 20 meters?
arcmap shapefile
arcmap shapefile
edited Apr 10 at 9:35
sudheesh
218
218
asked Apr 10 at 7:51
VMJsVMJs
111
111
1
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49
add a comment |
1
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49
1
1
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49
add a comment |
1 Answer
1
active
oldest
votes
You could try code below. The Points have to be created in correct order to be able to convert into a line, or have a sort field which you can use. I only have one line, you have to modify the code if you have multiple lines:
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:Default.gdb' #Change
pointfc = 'roadpoints' #Change
mindist = 200 #Change
outpointfc = 'roadpoint_reduced' #Change
points = [i for i in arcpy.da.SearchCursor(pointfc,['OID@','SHAPE@'])] #List all point oids and geometries
#Convert points to line. If they are not in correct order, and more than one, use Line_Field and Sort_Field
arcpy.PointsToLine_management(Input_Features=pointfc, Output_Feature_Class=r'in_memorypointstoline')#, Line_Field=, Sort_Field=)
line = [i[0] for i in arcpy.da.SearchCursor(r'in_memorypointstoline','SHAPE@')][0]
#Measure distances between points along the line
points_with_dist_along_line = [[p[0],line.measureOnLine(p[1])] for p in points if not p[1].disjoint(line)]
#Iterate over three points at a time and remove middle one if distance between first and last is <mindist*2
#Do this until oid of last point is reached
points_to_keep = points_with_dist_along_line
count=0
oid = -1
while oid != points_with_dist_along_line[-1][0]:
group = points_to_keep[count:count+3]
oid = group[-1][0]
if len(group)==3:
if group[2][1]-group[0][1]<mindist*2:
points_to_keep.pop(count+1)
else:
count+=1
#Create a new fc with the results
oids_to_keep = tuple([i[0] for i in points_to_keep])
sql = "0 IN1".format(arcpy.Describe(pointfc).OIDFieldName, oids_to_keep)
arcpy.Select_analysis(in_features=pointfc, out_feature_class=outpointfc,
where_clause=sql)

add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318330%2fpicking-points-in-a-specific-distance-interval%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could try code below. The Points have to be created in correct order to be able to convert into a line, or have a sort field which you can use. I only have one line, you have to modify the code if you have multiple lines:
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:Default.gdb' #Change
pointfc = 'roadpoints' #Change
mindist = 200 #Change
outpointfc = 'roadpoint_reduced' #Change
points = [i for i in arcpy.da.SearchCursor(pointfc,['OID@','SHAPE@'])] #List all point oids and geometries
#Convert points to line. If they are not in correct order, and more than one, use Line_Field and Sort_Field
arcpy.PointsToLine_management(Input_Features=pointfc, Output_Feature_Class=r'in_memorypointstoline')#, Line_Field=, Sort_Field=)
line = [i[0] for i in arcpy.da.SearchCursor(r'in_memorypointstoline','SHAPE@')][0]
#Measure distances between points along the line
points_with_dist_along_line = [[p[0],line.measureOnLine(p[1])] for p in points if not p[1].disjoint(line)]
#Iterate over three points at a time and remove middle one if distance between first and last is <mindist*2
#Do this until oid of last point is reached
points_to_keep = points_with_dist_along_line
count=0
oid = -1
while oid != points_with_dist_along_line[-1][0]:
group = points_to_keep[count:count+3]
oid = group[-1][0]
if len(group)==3:
if group[2][1]-group[0][1]<mindist*2:
points_to_keep.pop(count+1)
else:
count+=1
#Create a new fc with the results
oids_to_keep = tuple([i[0] for i in points_to_keep])
sql = "0 IN1".format(arcpy.Describe(pointfc).OIDFieldName, oids_to_keep)
arcpy.Select_analysis(in_features=pointfc, out_feature_class=outpointfc,
where_clause=sql)

add a comment |
You could try code below. The Points have to be created in correct order to be able to convert into a line, or have a sort field which you can use. I only have one line, you have to modify the code if you have multiple lines:
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:Default.gdb' #Change
pointfc = 'roadpoints' #Change
mindist = 200 #Change
outpointfc = 'roadpoint_reduced' #Change
points = [i for i in arcpy.da.SearchCursor(pointfc,['OID@','SHAPE@'])] #List all point oids and geometries
#Convert points to line. If they are not in correct order, and more than one, use Line_Field and Sort_Field
arcpy.PointsToLine_management(Input_Features=pointfc, Output_Feature_Class=r'in_memorypointstoline')#, Line_Field=, Sort_Field=)
line = [i[0] for i in arcpy.da.SearchCursor(r'in_memorypointstoline','SHAPE@')][0]
#Measure distances between points along the line
points_with_dist_along_line = [[p[0],line.measureOnLine(p[1])] for p in points if not p[1].disjoint(line)]
#Iterate over three points at a time and remove middle one if distance between first and last is <mindist*2
#Do this until oid of last point is reached
points_to_keep = points_with_dist_along_line
count=0
oid = -1
while oid != points_with_dist_along_line[-1][0]:
group = points_to_keep[count:count+3]
oid = group[-1][0]
if len(group)==3:
if group[2][1]-group[0][1]<mindist*2:
points_to_keep.pop(count+1)
else:
count+=1
#Create a new fc with the results
oids_to_keep = tuple([i[0] for i in points_to_keep])
sql = "0 IN1".format(arcpy.Describe(pointfc).OIDFieldName, oids_to_keep)
arcpy.Select_analysis(in_features=pointfc, out_feature_class=outpointfc,
where_clause=sql)

add a comment |
You could try code below. The Points have to be created in correct order to be able to convert into a line, or have a sort field which you can use. I only have one line, you have to modify the code if you have multiple lines:
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:Default.gdb' #Change
pointfc = 'roadpoints' #Change
mindist = 200 #Change
outpointfc = 'roadpoint_reduced' #Change
points = [i for i in arcpy.da.SearchCursor(pointfc,['OID@','SHAPE@'])] #List all point oids and geometries
#Convert points to line. If they are not in correct order, and more than one, use Line_Field and Sort_Field
arcpy.PointsToLine_management(Input_Features=pointfc, Output_Feature_Class=r'in_memorypointstoline')#, Line_Field=, Sort_Field=)
line = [i[0] for i in arcpy.da.SearchCursor(r'in_memorypointstoline','SHAPE@')][0]
#Measure distances between points along the line
points_with_dist_along_line = [[p[0],line.measureOnLine(p[1])] for p in points if not p[1].disjoint(line)]
#Iterate over three points at a time and remove middle one if distance between first and last is <mindist*2
#Do this until oid of last point is reached
points_to_keep = points_with_dist_along_line
count=0
oid = -1
while oid != points_with_dist_along_line[-1][0]:
group = points_to_keep[count:count+3]
oid = group[-1][0]
if len(group)==3:
if group[2][1]-group[0][1]<mindist*2:
points_to_keep.pop(count+1)
else:
count+=1
#Create a new fc with the results
oids_to_keep = tuple([i[0] for i in points_to_keep])
sql = "0 IN1".format(arcpy.Describe(pointfc).OIDFieldName, oids_to_keep)
arcpy.Select_analysis(in_features=pointfc, out_feature_class=outpointfc,
where_clause=sql)

You could try code below. The Points have to be created in correct order to be able to convert into a line, or have a sort field which you can use. I only have one line, you have to modify the code if you have multiple lines:
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:Default.gdb' #Change
pointfc = 'roadpoints' #Change
mindist = 200 #Change
outpointfc = 'roadpoint_reduced' #Change
points = [i for i in arcpy.da.SearchCursor(pointfc,['OID@','SHAPE@'])] #List all point oids and geometries
#Convert points to line. If they are not in correct order, and more than one, use Line_Field and Sort_Field
arcpy.PointsToLine_management(Input_Features=pointfc, Output_Feature_Class=r'in_memorypointstoline')#, Line_Field=, Sort_Field=)
line = [i[0] for i in arcpy.da.SearchCursor(r'in_memorypointstoline','SHAPE@')][0]
#Measure distances between points along the line
points_with_dist_along_line = [[p[0],line.measureOnLine(p[1])] for p in points if not p[1].disjoint(line)]
#Iterate over three points at a time and remove middle one if distance between first and last is <mindist*2
#Do this until oid of last point is reached
points_to_keep = points_with_dist_along_line
count=0
oid = -1
while oid != points_with_dist_along_line[-1][0]:
group = points_to_keep[count:count+3]
oid = group[-1][0]
if len(group)==3:
if group[2][1]-group[0][1]<mindist*2:
points_to_keep.pop(count+1)
else:
count+=1
#Create a new fc with the results
oids_to_keep = tuple([i[0] for i in points_to_keep])
sql = "0 IN1".format(arcpy.Describe(pointfc).OIDFieldName, oids_to_keep)
arcpy.Select_analysis(in_features=pointfc, out_feature_class=outpointfc,
where_clause=sql)

edited Apr 10 at 12:29
answered Apr 10 at 11:39
BERABERA
17.2k62044
17.2k62044
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318330%2fpicking-points-in-a-specific-distance-interval%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If I understand correctly in the Simplify line in it will move the points and I want to keep or maintain them where they are and just remove the excessives. the tolarence "For the POINT_REMOVE algorithm, the tolerance you specify is the maximum allowable offset of each vertex from its original location. This value may be reduced locally in some areas when the option is used to resolve topological errors."
– VMJs
Apr 10 at 9:26
Okay, I need to keep points where they are, but thanks!
– VMJs
Apr 10 at 9:46
Are the Points created in correct order or do you have some sorting field so it would be possible to construct a line using Points To Line tool as a start to solve the task?
– BERA
Apr 10 at 10:21
Sorry, but your question has me confused because you mix and match the terms "lines" and "points". So.... does your shapefile contain lines or points?
– Stu Smith
Apr 11 at 6:49