mad-science@ricepo
This package can compute isodistance polygons based on driving distance.
$ git clone [email protected]:ricepo/isodist.git
$ cd isodist
$ npm install
In order to run isodist
, you will need to download an *.osm
file corresponding to the region
where you want to do your computation. Geofabrik is a good source of these files.
You need to place your OSM files into the isodist/osrm
directory (create one if it does not exist).
Then run the following command to generate .osrm
files:
$ npm run prepare
If this doesn't work for you, manually prepare the osrm file using contraction hierarchies or Multy-Level Dijkstra configuration.
Next, start a local osrm server and note which port it's running on.
Finally, you are good to go! If your server is running on port 5000, run the following to generate the isodistance:
$ OSRM_HOST=http://localhost:5001 npm run isodist < input.json
where input.json is described below
You can specify all the parameters in an input file that is piped into standard input:
/* input.json */
{
"origin": {
"type": "Point",
"coordinates": [ -86.893386, 40.417202 ]
},
"map": "indiana",
"steps": [{
"distance": 2
}, {
"distance": 5
}, {
"distance": 7
}]
}
$ npm run isodist < input.json
Please note that CLI arguments always override values specified in the input file.
$ npm run isodist -- --map il < input.json
# The above command will use `osrm/il.osrm`
Required.
Latitude of the origin point.
Required.
Longitude of the origin point.
Required.
Distance at which to compute isodistance polygons.
For example, to compute isodistance polygons at 1, 2, 5 and 10 miles, use
--step 1 --step 2 --step 5 --step 10
Required.
Name of the .osrm
file you wish to use for routing.
Optional, default: 0.2
Sampling resolution of the underlying point grid. Larger values will result in less precise results but much faster processing. Smaller values will produce more precise results, but will require exponentially more processing time and memory.
Having a very small resolution value may result in kinks (i.e. self-intersections) of isodistance polygons, which cause hex-fitting to fail. You can choose to ignore them by disabling hex-fitting, but note that presence of kinks usually indicates incorrect parameter choice.
Optional, default: 0.5
Size of hex grid cells that isodistances are fitted onto. Passing a 0 value will disable hex grid fitting.
Optional, default: none
This flag instructs isodist
not to remove isolated "islands" from isodistance geometries.