1

I have a big csv that contains this information of trip data for each point in 1s interval: lon, lat, timestamp and street_id. My aim is to segment street to 30m long segments and assign a unique segment id to each point based on its position.

Here is an example of what my data looks like using df.head():

    timestamp           Lat           Lon           street_id
0   4/1/2014 0:11:00    40.7694320    -73.9544329   140
1   4/1/2014 0:17:00    40.7264327    -74.0343245   50

I'm using dask as follows to get the data:

from dask.distributed import Client
client = Client()

df = dask.dataframe.read_csv(...)

I just don't know how to begin, I know I have to group by street_id then calculate the distance between each point and the beginning of the street, but I've failed to find how to find how to do so

The expected result should look like:

    timestamp           Lat           Lon           street_id    segment_id
0   4/1/2014 0:11:00    40.7693330    -73.9533349   140          5
1   4/1/2014 0:17:00    40.7263337    -74.0333345   50           1

Segment_id should be a unique identifier for each street segment of 30m long.

3
  • 1
    Your question is a bit too difficult to answer because it deals with several different problems at once. Instead of asking "how to I achieve the final product I'm looking for", try to conceptualize the steps you need to take and then tackle each one of those steps individually. Ex: 1) sort the dataset by street_id and timestamp; 2) generate a line connecting all the points from each unique street_id; 3) split the street lines into uniform 30m segments. So try tacking the each step at a time and, if you get stuck, post what you've tried, what you expected and what happened.
    – Felipe D.
    May 3, 2021 at 23:56
  • 1
    check this page:stackoverflow.com/questions/62990029/… Jul 12, 2021 at 8:04
  • There does not appear to be a GIS component to this question because it does not use any spatial libraries. gis.stackexchange.com/q/394501/115 seems to be derived from it and that does mention a spatial library (GeoPandas).
    – PolyGeo
    Jul 18, 2021 at 5:57

0

Browse other questions tagged or ask your own question.