itinero / routing

The routing core of itinero.
Apache License 2.0
221 stars 69 forks source link

Custom routerdb #222

Closed Sonnenspeer closed 6 years ago

Sonnenspeer commented 6 years ago

Hi.

I wanted to know if there is a way to create a custom routerdb from external sources (manual entered nodes and edges). I wanted to use this for an indoor application.

I would map the nodes and edges and all the stuff that is needed and Itinero could calculate the route with this data. If it could be done, how could it be done?

xivk commented 6 years ago

Yes, this can be done, you can check for example the unittests:

https://github.com/itinero/routing/blob/develop/test/Itinero.Test/TestNetworkBuilder.cs#L52

This converts a geojson like this one:

https://github.com/itinero/routing/blob/develop/test/Itinero.Test/test-data/networks/network9.geojson

... into a routable network. Once this is loaded you need to sort the vertices before you can search & resolve:

https://github.com/itinero/routing/blob/develop/test/Itinero.Test/RouterTests.cs#L761

You can also check the code used for loading OSM data or shapefiles.

Sonnenspeer commented 6 years ago

Thanks. This helps me a lot.

xivk commented 6 years ago

Thanks for closing! :+1: