Giter Site home page Giter Site logo

geocoder's Introduction

installing Postgres and its extesntions

postgres comes by default with Ubuntu. pg_routing needs postgis:

sudo apt install postgis postgresql-14-postgis-3
sudo apt install postgresql-14-pgrouting

To use postgres we login as user postgres

sudo -i -u postgres

We now can use commands to create databases, users ..etc:

createuser routingTest
createdb routing_db -O routingTest

To run sql commands with postgres we must start the psql app.

example workflow, we connect to postgress and drop an existing DB:

sudo -i -u postgres
psql
\l
DROP DATABASE postgis_db;
\l

setting up a database for our project

creating a db

createuser geocoder
createdb routing_db -O geocoder

configuring the db

after creating a db we connect to it /connect db_name and install the extensions needed:

CREATE EXTENSION postgis;
CREATE EXTENSION pgRouting;

we copy the data to the db using

osm2pgrouting -d routing_db -U postgres -h localhost -p <postgress port number> -W your_password -f map1.osm -c “.\mapconfig.xml” — clean

to get the port number of postgres we use pg_lsclusters

osm2pgrouting -d routing_db -U postgres -h localhost -p 5433 -W postgres -f "/mnt/92804264-c37f-48cb-8ec5-49bc5be832fa/hasan/playground/bunyan/personal_projects/geocoder/assets/map.osm" -c "/mnt/92804264-c37f-48cb-8ec5-49bc5be832fa/hasan/playground/bunyan/personal_projects/geocoder/mapconfig.xml" — clean

docker

docker run --rm -d --network host --name geocoderr -e PORT=3000
-e PGUSER=postgres
-e PGHOST=127.0.0.1
-e PGPASSWORD=postgres
-e PGDATABASE=osm_ele
-e PGPORT=5433 hasanaga/geocoder

geocoder's People

Contributors

hasan-aga avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.