route
This commit is contained in:
0
points.csv
Normal file
0
points.csv
Normal file
|
|
63
postgis.sql
63
postgis.sql
@@ -1,7 +1,64 @@
|
||||
CREATE TABLE route (
|
||||
id int primary key,
|
||||
create table point (
|
||||
id serial primary key,
|
||||
nom text not null,
|
||||
geom geometry(point, 4326) not null
|
||||
);
|
||||
|
||||
create index idx_point_geom on point using gist (geom);
|
||||
|
||||
create table route (
|
||||
id serial primary key,
|
||||
source int,
|
||||
target int,
|
||||
cost double precision,
|
||||
reverse_cost double precision
|
||||
reverse_cost double precision,
|
||||
geom geometry(linestring, 4326) not null
|
||||
);
|
||||
|
||||
create index idx_route_geom on route using gist (geom);
|
||||
|
||||
|
||||
INSERT INTO point (nom, geom) VALUES
|
||||
('AA', ST_SetSRID(ST_MakePoint(-4.015716401134025, 48.74485278820124), 4326)),
|
||||
('AB', ST_SetSRID(ST_MakePoint(-4.015314069791999, 48.74487047504222), 4326)),
|
||||
('AC', ST_SetSRID(ST_MakePoint(-4.014884916360503, 48.744336329699905), 4326)),
|
||||
('AD', ST_SetSRID(ST_MakePoint(-4.0146327887195, 48.74421252036642), 4326)),
|
||||
('AE', ST_SetSRID(ST_MakePoint(-4.01295805886216, 48.744454737377325), 4326)),
|
||||
('AF', ST_SetSRID(ST_MakePoint(-4.013003500194497, 48.74529707579618), 4326)),
|
||||
('AG', ST_SetSRID(ST_MakePoint(-4.013866885508904, 48.745307063914076), 4326)),
|
||||
('AH', ST_SetSRID(ST_MakePoint(-4.015886500302756, 48.74435152496037), 4326)),
|
||||
('AI', ST_SetSRID(ST_MakePoint(-4.0169922393896265, 48.74407185159144), 4326)),
|
||||
('AJ', ST_SetSRID(ST_MakePoint(-4.016706525682735, 48.74357654268962), 4326)),
|
||||
('AK', ST_SetSRID(ST_MakePoint(-4.016130238694671, 48.74305994900348), 4326)),
|
||||
('AL', ST_SetSRID(ST_MakePoint(-4.01268322695224, 48.74633108784164), 4326)),
|
||||
('AM', ST_SetSRID(ST_MakePoint(-4.011502153774407, 48.74527636920614), 4326)),
|
||||
('AN', ST_SetSRID(ST_MakePoint(-4.011299684064602, 48.7474391861085), 4326)),
|
||||
('AO', ST_SetSRID(ST_MakePoint(-4.0092682382493825, 48.747176626882954), 4326)),
|
||||
('AP', ST_SetSRID(ST_MakePoint(-4.016986599170676, 48.74580116975868), 4326)),
|
||||
('AQ', ST_SetSRID(ST_MakePoint(-4.018177422002985, 48.74477062852221), 4326)),
|
||||
('AR', ST_SetSRID(ST_MakePoint(-4.017619213917883, 48.743923429030154), 4326)),
|
||||
('AS', ST_SetSRID(ST_MakePoint(-4.01778756237945, 48.74377735868944), 4326)),
|
||||
('AT', ST_SetSRID(ST_MakePoint(-4.018133119765466, 48.74377151586775), 4326)),
|
||||
('AU', ST_SetSRID(ST_MakePoint(-4.021500089167666, 48.74375398739865), 4326)),
|
||||
('AV', ST_SetSRID(ST_MakePoint(-4.017636934769236, 48.74298272869709), 4326)),
|
||||
('AW', ST_SetSRID(ST_MakePoint(-4.00982054515667, 48.74434880428204), 4326)),
|
||||
('AX', ST_SetSRID(ST_MakePoint(-4.009981334301317, 48.74419288113848), 4326)),
|
||||
('AY', ST_SetSRID(ST_MakePoint(-4.0070587566129525, 48.74134972191262), 4326)),
|
||||
('AZ', ST_SetSRID(ST_MakePoint(-4.006265083289092, 48.74170845222292), 4326)),
|
||||
('BA', ST_SetSRID(ST_MakePoint(-4.006068894377577, 48.74217891432291), 4326)),
|
||||
('BB', ST_SetSRID(ST_MakePoint(-4.006826896990252, 48.74318451229527), 4326)),
|
||||
('BC', ST_SetSRID(ST_MakePoint(-4.003418425059911, 48.74296605378058), 4326)),
|
||||
('BD', ST_SetSRID(ST_MakePoint(-4.003359497656666, 48.74446857837965), 4326)),
|
||||
('BE', ST_SetSRID(ST_MakePoint(-4.024275254166002, 48.74298397587782), 4326)),
|
||||
('BF', ST_SetSRID(ST_MakePoint(-4.019140945079908, 48.742638305027356), 4326)),
|
||||
('BG', ST_SetSRID(ST_MakePoint(-4.0182483929763535, 48.742208182126596), 4326));
|
||||
|
||||
INSERT INTO route (source, target, cost, reverse_cost, geom)
|
||||
SELECT
|
||||
a.id AS source,
|
||||
b.id AS target,
|
||||
ST_Distance(a.geom::geography, b.geom::geography) AS cost,
|
||||
ST_Distance(a.geom::geography, b.geom::geography) AS reverse_cost,
|
||||
ST_MakeLine(a.geom, b.geom) AS geom
|
||||
FROM point a
|
||||
JOIN point b ON a.nom = 'O' and b.nom='W';
|
||||
|
||||
50
route.csv
Normal file
50
route.csv
Normal file
@@ -0,0 +1,50 @@
|
||||
id,source,target,cost,reverse_cost,st_astext
|
||||
1,27,26,67.26420498,67.26420498,"LINESTRING(-4.014884916360503 48.744336329699905,-4.015314069791999 48.74487047504222)"
|
||||
2,27,32,73.68143218,73.68143218,"LINESTRING(-4.014884916360503 48.744336329699905,-4.015886500302756 48.74435152496037)"
|
||||
3,25,32,57.12939028,57.12939028,"LINESTRING(-4.015716401134025 48.74485278820124,-4.015886500302756 48.74435152496037)"
|
||||
4,25,26,29.65467886,29.65467886,"LINESTRING(-4.015716401134025 48.74485278820124,-4.015314069791999 48.74487047504222)"
|
||||
5,32,33,87.06668905,87.06668905,"LINESTRING(-4.015886500302756 48.74435152496037,-4.016992239389626 48.74407185159144)"
|
||||
6,34,33,58.95285583,58.95285583,"LINESTRING(-4.016706525682735 48.74357654268962,-4.016992239389626 48.74407185159144)"
|
||||
7,34,35,71.39087589,71.39087589,"LINESTRING(-4.016706525682735 48.74357654268962,-4.016130238694671 48.74305994900348)"
|
||||
8,28,35,168.98831087,168.98831087,"LINESTRING(-4.0146327887195 48.74421252036642,-4.016130238694671 48.74305994900348)"
|
||||
9,28,27,23.09549703,23.09549703,"LINESTRING(-4.0146327887195 48.74421252036642,-4.014884916360503 48.744336329699905)"
|
||||
10,33,42,48.97648654,48.97648654,"LINESTRING(-4.016992239389626 48.74407185159144,-4.017619213917883 48.743923429030154)"
|
||||
11,43,42,20.42443523,20.42443523,"LINESTRING(-4.01778756237945 48.74377735868944,-4.017619213917883 48.743923429030154)"
|
||||
12,43,46,89.05834993,89.05834993,"LINESTRING(-4.01778756237945 48.74377735868944,-4.017636934769236 48.74298272869709)"
|
||||
13,35,46,111.14594359,111.14594359,"LINESTRING(-4.016130238694671 48.74305994900348,-4.017636934769236 48.74298272869709)"
|
||||
14,35,28,168.98831087,168.98831087,"LINESTRING(-4.016130238694671 48.74305994900348,-4.0146327887195 48.74421252036642)"
|
||||
16,43,42,20.42443523,20.42443523,"LINESTRING(-4.01778756237945 48.74377735868944,-4.017619213917883 48.743923429030154)"
|
||||
17,43,44,25.42280345,25.42280345,"LINESTRING(-4.01778756237945 48.74377735868944,-4.018133119765466 48.74377151586775)"
|
||||
18,41,42,102.76881258,102.76881258,"LINESTRING(-4.018177422002985 48.74477062852221,-4.017619213917883 48.743923429030154)"
|
||||
19,41,45,269.25293462,269.25293462,"LINESTRING(-4.018177422002985 48.74477062852221,-4.021500089167666 48.74375398739865)"
|
||||
20,55,45,221.33949946,221.33949946,"LINESTRING(-4.024275254166002 48.74298397587782,-4.021500089167666 48.74375398739865)"
|
||||
21,55,56,379.56863139,379.56863139,"LINESTRING(-4.024275254166002 48.74298397587782,-4.019140945079908 48.742638305027356)"
|
||||
22,57,56,81.22337279,81.22337279,"LINESTRING(-4.018248392976354 48.742208182126596,-4.019140945079908 48.742638305027356)"
|
||||
24,46,57,97.16677596,97.16677596,"LINESTRING(-4.017636934769236 48.74298272869709,-4.018248392976354 48.742208182126596)"
|
||||
25,44,41,111.15386781,111.15386781,"LINESTRING(-4.018133119765466 48.74377151586775,-4.018177422002985 48.74477062852221)"
|
||||
27,26,31,116.98305546,116.98305546,"LINESTRING(-4.015314069791999 48.74487047504222,-4.013866885508904 48.745307063914076)"
|
||||
28,30,31,63.50666445,63.50666445,"LINESTRING(-4.013003500194497 48.74529707579618,-4.013866885508904 48.745307063914076)"
|
||||
29,30,29,93.73166629,93.73166629,"LINESTRING(-4.013003500194497 48.74529707579618,-4.01295805886216 48.744454737377325)"
|
||||
30,28,29,126.07984435,126.07984435,"LINESTRING(-4.0146327887195 48.74421252036642,-4.01295805886216 48.744454737377325)"
|
||||
31,31,36,143.33730711,143.33730711,"LINESTRING(-4.013866885508904 48.745307063914076,-4.01268322695224 48.74633108784164)"
|
||||
32,37,36,145.95062058,145.95062058,"LINESTRING(-4.011502153774407 48.74527636920614,-4.01268322695224 48.74633108784164)"
|
||||
33,37,47,161.04358744,161.04358744,"LINESTRING(-4.011502153774407 48.74527636920614,-4.00982054515667 48.74434880428204)"
|
||||
34,48,47,20.98793799,20.98793799,"LINESTRING(-4.009981334301317 48.74419288113848,-4.00982054515667 48.74434880428204)"
|
||||
35,48,29,220.85310861,220.85310861,"LINESTRING(-4.009981334301317 48.74419288113848,-4.01295805886216 48.744454737377325)"
|
||||
36,30,37,110.43930781,110.43930781,"LINESTRING(-4.013003500194497 48.74529707579618,-4.011502153774407 48.74527636920614)"
|
||||
37,48,52,257.67686913,257.67686913,"LINESTRING(-4.009981334301317 48.74419288113848,-4.006826896990252 48.74318451229527)"
|
||||
38,51,52,124.95340168,124.95340168,"LINESTRING(-4.006068894377577 48.74217891432291,-4.006826896990252 48.74318451229527)"
|
||||
39,51,50,54.27101843,54.27101843,"LINESTRING(-4.006068894377577 48.74217891432291,-4.006265083289092 48.74170845222292)"
|
||||
40,49,50,70.70349192,70.70349192,"LINESTRING(-4.007058756612952 48.74134972191262,-4.006265083289092 48.74170845222292)"
|
||||
41,49,48,382.31983999,382.31983999,"LINESTRING(-4.007058756612952 48.74134972191262,-4.009981334301317 48.74419288113848)"
|
||||
42,53,52,251.85867801,251.85867801,"LINESTRING(-4.003418425059911 48.74296605378058,-4.006826896990252 48.74318451229527)"
|
||||
43,53,54,167.14409871,167.14409871,"LINESTRING(-4.003418425059911 48.74296605378058,-4.003359497656666 48.74446857837965)"
|
||||
44,39,54,528.69922626,528.69922626,"LINESTRING(-4.009268238249382 48.747176626882954,-4.003359497656666 48.74446857837965)"
|
||||
45,39,38,152.22152229,152.22152229,"LINESTRING(-4.009268238249382 48.747176626882954,-4.011299684064602 48.7474391861085)"
|
||||
46,39,36,268.17010833,268.17010833,"LINESTRING(-4.009268238249382 48.747176626882954,-4.01268322695224 48.74633108784164)"
|
||||
47,39,47,317.07989642,317.07989642,"LINESTRING(-4.009268238249382 48.747176626882954,-4.00982054515667 48.74434880428204)"
|
||||
48,36,31,143.33730711,143.33730711,"LINESTRING(-4.01268322695224 48.74633108784164,-4.013866885508904 48.745307063914076)"
|
||||
49,36,38,159.80405456,159.80405456,"LINESTRING(-4.01268322695224 48.74633108784164,-4.011299684064602 48.7474391861085)"
|
||||
50,40,38,456.174987,456.174987,"LINESTRING(-4.016986599170676 48.74580116975868,-4.011299684064602 48.7474391861085)"
|
||||
51,40,41,144.23363877,144.23363877,"LINESTRING(-4.016986599170676 48.74580116975868,-4.018177422002985 48.74477062852221)"
|
||||
52,40,25,140.8873787,140.8873787,"LINESTRING(-4.016986599170676 48.74580116975868,-4.015716401134025 48.74485278820124)"
|
||||
|
Reference in New Issue
Block a user