Comments (4)
In fact osrmIsochrone()
already use snapped points.
1- We create a regular square grid centered on loc
. The resolution of the grid is res
x res
, its size is defined by how far you could go in any direction at 120km/h in a straight line (for the car profile)
2- We compute a table of durations from loc
to the grid points with osrmTable()
.
3- osrmTable()
returns durations and the points actually used ("destinations", points snapped on the road network) to compute durations. We use these snapped points to assign duration values to the original grid cells/points.
4- We assign the value max(breaks) + 1
to any point that has a NA value (points that are not reachable)
5- We apply the isoband algorithm through mapiso
to create isochrones.
6- it creates the small unreachable islands
I've created a small package with a different algo : https://github.com/rCarto/isochrone
1, 2 and 3 are the same steps
4- we transform the grid to a raster
5- we apply a focal moving window to the raster. It produces a smoothed version of the ratser and it fills the NA cells with smoothed values
6- We apply the isoband algorithm through mapiso
to create isochrones.
7- it creates a lot less small unreachable islands
from osrm.
Thanks for testing. I may add the smooth option to osrmIsochrone()
, putting terra
in "Suggests" and testing its install in the function (something like that https://github.com/riatelab/mapsf/blob/b05f7e85b4f6a549af2f178f5b547f2cd3dca241/R/mf_raster.R#L106)
from osrm.
I have tried to add a nearest = TRUE
option to osrmIsochrone
by adding a rgrid_nearest
function to utils.R
to force the grid points to snap to the road network. However while running
example_isochrone_nearest <-
osrm::osrmIsochrone(
loc = c(5.653536, 53.019535),
breaks = seq(0, 30, 5),
osrm.profile = "car",
res = 50,
nearest = TRUE
)
i get an Error: It seems that 'x' is not a regular grid.
and cannot find where this error occurs. Any hints on next steps?
See my mofifications in this branch:
master...aTnT:osrm:osrmIsochrone_with_optional_osrmNearest
from osrm.
Thanks for this, the focal filtering is a great feature, adding it to osrm
would be nice but i can understand that you don't want to add the terra
dependency. I also able to reproduce the results with terra_1.7-71
if someone is running previous with versions of terra
you might be faced with an error Error: [focal] with "na.rm=TRUE" and weights other than 0, 1, or NA, only fun="sum" is allowed
. In this case just upgrade to terra >= 1.7-71 and errors are gone.
from osrm.
Related Issues (20)
- Improve error handling osrmIsochrone(): out of bounds
- Improve error handling `osrmIsochrone()`: character vector of location HOT 1
- Improve error handling `osrmIsochrone()`: handle empty isochrones
- Improve documentation `osrmIsochrone()`: `breaks` argument
- Define "isometric" and "isodistance"
- Speed parameter HOT 3
- Stop osrm "connecting" to the network via certain types of roads HOT 6
- Problem with input data and osrmTrip() HOT 3
- curl::curl_fetch_memory(utils::URLencode(url) => connection was reset HOT 4
- osrmIsochrone(): 'loc' is too far from the OSRM network but loc is not too far... HOT 9
- Error in `osrmTrip()` when location coordinates are close to each other and/or not on roads HOT 2
- pairwise distance matrix from OSRM? HOT 2
- Using custom driving profiles HOT 2
- Problem with self-hosted server connection HOT 11
- Curl Header Overflow for Large Distance Matrices HOT 4
- fix pkg level documentation
- Duration of trip in osrmRoute and time of the day/traffic HOT 1
- Error using `osrmTable` with local server: long vectors not supported yet HOT 1
- Not working "exclude" option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osrm.