This commit is contained in:
2025-10-23 08:45:54 +02:00
parent c001935b93
commit 15abe1f1a7
5 changed files with 67 additions and 58 deletions

View File

@@ -5,6 +5,8 @@ PG_PASSWORD=!ChangeMe!
PGADMIN_EMAIL=user@email.org
PGADMIN_PASSWORD=!ChangeMe!
POSTGREST_PASSWORD=!ChangeMe!
# CouchDB
COUCHDB_USER=admin
COUCHDB_PASSWORD=!ChangeMe!

View File

@@ -134,40 +134,6 @@ services:
networks:
- caddy_net
# MongoDB
#
# https://www.mongodb.com/
mongodb:
image: mongodb/mongodb-community-server:8.0-ubi8
volumes:
- mongodb_configdb:/data/configdb
- mongodb_data:/data/db
- ./mongodb-entrypoint-initdb.d:/docker-entrypoint-initdb.d:Z
- ./data:/initdb.d:z
ports:
- "27017:27017"
networks:
- caddy_net
environment:
MONGODB_INITDB_ROOT_USERNAME: ${MONGODB_USER}
MONGODB_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
mongo-express:
image: mongo-express
restart: "no"
depends_on:
- mongodb
environment:
ME_CONFIG_MONGODB_URL: mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@mongodb:27017/
ME_CONFIG_BASICAUTH_ENABLED: true
ME_CONFIG_BASICAUTH_USERNAME: mongoexpressuser
ME_CONFIG_BASICAUTH_PASSWORD: mongoexpresspass
networks:
- caddy_net
labels:
caddy: mongo-express.localhost
caddy.reverse_proxy: "{{upstreams 8081}}"
caddy.tls: internal
# Redis
# In-memory key-value database
@@ -195,28 +161,6 @@ services:
# Graphes
#
# ----------------------------------------------------------------------
# Neo4J
# Des graphes ultra-rapides, à léchelle du pétaoctet
# https://neo4j.com/
neo4j:
image: neo4j:5.26.12-community
ports:
- 7474:7474
- 7687:7687 # bolt protocol
volumes:
- neo4j_data:/data
- neo4j_logs:/logs
- ./data/mesamis:/tmp:ro
environment:
NEO4J_server.https.enabled: "false"
NEO4J_AUTH: neo4j/${NEO4J_PASSWORD:-!ChangeMe!}
networks:
- caddy_net
labels:
caddy: neo4j.localhost
caddy.reverse_proxy: "{{upstreams 7474}}"
caddy.tls: internal
# PostGraphile
# Instant GraphQL API
# https://www.graphile.org/postgraphile/

View File

@@ -5,4 +5,4 @@ id,nom,categorie,st_astext
4,F1,pinède,"MULTIPOLYGON(((-4.03227466629164955 48.74788694383109089, -4.03030061387978833 48.74773380972345649, -4.03034706217183292 48.74837696983955482, -4.02886071682643188 48.74879042556728592, -4.0283730097599717 48.74830040359072569, -4.026097043449826 48.74785631704688882, -4.02310112861300073 48.74894355645498223, -4.02207926618803757 48.74905074779869096, -4.02054647255059283 48.74799413742875487, -4.02096450717898524 48.74702938681775066, -4.02196314545792877 48.74730503173945095, -4.02240440423234435 48.74696813218538693, -4.02103417961705301 48.74660060282317176, -4.02168445570566568 48.7459880479128671, -4.02045357596650454 48.74566645359599448, -4.0192459203733657 48.74634026789862418, -4.02031423109037256 48.7472897181723539, -4.01908335135121231 48.74785631704688882, -4.01792214405011805 48.74817789734992601, -4.01866531672281901 48.74883636488258531, -4.01806148892624826 48.74918856490463526, -4.01676093674902202 48.74940294631811355, -4.0168538333331103 48.75006139779778636, -4.01861886843077443 48.74964795252782324, -4.01982652402391327 48.7501379613633361, -4.0190369030591695 48.7505054648540721, -4.01931559281143169 48.75085765317707853, -4.01838662697055593 48.75094952798578873, -4.01896723062110173 48.75188357900499625, -4.01917624793529882 48.75316978477636098, -4.01998263811893342 48.75414056228478898, -4.02347000274359434 48.75343311429260496, -4.02411382390507022 48.75194744108336664, -4.02518685917419639 48.75060322270570623, -4.02717197442208086 48.75049709867055725, -4.03001551788526591 48.74957734764354456, -4.0326981060580831 48.74940047051592273, -4.03227466629164955 48.74788694383109089)))"
5,F2,pinède,"MULTIPOLYGON(((-4.03210658230851937 48.7473250537116769, -4.03194134042057417 48.74661682596349976, -4.03180914691021819 48.7465405546875914, -4.03142909056794263 48.74669309712365362, -4.03114817935843561 48.7466386177353499, -4.03109860679205134 48.74642069959156743, -4.03085074396013265 48.74640980365956011, -4.03068550207218657 48.74591948427462995, -4.03096641328169358 48.74573425126195758, -4.03085074396013265 48.74553812144555565, -4.03154475988950445 48.74547274467001046, -4.03132994543517498 48.74501510485968225, -4.03240401770682144 48.74453566820766071, -4.03180914691021819 48.74392546949013649, -4.03058635693941891 48.74351140185528664, -4.02921484926947038 48.74351140185528664, -4.02800858348746793 48.74358767772856282, -4.0269675595934098 48.74363126388988832, -4.02701713215979318 48.74392546949013649, -4.02671969676149111 48.74409981273684878, -4.02589348732176333 48.74358767772856282, -4.02505075369323961 48.74322264214351463, -4.02452197965181391 48.74351685013579072, -4.02389406047761966 48.74301560585730186, -4.02376186696726279 48.74259063396623759, -4.02321656873704292 48.74262332423928257, -4.02257212537405362 48.7424271822820927, -4.02257212537405362 48.7421983490312769, -4.02354705251293421 48.7421983490312769, -4.02326614130342541 48.741620812860603, -4.02222511740936906 48.74140287295836771, -4.02146500472481971 48.74110865259134329, -4.02030128530242603 48.74082614655209511, -4.02004331067146126 48.74041391757678809, -4.02149193744534461 48.73880422920323241, -4.02372441021331362 48.73884349050857168, -4.02582789566580157 48.73975957892771049, -4.02677049527894404 48.74168985344235949, -4.0312552850172656 48.7416522301559354, -4.03350264093702293 48.74208080679530752, -4.03388960288346965 48.74075580613283876, -4.03651895969907937 48.74138395894945575, -4.03948566795518005 48.74345484466264367, -4.04118234725883774 48.74486810156530225, -4.04108808729752322 48.74677528109287294, -4.03862276029329426 48.74754509383514289, -4.03625857063008908 48.74835956593549469, -4.03376156132288433 48.74751006248096274, -4.03251305666928062 48.74755385166987054, -4.03251305666928062 48.74755385166987054, -4.03210658230851937 48.7473250537116769)))"
6,F3,pinède,"MULTIPOLYGON(((-4.00452154451539055 48.74889092100416832, -4.00473574711515479 48.74846720910248621, -4.00455449876150738 48.7484128868054114, -4.0044721131462131 48.7476958269804399, -4.00491699546880042 48.74752199275464193, -4.00503233533021241 48.74697875692320537, -4.00356587137798137 48.74669627197003763, -4.0027090609789262 48.74689183864520459, -4.00234656427163316 48.74650070453378703, -4.00228065577939773 48.74589226764273775, -4.0028244008403373 48.74559891150961732, -4.00261019824057307 48.74533814906479279, -4.00200054468739896 48.74546853045634265, -4.00170395647234134 48.74490354198335496, -4.00259372111751421 48.74477315912601938, -4.00197582900281024 48.74415926862705817, -4.00037754806610923 48.74353993787026695, -4.0005423192966969 48.74289886817128092, -3.99989971149740509 48.74276848011316332, -3.99980084875905373 48.74325743358691199, -3.99909233246752649 48.74310531523816792, -3.9987463128832923 48.74329003031605367, -3.99665371825482874 48.74287713685176016, -3.99619235880918433 48.74343128256459323, -3.99484123471836483 48.74395282588946543, -3.99377022171954499 48.74424619163128369, -3.99278159433601854 48.74435484517517381, -3.99194126106002178 48.74437657585575323, -3.99151285586049376 48.74412667246169661, -3.98892594754026764 48.74526752566981003, -3.99149637873743535 48.74614759473511327, -3.9953520255331858 48.74541963747414997, -3.99905937822140922 48.7463214337152877, -4.00430734191562632 48.7491842579200636, -4.00452154451539055 48.74889092100416832)))"
7,F4,pinède,"MULTIPOLYGON(((-3.9916658575605819 48.74369092514352531, -3.99182642319198955 48.74367846848674901, -3.99200587889767888 48.74326116870086167, -3.99240257045762625 48.74303071808030552, -3.9926009162375995 48.74248884353885813, -3.99318650854037704 48.74179747788332406, -3.99397989166027134 48.74188467767927335, -3.99423490766309497 48.74168536363765014, -3.99512274115440258 48.74159816349589391, -3.99539664723150922 48.74136147663424623, -3.99418768247738631 48.74061403712226337, -3.99436028742326377 48.73854759095410571, -3.99408923646676906 48.73649184291740966, -3.98956268549331572 48.73697450435624035, -3.98850558676298794 48.73924473859000983, -3.98910189886727506 48.74137187289826301, -3.99083662498883784 48.74214047912115433, -3.9916658575605819 48.74369092514352531))"
7,F4,pinède,"MULTIPOLYGON(((-3.9916658575605819 48.74369092514352531, -3.99182642319198955 48.74367846848674901, -3.99200587889767888 48.74326116870086167, -3.99240257045762625 48.74303071808030552, -3.9926009162375995 48.74248884353885813, -3.99318650854037704 48.74179747788332406, -3.99397989166027134 48.74188467767927335, -3.99423490766309497 48.74168536363765014, -3.99512274115440258 48.74159816349589391, -3.99539664723150922 48.74136147663424623, -3.99418768247738631 48.74061403712226337, -3.99436028742326377 48.73854759095410571, -3.99408923646676906 48.73649184291740966, -3.98956268549331572 48.73697450435624035, -3.98850558676298794 48.73924473859000983, -3.98910189886727506 48.74137187289826301, -3.99083662498883784 48.74214047912115433, -3.9916658575605819 48.74369092514352531)))"
1 id nom categorie st_astext
5 4 F1 pinède MULTIPOLYGON(((-4.03227466629164955 48.74788694383109089, -4.03030061387978833 48.74773380972345649, -4.03034706217183292 48.74837696983955482, -4.02886071682643188 48.74879042556728592, -4.0283730097599717 48.74830040359072569, -4.026097043449826 48.74785631704688882, -4.02310112861300073 48.74894355645498223, -4.02207926618803757 48.74905074779869096, -4.02054647255059283 48.74799413742875487, -4.02096450717898524 48.74702938681775066, -4.02196314545792877 48.74730503173945095, -4.02240440423234435 48.74696813218538693, -4.02103417961705301 48.74660060282317176, -4.02168445570566568 48.7459880479128671, -4.02045357596650454 48.74566645359599448, -4.0192459203733657 48.74634026789862418, -4.02031423109037256 48.7472897181723539, -4.01908335135121231 48.74785631704688882, -4.01792214405011805 48.74817789734992601, -4.01866531672281901 48.74883636488258531, -4.01806148892624826 48.74918856490463526, -4.01676093674902202 48.74940294631811355, -4.0168538333331103 48.75006139779778636, -4.01861886843077443 48.74964795252782324, -4.01982652402391327 48.7501379613633361, -4.0190369030591695 48.7505054648540721, -4.01931559281143169 48.75085765317707853, -4.01838662697055593 48.75094952798578873, -4.01896723062110173 48.75188357900499625, -4.01917624793529882 48.75316978477636098, -4.01998263811893342 48.75414056228478898, -4.02347000274359434 48.75343311429260496, -4.02411382390507022 48.75194744108336664, -4.02518685917419639 48.75060322270570623, -4.02717197442208086 48.75049709867055725, -4.03001551788526591 48.74957734764354456, -4.0326981060580831 48.74940047051592273, -4.03227466629164955 48.74788694383109089)))
6 5 F2 pinède MULTIPOLYGON(((-4.03210658230851937 48.7473250537116769, -4.03194134042057417 48.74661682596349976, -4.03180914691021819 48.7465405546875914, -4.03142909056794263 48.74669309712365362, -4.03114817935843561 48.7466386177353499, -4.03109860679205134 48.74642069959156743, -4.03085074396013265 48.74640980365956011, -4.03068550207218657 48.74591948427462995, -4.03096641328169358 48.74573425126195758, -4.03085074396013265 48.74553812144555565, -4.03154475988950445 48.74547274467001046, -4.03132994543517498 48.74501510485968225, -4.03240401770682144 48.74453566820766071, -4.03180914691021819 48.74392546949013649, -4.03058635693941891 48.74351140185528664, -4.02921484926947038 48.74351140185528664, -4.02800858348746793 48.74358767772856282, -4.0269675595934098 48.74363126388988832, -4.02701713215979318 48.74392546949013649, -4.02671969676149111 48.74409981273684878, -4.02589348732176333 48.74358767772856282, -4.02505075369323961 48.74322264214351463, -4.02452197965181391 48.74351685013579072, -4.02389406047761966 48.74301560585730186, -4.02376186696726279 48.74259063396623759, -4.02321656873704292 48.74262332423928257, -4.02257212537405362 48.7424271822820927, -4.02257212537405362 48.7421983490312769, -4.02354705251293421 48.7421983490312769, -4.02326614130342541 48.741620812860603, -4.02222511740936906 48.74140287295836771, -4.02146500472481971 48.74110865259134329, -4.02030128530242603 48.74082614655209511, -4.02004331067146126 48.74041391757678809, -4.02149193744534461 48.73880422920323241, -4.02372441021331362 48.73884349050857168, -4.02582789566580157 48.73975957892771049, -4.02677049527894404 48.74168985344235949, -4.0312552850172656 48.7416522301559354, -4.03350264093702293 48.74208080679530752, -4.03388960288346965 48.74075580613283876, -4.03651895969907937 48.74138395894945575, -4.03948566795518005 48.74345484466264367, -4.04118234725883774 48.74486810156530225, -4.04108808729752322 48.74677528109287294, -4.03862276029329426 48.74754509383514289, -4.03625857063008908 48.74835956593549469, -4.03376156132288433 48.74751006248096274, -4.03251305666928062 48.74755385166987054, -4.03251305666928062 48.74755385166987054, -4.03210658230851937 48.7473250537116769)))
7 6 F3 pinède MULTIPOLYGON(((-4.00452154451539055 48.74889092100416832, -4.00473574711515479 48.74846720910248621, -4.00455449876150738 48.7484128868054114, -4.0044721131462131 48.7476958269804399, -4.00491699546880042 48.74752199275464193, -4.00503233533021241 48.74697875692320537, -4.00356587137798137 48.74669627197003763, -4.0027090609789262 48.74689183864520459, -4.00234656427163316 48.74650070453378703, -4.00228065577939773 48.74589226764273775, -4.0028244008403373 48.74559891150961732, -4.00261019824057307 48.74533814906479279, -4.00200054468739896 48.74546853045634265, -4.00170395647234134 48.74490354198335496, -4.00259372111751421 48.74477315912601938, -4.00197582900281024 48.74415926862705817, -4.00037754806610923 48.74353993787026695, -4.0005423192966969 48.74289886817128092, -3.99989971149740509 48.74276848011316332, -3.99980084875905373 48.74325743358691199, -3.99909233246752649 48.74310531523816792, -3.9987463128832923 48.74329003031605367, -3.99665371825482874 48.74287713685176016, -3.99619235880918433 48.74343128256459323, -3.99484123471836483 48.74395282588946543, -3.99377022171954499 48.74424619163128369, -3.99278159433601854 48.74435484517517381, -3.99194126106002178 48.74437657585575323, -3.99151285586049376 48.74412667246169661, -3.98892594754026764 48.74526752566981003, -3.99149637873743535 48.74614759473511327, -3.9953520255331858 48.74541963747414997, -3.99905937822140922 48.7463214337152877, -4.00430734191562632 48.7491842579200636, -4.00452154451539055 48.74889092100416832)))
8 7 F4 pinède MULTIPOLYGON(((-3.9916658575605819 48.74369092514352531, -3.99182642319198955 48.74367846848674901, -3.99200587889767888 48.74326116870086167, -3.99240257045762625 48.74303071808030552, -3.9926009162375995 48.74248884353885813, -3.99318650854037704 48.74179747788332406, -3.99397989166027134 48.74188467767927335, -3.99423490766309497 48.74168536363765014, -3.99512274115440258 48.74159816349589391, -3.99539664723150922 48.74136147663424623, -3.99418768247738631 48.74061403712226337, -3.99436028742326377 48.73854759095410571, -3.99408923646676906 48.73649184291740966, -3.98956268549331572 48.73697450435624035, -3.98850558676298794 48.73924473859000983, -3.98910189886727506 48.74137187289826301, -3.99083662498883784 48.74214047912115433, -3.9916658575605819 48.74369092514352531)) MULTIPOLYGON(((-3.9916658575605819 48.74369092514352531, -3.99182642319198955 48.74367846848674901, -3.99200587889767888 48.74326116870086167, -3.99240257045762625 48.74303071808030552, -3.9926009162375995 48.74248884353885813, -3.99318650854037704 48.74179747788332406, -3.99397989166027134 48.74188467767927335, -3.99423490766309497 48.74168536363765014, -3.99512274115440258 48.74159816349589391, -3.99539664723150922 48.74136147663424623, -3.99418768247738631 48.74061403712226337, -3.99436028742326377 48.73854759095410571, -3.99408923646676906 48.73649184291740966, -3.98956268549331572 48.73697450435624035, -3.98850558676298794 48.73924473859000983, -3.98910189886727506 48.74137187289826301, -3.99083662498883784 48.74214047912115433, -3.9916658575605819 48.74369092514352531)))

View File

@@ -1,8 +1,12 @@
create table item (
id integer primary key,
id bigint primary key,
data jsonb
);
CREATE INDEX idx_item_data
ON item USING gin (data jsonb_path_ops);
DO $$
DECLARE
f TEXT;

View File

@@ -0,0 +1,59 @@
set SEARCH_PATH to public,postgis;
create table point (
id serial primary key,
nom text not null,
altitude double precision,
geom postgis.geometry(point, 4326) not null
);
create index idx_point_geom
on point using gist (geom);
create table route (
id serial primary key,
depart int,
arrivee int,
geom postgis.geometry(linestring, 4326) not null,
longueur double precision
);
create index idx_route_geom
on route using gist (geom);
create or replace function maj_longueur()
returns trigger as $$
begin
new.longueur := postgis.st_length(new.geom) * 1000;
return new;
end;
$$ language plpgsql;
create trigger trigger_longueur
before insert or update on route
for each row
execute function maj_longueur();
-- ************************************************************
create table route_cout (
route_id int references route(id),
tag text,
cout float,
cout_inverse float,
primary key (route_id, tag)
);
create table zone (
id int primary key,
nom text,
categorie text,
geom postgis.geometry(multipolygon, 4326) -- on choisit srid 4326 (wgs84)
);
-- ************************************************************
\COPY point FROM '/tmp/point.csv' (FORMAT CSV, header, ENCODING 'UTF8');
\COPY route(id, depart, arrivee, geom) FROM '/tmp/route.csv' (FORMAT CSV, header, ENCODING 'UTF8');
\COPY route_cout FROM '/tmp/route_cout.csv' (FORMAT CSV, header, ENCODING 'UTF8');
\COPY zone FROM '/tmp/zone.csv' (FORMAT CSV, header, ENCODING 'UTF8');