Osrm.pm

From OpenStreetMap Wiki
Jump to navigation Jump to search

A perl interface to the Open Source Routing Machine aimed to perform simple queries to the program and handle starting/stopping and making data.

Usage

The osrm.pm must be inside the same folder where the executables routed, extractLargeNetwork and createHierarchy are.

Changelog

v.0.1.1-Fix and improvement on the forking and killing steps

v.0.1 -Initial release

Functions

startserver($mainfile) - starts routed with the main .osrm file

killserver() - cause it must be shot to death when finishes its job (otherwise it will live in background, your choice)

route($startlat,$startlon,$endlat,$endlon) - calls osrm with start and end point, returns an array of coordinates

routeKML($startlat,$startlon,$endlat,$endlon) - calls osrm with start and end point, returns the KML

locate($lat,$lon) - find the nearest point to the one given in input via osrm

locateKML($lat,$lon) - find the nearest point to the one given in input via osrm, returns KML

preprocessosm($osmfile) - calls the programs to elaborate osm data for the server.

Download

osrm.pm