Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpath and mgeom unmatched #256

Closed
Vera977 opened this issue Dec 9, 2022 · 3 comments
Closed

cpath and mgeom unmatched #256

Vera977 opened this issue Dec 9, 2022 · 3 comments

Comments

@Vera977
Copy link

Vera977 commented Dec 9, 2022

output file

mgeom is the geometry of the cpath. My understanding is that mgeom should include the starting and ending latitude and longitude of each path in cpath. So should the number of lon-lat pairs in mgeom be supposed to be twice the number of paths in cpath?
However, When I printed the outcomes of fmm, the lengths of mgeom and cpath were not matched.

Below left is the number of paths in cpath, and right is the number of lon-lat pairs in mgeom in my results. It seems that path and geometry do not correspond. So how can I extract the latitude and longitude of starting & end points of paths in cpath? Thanks!

4 5
18 34
33 42
59 73
47 59
29 65
8 11
51 78
16 116
43 54
57 82
25 59
25 37
4 20
20 41
15 28
62 119
29 81
12 14
40 71
31 41
18 20
15 23
47 82
89 171

@cyang-kth
Copy link
Owner

The mgeom path is not completely the geometry of cpath, since the trajectory may pass only part of the start and end edge. The lat lng pairs may be equal as it depends on the geometry of edges. You need to fetch the information yourself using the network object to get edge geometry.

image

@Vera977
Copy link
Author

Vera977 commented Dec 11, 2022

@cyang-kth
Thanks for your reply. I now understand the true meaning of mgeom.
Another related issue is, when I looked up the edge_gdf in the network download from osm, I found the cpath id was not the id in edge_gdf.
For example, a matched point's lon-lat geom in pgeom is (30.6677305956,104.063176281) and its traversed path id is 2274 in opath. So I looked up id 2274 in the geodataframe edge_gdf generated from edges.shp to get the edge geom. Then I plot the edge geometry (id 2274) and the matched point geom in a folium map. It seems that the opath id 2274 is not the edge_gdf id 2274. They are very far apart. Please see picture below. So how can I get the path geom information if the path id do not correspond to the edge id? Thanks!
image

@Vera977
Copy link
Author

Vera977 commented Dec 12, 2022

@cyang-kth Thanks for your reply. I now understand the true meaning of mgeom. Another related issue is, when I looked up the edge_gdf in the network download from osm, I found the cpath id was not the id in edge_gdf. For example, a matched point's lon-lat geom in pgeom is (30.6677305956,104.063176281) and its traversed path id is 2274 in opath. So I looked up id 2274 in the geodataframe edge_gdf generated from edges.shp to get the edge geom. Then I plot the edge geometry (id 2274) and the matched point geom in a folium map. It seems that the opath id 2274 is not the edge_gdf id 2274. They are very far apart. Please see picture below. So how can I get the path geom information if the path id do not correspond to the edge id? Thanks! image

I checked my code and found that I made a mistake. The opath id is exactly the edge id. Thanks, author! ^-^

@Vera977 Vera977 closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants