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

Impossible isochrones #49

Closed
UNFPAmaldives opened this issue Jul 10, 2019 · 4 comments
Closed

Impossible isochrones #49

UNFPAmaldives opened this issue Jul 10, 2019 · 4 comments
Labels

Comments

@UNFPAmaldives
Copy link

UNFPAmaldives commented Jul 10, 2019

When I run osrmIsochrone for a set of points in Alaska, it returns some impossible results. I'm running a local osrm server based on https://download.geofabrik.de/north-america/us/alaska-latest.osm.pbf

options(osrm.server = "http://localhost:5000/") #this works sort of
isochrone <- map2(latlon$lon, latlon$lat, 
                  ~ osrmIsochrone(loc = c(.x, .y),
                                  breaks = seq(0, 60, 60))) %>%
  do.call(what = rbind)

At first, the results look plausible:
large
But on closer inspection, they don't make any sense. Here, for example, is Sitka, Alaska:
sitka
What I'm doing here is plotting the service area (60 minutes' driving time) for a facility (orange dot) as compared with the census tracts for the area. The isochrone for the service area is blue; the different census tracts are in purple/green. I have confirmed that the proj4strings for both the census tract polygons and the isochrones are exactly the same.

What doesn't make sense about the isochrone plotted in the image above is that the roads around Sitka, Alaska, don't extend for more than 10 miles. There's no way that you could traverse Baranof Island and reach the next island to the east simply by driving for an hour. There's no roads. Also, there's a mountain range and a sea strait in the way. The inaccuracy of the isochrone affects my analysis, because it would suggest that I include a census tract in the Sitka facility's service area which, in fact, is not reachable within a 60 minute drive.

mt
sat
So I used the osrm-frontend to look up what osrm-backend is doing. Here's the route it gives me when I try to plot a course from Sitka to the eastern side of Baranof Island:
route
It would take three days to hike from the end of the road, as pictured above, to the eastern side of Baranof Island. But the directions given above don't mention that — and osrmIsochrone, for a reason I can't determine, believes you can drive all the way to the next island within 60 minutes.

Additionally, the isochrones for Anchorage suggest that most of Anchorage Bay is driveable. It is not, even in winter. Here's a plot of the facilities without isochrones:
wo
Here's the facilities' 60-minute isochrones, suggesting a drive into the bay:
anch

I still have isochrones for facilities in 49 other states to plot, so I don't know if the issue is with the map, or with osrmIsochrone, or with osrm-backend, but this is not an auspicious start. I have some doubts that isochrones produced for the facilities in the other 49 states would be analytically valid.

@UNFPAmaldives
Copy link
Author

Here's a reproducible example for Sitka:

docker run -t -v c:/Users/laissezpasser/d/:/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/alaska-latest.osm.pbf
docker run -t -v c:/Users/laissezpasser/d/:/data osrm/osrm-backend osrm-partition /data/alaska-latest.osrm
docker run -t -v c:/Users/laissezpasser/d/:/data osrm/osrm-backend osrm-customize /data/alaska-latest.osrm
docker run -t -i -p 5000:5000 -v c:/Users/laissezpasser/d/:/data osrm/osrm-backend osrm-routed --algorithm mld /data/alaska-latest.osrm
docker run -p 9966:9966 osrm/osrm-frontend

Sitka <- osrmIsochrone(loc = c(-135.3195,57.04982), breaks = seq(from = 0,to = 60, by = 60))

And here's one for Anchorage:
Anchorage <- osrmIsochrone(loc = c(-149.8919,61.21981), breaks = seq(from = 0,to = 60, by = 60))

@rCarto rCarto added the bug label Jul 11, 2019
@rCarto
Copy link
Member

rCarto commented Jul 11, 2019

Ouch, It's much worst than I thought!

rCarto pushed a commit that referenced this issue Jul 11, 2019
@rCarto
Copy link
Member

rCarto commented Jul 11, 2019

I pushed a fix to this problem.
Can you please try the dev version of the package (remotes::install_github("rCarto/osrm").
This is a quick fix for now and any feedbacks are more than welcome.
I'll publish an updated version of the package as soon as possible.

@UNFPAmaldives
Copy link
Author

Now these results make much more sense!
Sitka:
sitka_rev
Anchorage:
anchorage_rev
I'll test further on an expanded data set. Thanks very much for your assistance!

@rCarto rCarto closed this as completed Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants