routing : id column
pour rester plus près du modèle standard attendu par pgrouting
This commit is contained in:
parent
fd92b18934
commit
e369c275a9
|
@ -29,10 +29,11 @@
|
||||||
|
|
||||||
-- 2. création de la table qui va accueillir les tronçons de routes
|
-- 2. création de la table qui va accueillir les tronçons de routes
|
||||||
|
|
||||||
-- table osm_roads
|
-- la table qui contient le graphe routier de OSM
|
||||||
DROP TABLE IF EXISTS osm_roads ;
|
DROP TABLE IF EXISTS osm_roads ;
|
||||||
CREATE TABLE osm_roads
|
CREATE TABLE osm_roads
|
||||||
(
|
(
|
||||||
|
uid bigint,
|
||||||
osm_id bigint,
|
osm_id bigint,
|
||||||
highway text,
|
highway text,
|
||||||
type text,
|
type text,
|
||||||
|
@ -41,7 +42,7 @@ CREATE TABLE osm_roads
|
||||||
name_fr text,
|
name_fr text,
|
||||||
name_br text,
|
name_br text,
|
||||||
the_geom geometry,
|
the_geom geometry,
|
||||||
CONSTRAINT osm_roads_pkey PRIMARY KEY (osm_id),
|
CONSTRAINT osm_roads_pkey PRIMARY KEY (uid),
|
||||||
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text),
|
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text),
|
||||||
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
|
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
|
||||||
);
|
);
|
||||||
|
@ -64,6 +65,7 @@ WITH trace_buffer AS (
|
||||||
INSERT INTO osm_roads
|
INSERT INTO osm_roads
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
|
row_number() over() as id,
|
||||||
osm_id,
|
osm_id,
|
||||||
highway,
|
highway,
|
||||||
CASE
|
CASE
|
||||||
|
|
|
@ -171,6 +171,7 @@ CREATE VIEW phase_1_tdb AS
|
||||||
DROP TABLE IF EXISTS osm_roads ;
|
DROP TABLE IF EXISTS osm_roads ;
|
||||||
CREATE TABLE osm_roads
|
CREATE TABLE osm_roads
|
||||||
(
|
(
|
||||||
|
id bigint,
|
||||||
osm_id bigint,
|
osm_id bigint,
|
||||||
highway text,
|
highway text,
|
||||||
type text,
|
type text,
|
||||||
|
@ -179,7 +180,7 @@ CREATE TABLE osm_roads
|
||||||
name_fr text,
|
name_fr text,
|
||||||
name_br text,
|
name_br text,
|
||||||
the_geom geometry,
|
the_geom geometry,
|
||||||
CONSTRAINT osm_roads_pkey PRIMARY KEY (osm_id),
|
CONSTRAINT osm_roads_pkey PRIMARY KEY (id),
|
||||||
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text),
|
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR geometrytype(the_geom) = 'MULTILINESTRING'::text),
|
||||||
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
|
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,6 +18,6 @@ ALTER TABLE osm_roads ADD COLUMN source integer ;
|
||||||
ALTER TABLE osm_roads ADD COLUMN target integer ;
|
ALTER TABLE osm_roads ADD COLUMN target integer ;
|
||||||
|
|
||||||
-- calcul de la topologie
|
-- calcul de la topologie
|
||||||
SELECT pgr_createTopology('osm_roads', 0.000001, 'the_geom', 'osm_id');
|
SELECT pgr_createTopology('osm_roads', 0.000001);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue