itinero / routing

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

PostGIS RouterDB? #198

Closed jhidding closed 6 years ago

jhidding commented 6 years ago

Hi, Is it possible to hook up a running PostGIS server to Itinero in stead of loading data through shape or pbf files? Cheers, Johan

NguyenSen commented 6 years ago

You can use pgRouting support with PostGIS http://pgrouting.org. Or you export data to shapefile with sample http://docs.itinero.tech/docs/itinero/data-sources/shapefiles.html

jhidding commented 6 years ago

Converting to shapefile is exactly what I'm trying to avoid. To be more specific: I'm trying to use Itinero's OpenLR implementation.

xivk commented 6 years ago

No, it's not possible at the moment.

You could try reading the data directly from the database. There used to be a stream source for PG from OSM data but it's unmaintained at the moment and hasn't been updated in a while (meaning it won't work anymore out-of-the-box with the latest OsmSharp version):

https://github.com/OsmSharp/data-providers/blob/master/OsmSharp.Data.PostgreSQL/Osm/PostgreSQLDataSource.cs

That would at least bypass shapefiles, that's a win, but in the end this comes down to the same thing because creating a routerdb is always needed, and it streams over all the data.

You could also create a version of this:

https://github.com/itinero/geo/blob/master/src/Itinero.IO.Shape/Reader/ShapeFileReader.cs

To read directly from PG, perhaps it's a good idea to create an NTS IO project that just uses NTS linestrings as it's source, that would support any source NTS supports.

If you are always decoding/encoding OpenLR strings in the same area or you don't care about performance that much you could write something that filters a bounding box around the area and creates routerdb's on the fly.

The roadmap for Itinero's next version is to make the data management in the routerdb's easier by using a tiled scheme, that could work in this scenario by syncing it with the database.

It was a deliberate choice at some point to move away from any database dependency because it's usually too slow for high volume fast routing.

We also do consulting on projects, if you need direct help from us that's also possible.

xivk commented 6 years ago

Closing this, feel free to reopen if there are more questions.