Python Forum
Python script to only keep waypoints within x km from track?
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python script to only keep waypoints within x km from track?
#1
Hello,

I need to write a script in Python that can read a track and a set of waypoints, and only keep waypoints that lie within x kilometers from the track.

In pseudo-code:
from geopy.distance import distance

read track.gpx and waypoints.gpx
for each waypoint:
	get lat,lon
	compute distance from track
	if < 5km
		add waypoint to array
write array to file
Before I take a deeper look, does someone have some code I could use?

Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,257 Jun-29-2023, 11:57 AM
Last Post: gologica
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,916 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,298 May-28-2020, 05:27 PM
Last Post: micseydel
  Program to keep track of reading time test 3 2,452 Apr-08-2020, 08:38 AM
Last Post: snippsat
  [GPX] Read all trkpt, and merge into single track? Winfried 0 1,548 Jan-30-2020, 04:08 PM
Last Post: Winfried
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,635 May-11-2019, 08:12 PM
Last Post: keames
  [Idea Required] How can i track any change on a webpage? Prince_Bhatia 1 2,102 Apr-24-2019, 11:21 AM
Last Post: metulburr
  Select next file in directory and keep track of what's already been selected loganpmgoa 2 2,895 Feb-27-2019, 11:54 PM
Last Post: loganpmgoa
  How to run python script which has dependent python script in another folder? PrateekG 1 3,159 May-23-2018, 04:50 PM
Last Post: snippsat
  How to call one python script and use its output in another python script lravikumarvsp 3 32,415 May-16-2018, 02:08 AM
Last Post: lravikumarvsp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020