Closed xingminw closed 3 years ago
I have tried using shapely
to covert a geojson LineString object to the wkt
format but unfortunately, this does not work.
You can check this link for example
https://github.com/cyang-kth/fmm/blob/master/example/notebook/fmm_example.ipynb
For GPS CSV you can do
from fmm import GPSConfig,ResultConfig
input_config = GPSConfig()
input_config.file = "../data/gps.csv"
input_config.id = "id"
input_config.gps_point = true
Thanks for your reply. I have run through the code successfully according to your instruction. This is what I get for the output status:
Status: success
Time takes 0.002 seconds
Total points 8 matched 8
Total trajectories 1 matched 1
Map match percentage 1
Map match speed 4000 points/s
However, when I look into the output file, all the opath
and cpath
are 0. I am not sure whether I get the correct results. I am also wondering when I use OSM data, how can I convert the opath
or cpath
id to get the OSM way id. I can open another issue to ask this question if necessary.
When I convert my input shapefile (obtained from osmnx) to geojson, I found almost all the "key"
value are 0. I am wondering how can I somehow set the key
the same as the osmid when I output the shapefile from osmnx. I guess this will fix my problem.
Thanks for your patience and help.
Please check the issue https://github.com/cyang-kth/fmm/issues/138#issue-735143262 for summary of common problems.
You need to refer to this https://github.com/cyang-kth/osm_mapmatching for downloading road network. The one downloaded from osmnx does not have the ID field (osmid could be a tuple and it should not be used as ID). This tutorial will save OSMNX network into a format compatible with fmm.
Thanks for your reply.
I am trying to use the Python API to match the trajectory in GPS coordinates (with time step). However, I am not that familiar with the LineString input. Almost all the examples provided in python API use the LineString as the input but I do not know how to convert the GPS coordinates to this format.
Therefore, I am wondering how can I convert the GPS coordinates to the LineString
wkt
format. Also in the wiki, it is stated that loading the GPS points incsv
file is supported. Could the author please provide an example matching the trajectory data in the format of GPS coordinates or give me some hints on how can I convert the GPS coordinates to the LineString format?Thank you!