I want to build my own map server using openstreetmap. Firstly, i downloaded one country's data from osm and impoted that data to postgresql database. And now I need to search places according given search string query (for example street name). To do that, I decided to use GraphHopper library. But I couldn't configure it with postgresql. Does anyone know how to configure GraphHopper with postgresql so that it uses postgresql as a datasource. I am building my project in spring boot. please, help me, I spent my lots of time to do it, but i didnt get any result. i appreciate any little support and help
I tried configure like that, but it didnt work:
@Configuration
public class GraphHopperConfiguration {
GraphHopper graphHopper = new GraphHopperOSM().forServer();
// Configure the PostgreSQL data source
CmdArgs args = new CmdArgs()
.put("graph.location", graphHopperDataDir)
.put("datareader.file", "")
.put("graphhopper.dataaccess", "PostgreSQL")
.put("graphhopper.dataaccess.host", "localhost")
.put("graphhopper.dataaccess.port", "5432")
.put("graphhopper.dataaccess.database", "your_database_name")
.put("graphhopper.dataaccess.user", dataSourceUsername)
.put("graphhopper.dataaccess.password", dataSourcePassword);
// Load the data from PostgreSQL
graphHopper.init(args);
graphHopper.importOrLoad();
return graphHopper;
}
}