Skip to content

Importing Data Challanges #2

Open
@dirklieske

Description

@dirklieske
  1. Imported Data Using osm2pgsql (Some memory issues but finally the following worked

export PGPASS=mysecretpassword
osm2pgsql
--host 172.17.0.2
--port 5432/tcp
--database postgres
--username postgres
--cache 14000
--slim
--drop
/mnt/xvdf/north-america-latest.osm

However, When I looked into using PGROUTING functions, it looks like I need to import data using:
osm2pgrouting
-f /mnt/xvdf/north-america-latest.osm
-c /usr/share/osm2pgrouting/mapconfig.xml
--clean 1
-d routing
-u postgres
-h 172.17.0.2
-p 5432/tcp
--passwd mysecretpassword

Problem: osm2pgrouting requires I run:

add PostGIS functions

psql -d routing -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
psql -d routing -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql

add pgRouting core functions

psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

I realize the files have moved

/usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql

I called docker run pointing to /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql
docker run -it --link some-pgrouting:postgres --rm postgres
sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres
-d routing -f /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql'

But I can't get docker to see the file.
I have tried copying the file into the docker image.
docker cp /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql some-pgrouting:/postgis.sql

docker run -it --link some-pgrouting:postgres --rm postgres
sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres
-d routing -f postgis.sql'

I have also logged into the docer image:
docker run -it --link some-pgrouting:postgres --rm postgres
sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d routing'

and attempted:
\i /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql
and
\i postgis.sql

to no avail. How can I see these files? Or is there an easier way to get pgrouting functions to work?

P.S. If there is a way I can pay you back like sending you some cash via Paypal, just send me your email.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions