Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boldtrn/graphhopper-postgis
Postgis reader for GraphHopper
https://github.com/boldtrn/graphhopper-postgis
gis graphhopper postgis postgres routing
Last synced: 4 months ago
JSON representation
Postgis reader for GraphHopper
- Host: GitHub
- URL: https://github.com/boldtrn/graphhopper-postgis
- Owner: boldtrn
- License: apache-2.0
- Created: 2019-06-25T08:14:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-17T14:41:29.000Z (about 4 years ago)
- Last Synced: 2024-01-29T21:35:54.206Z (about 1 year ago)
- Topics: gis, graphhopper, postgis, postgres, routing
- Language: Java
- Size: 41 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphHopper Postgis reader
This repository is based on the work by [mbasa](https://github.com/mbasa/graphhopper/tree/postgis) and by [PGWelch](https://github.com/graphhopper/graphhopper/pull/874).
Please note, this is a module for GraphHopper, you will need to combine it with [GraphHopper](https://github.com/graphhopper/graphhopper).
To get an idea of how to use it, have a look at the [OSMPostgisReaderTest](https://github.com/boldtrn/graphhopper-postgis/blob/master/src/main/test/java/com/graphhopper/reader/postgis/OSMPostgisReaderTest.java).
## Setup Postgres
Create a Table or View in the specifed database and schema that has these necessary columns (refer to OSM documentation for the proper values of these columns) :
```
osm_id, maxspeed, oneway, fclass, name, geom
```Furthermore you can add more attributes and refer them in the config key `db.tagsToCopy`. These tags will be copied to the ReaderWay that you can use in your FlagEncoder.
For example:
```
create view philview
(osm_id,maxspeed,oneway,fclass,name,geom )
as select id,0,oneway,'tertiary'::text,name,geom from phil;
```## Start GraphHopper
Please note, these instructions are only valid if you add this module to the main GraphHopper. I'd recommend to set it up along the lines of the [GraphHopper MapMatching Repository](https://github.com/graphhopper/map-matching).
Start the GraphHopper server by adding the parameter ``//``. The example below will create a graph, philview-gh, in /Users/mbasa/t for the philveiw view of PostgreSQL:
```
./graphhopper.sh web /Users/mbasa/t/philview
```## Updating the Graph
If the data in PostgreSQL changes and the graph has to be updated, just delete the created graph directory and restart GraphHopper using the above method.