0

There are DataFrame data including latitude and longitude.

df = pd.DataFrame([(30.69225,104.04275),(30.69124,104.04281),(30.69050,104.04394),
                   (30.68979,104.04514),(30.68946,104.04551),(30.68927,104.04572),
                   (30.68615,104.04617),(30.68483,104.04536),(30.68379,104.04483)])

The distance gap between two consencutive points are: {0.0,112.4,135.8,139.3,50.9,29.2,349.6,165.9,126.3}

I want to get a new DataFrame, where the distance of each data in it is 200 meters to 400 meters.For the above example:

30.69225  104.04275
30.69050  104.04394
30.68927  104.04572
30.68615  104.04617
30.68379  104.04483

The distance gap between two consencutive points are: {0.0,225.4,218.3,349.5,292.0} (The index in df is: [0,2,5,6,8])

How to do this?

Luo
  • 1
  • 1
  • Please add more details to the question, what do you mean by every 200m to 400m, all we see iis a dataframe with pair values – ThePyGuy Mar 29 '21 at 14:08
  • You can calculate distance using https://stackoverflow.com/q/29545704/6075699 and then filter based on it. Hope it helps. – Dishin H Goyani Mar 29 '21 at 14:25
  • I want to get a new dataframe, where the distance of each data in it is 200 meters to 400 meters. – Luo Mar 30 '21 at 01:31
  • `30.68379 104.04483`'s distance is 126.3, why it appears in you target answer? 126.3 is not between 200 and 400. – ramwin Mar 30 '21 at 03:38
  • Because the distance between (30.68379 104.04483) and the previous row of data (30.68615 104.04617) is 292.0 meters. – Luo Mar 30 '21 at 06:33
  • How do you calculate the distance and what's the unit of these point? – Ynjxsjmh Mar 30 '21 at 07:34
  • These points are latitude and longitude coordinates. The distance is obtained using the great_circle() function in geopy. – Luo Mar 30 '21 at 08:42

0 Answers0