Message posté par : jeremy SERIEYE
----------------------------------------
Bonjour à tous,
Je cherche à importer un flux WFS en BDD postgres.
J'arrive à ce que je souhaite la BD Topo cependant impossible avec le WFS du GPU (https://wxs-gpu.mongeoportail.ign.fr/externe/39wtxmgtn23okfbbs1al2lz3/wfs).
-----------------
Code :
DROP SERVER IF EXISTS fdw_ogr_ign_gpu CASCADE;
CREATE SERVER fdw_ogr_ign_gpu FOREIGN DATA WRAPPER ogr_fdw
OPTIONS (
datasource 'WFS:https://wxs-gpu.mongeoportail.ign.fr/externe/39wtxmgtn23okfbbs1al2lz3/wfs?service=WFS&request=GetCapabilities',
format 'WFS',
config_options 'GDAL_HTTP_UNSAFESSL=YES'
);
CREATE SCHEMA IF NOT EXISTS ign_gpu;
IMPORT FOREIGN SCHEMA ogr_all
FROM SERVER fdw_ogr_ign_gpu
INTO ign_gpu
OPTIONS (
-- mettre le nom des tables en minuscule et sans caractères bizares
launder_table_names 'true',
-- mettre le nom des champs en minuscule
launder_column_names 'true'
)
;
SELECT foreign_table_schema, foreign_table_name
FROM information_schema.foreign_tables
WHERE foreign_table_schema = 'ign_gpu'
ORDER BY foreign_table_schema, foreign_table_name;
SELECT *
FROM ign_gpu.wfs_du_doc_urba
LIMIT 1;
-----------------
Lors du dernier SELECT ci-dessus j'ai le code erreur suivant :
ERROR: GDAL AppDefined [1] HTTP error code : 403
ERREUR: GDAL AppDefined [1] HTTP error code : 403
État SQL : XX000
Si certains connaissent la solution, je suis preneur !
Merci par avance.
Jérémy
----------------------------------------
Le message est situé https://georezo.net/forum/viewtopic.php?pid=361981#p361981
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net
Message posté par : Pastore
----------------------------------------
Bonjour,
Je vous contacte pour savoir si il y a une manière rapide de passer de la version 3.4 de Postgis à la 3.1 sur Postgresql
Via PG Admin, j'ai mis à jour la version avec la commande ALTER EXTENSION postgis UPDATE TO 3.4 ;
Doit on passer par une désinstallation/réinstallation pour revenir à la version initiale ?
Merci beaucoup pour vos conseils !!
----------------------------------------
Le message est situé https://georezo.net/forum/viewtopic.php?pid=370008#p370008
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net
Message posté par : Christophe BADOL
----------------------------------------
Bonjour,
J'ai beaucoup de tables en Lambert 93 avec 9 chiffres après la virgule.
J'avais subodoré que réduire cette précision inutile ferait gagner de la place sur le disque, augmenterait un peu la vitesse d'affichage et réduirait le temps des géotraitements.
J'ai questionné chatGPT sur le sujet (qui n'a pas été très bon il faut le reconnaitre) : https://chatgpt.com/share/6714c630-6270-800a-83d0-658648c01dbe
Je vous livre mes comparaisons entre
- ST_ReducePrecision à 0.01
- ST_SnapToGrid à 0.01
- ST_QuantizeCoordinates à 0
---- Situation initiale (en Lambert93):
DROP TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023;
CREATE TABLE public.l_bati_agrege_pepci_006_2023
(LIKE p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023 INCLUDING ALL);
ALTER TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023
CLUSTER ON l_bati_agrege_pepci_006_2023_geom_idx;
INSERT INTO public.l_bati_agrege_pepci_006_2023
SELECT * FROM p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023;
--> Updated Rows 305707
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023'));
--> 100 MB
---- On vacuum
VACUUM FULL public.l_bati_agrege_pepci_006_2023;
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023'));
--> 97 MB
--- On réindexe
REINDEX TABLE public.l_bati_agrege_pepci_006_2023;
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023'));
--> 97 MB
---- Test 1 : ST_ReducePrecision à 0.01
DROP TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t1;
CREATE TABLE public.l_bati_agrege_pepci_006_2023_t1
(LIKE p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023 INCLUDING ALL);
ALTER TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t1
CLUSTER ON l_bati_agrege_pepci_006_2023_t1_geom_idx;
INSERT INTO public.l_bati_agrege_pepci_006_2023_t1
SELECT * FROM p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023;
--> Updated Rows 305707
UPDATE public.l_bati_agrege_pepci_006_2023_t1
SET geom= ST_ReducePrecision(geom, 0.01)
WHERE ST_IsValid(geom)
-- Vérifie que la simplification ne change pas le nombre de polygones ou de points
AND ST_GeometryType(geom) = ST_GeometryType(ST_ReducePrecision(geom, 0.01))
-- Vérifie que la simplification ne vide pas la géographie
AND ST_Area(ST_ReducePrecision(geom,0.01)) > 0;
--> Updated Rows 305699
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t1'));
--> 194 MB
---- On optimise
VACUUM FULL public.l_bati_agrege_pepci_006_2023_t1;
REINDEX TABLE public.l_bati_agrege_pepci_006_2023_t1;
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t1'));
--> 196 MB
---- Test 2 : ST_SnapToGrid à 0.01
DROP TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t2;
CREATE TABLE public.l_bati_agrege_pepci_006_2023_t2
(LIKE p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023 INCLUDING ALL);
ALTER TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t2
CLUSTER ON l_bati_agrege_pepci_006_2023_t2_geom_idx;
INSERT INTO public.l_bati_agrege_pepci_006_2023_t2
SELECT * FROM p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023;
--> Updated Rows 305707
UPDATE public.l_bati_agrege_pepci_006_2023_t2
SET geom= ST_SnapToGrid(geom, 0.01)
WHERE ST_IsValid(geom) AND ST_IsValid(ST_SnapToGrid(geom, 0.01))
-- Vérifie que la simplification ne change pas le nombre de polygones ou de points
AND ST_GeometryType(geom) = ST_GeometryType(ST_SnapToGrid(geom, 0.01))
-- Vérifie que la simplification ne vide pas la géographie
AND ST_Area(ST_SnapToGrid(geom, 0.01)) > 0;
--> Updated Rows 305311
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t2'));
--> 195 MB
---- On optimise
VACUUM FULL public.l_bati_agrege_pepci_006_2023_t2;
REINDEX TABLE public.l_bati_agrege_pepci_006_2023_t2;
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t2'));
--> 195 MB
--- Test 3 : ST_QuantizeCoordinates
DROP TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t3;
CREATE TABLE public.l_bati_agrege_pepci_006_2023_t3
(LIKE p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023 INCLUDING ALL);
ALTER TABLE IF EXISTS public.l_bati_agrege_pepci_006_2023_t3
CLUSTER ON l_bati_agrege_pepci_006_2023_t3_geom_idx;
INSERT INTO public.l_bati_agrege_pepci_006_2023_t3
SELECT * FROM p_enveloppe_bati_2023.l_bati_agrege_pepci_006_2023;
--> Updated Rows 305707
UPDATE public.l_bati_agrege_pepci_006_2023_t3
SET geom = ST_QuantizeCoordinates(geom, 0)
WHERE ST_IsValid(geom) AND ST_IsValid(ST_QuantizeCoordinates(geom, 0))
-- Vérifie que la simplification ne change pas le nombre de polygones ou de points
AND ST_GeometryType(geom) = ST_GeometryType(ST_QuantizeCoordinates(geom, 0))
-- Vérifie que la simplification ne vide pas la géographie
AND ST_Area(ST_QuantizeCoordinates(geom, 0)) > 0;
--> Updated Rows 300855
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t3'));
--> 191 MB
---- On optimise
VACUUM FULL public.l_bati_agrege_pepci_006_2023_t3;
REINDEX TABLE public.l_bati_agrege_pepci_006_2023_t3;
SELECT pg_size_pretty(pg_total_relation_size('public.l_bati_agrege_pepci_006_2023_t3'));
--> 192 MB
Si vous avez un semblant d'explication, je veux bien car je sèche un peu. Ne pas gagner de la place car la géométrie est stockée d'une même manière quelle que soit sa précision… je peux comprendre.
Mais doubler la taille initiale… j'étais loin de m'en douter.
d'avance merci à celles et ceux qui prendront le temps de me lire et de me répondre.
----------------------------------------
Le message est situé https://georezo.net/forum/viewtopic.php?pid=369900#p369900
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net
Message posté par : chillyelectronic (sectpromise(a)gmail.com)
----------------------------------------
-----------------
yaks48 écrit :
Bonjour,
J'ai importé des rasters dans ma base de données PostGIS via raster2pgsql
Lorsque je les affiche dans QGIS (via DB Manager) je n'arrive pas à afficher les min et max de l'étendue en question, alors que ça marche très bien avec mon raster "source" depuis l'explorateur. Mon but pour cet exemple est de faire des cartes topo avec une symbologie qui dépend du min/max de l'emprise.
geometry dash (https://geometrydashgame.org/)
exemple de ligne de commande pour l'import raster2pgsql :
-----------------
Code :
raster2pgsql.exe -s 2154 -I -C -M C:test_pgsqlBDALTI1.asc -F public.test8 | psql -U postgres -d qgis -h ADRESSE IP -p 5432
-----------------
avez-vous des solutions svp ?
j'ai testé avec différents types de fichiers initiaux avant import, rien ne change. et ça marche même lorsque j'exporte le raster depuis DB Manager dans mon explorateur.
Merci beaucoup !
-----------------
Recalculate Statistics: Use the PostGIS ST_SummaryStats() function to get the min/max values and confirm they exist.
Symbology Settings: In QGIS, manually set the symbology to reflect the correct min/max values.
Coordinate System: Ensure the raster has the correct SRID (2154 in your case).
----------------------------------------
Le message est situé https://georezo.net/forum/viewtopic.php?pid=369881#p369881
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net