#1 Tue 30 January 2018 18:14
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
mapserver>postgis en wfs ?
Bonjour,
j'ai un mapfile entre mapserver et postgis/postgrsql qui fonctionne bien en wms
le voici
Code:
#ce mapfile est un copier/coller de fond_mapserver.map adapté
#pour fonctionner avec openlayers3 c'est à dire sans les accents
#dans les noms des layers, sinon ca passe pas.
MAP
NAME "Mapserver-Inrap"
FONTSET "./fonts/fonts.txt"
OUTPUTFORMAT
NAME "png"
DRIVER "AGG/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
END #fin format
EXTENT 93501.1 6044342.00 1248133.25 7115784.50 #xmin ymin xmax ymax
UNITS METERS
DEBUG 5
CONFIG "CPL_DEBUG" "ON"
CONFIG "PROJ_DEBUG" "ON"
CONFIG MS_ERRORFILE "C:/ms4w/errorMapFile.txt"
SYMBOLSET "C:\ms4w\map\symbols\symbols.sym"
PROJECTION # proj de sortie
"init=epsg:2154"
END
WEB
METADATA
"wms_title" "WMS-Inrap, outil d'aide au montage des opérations"
"wms_onlineresource" "http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_ol3.map&"
"wms_enable_request" "*" #active les getcapabilities, getmap
"wms_srs" "EPSG:2154 EPSG:3857 EPSG:900913"
"wms_encoding" "UTF-8"
#les deux lignes suivantes ne sont pas obligées pour afficher donn‚es attributaires...dans QIGS du moins ;
#mais template même factice oblig‚ dans les layers … interroger. ET header et footer aussi pour text/html
#cf. http://mapserver.org/fr/ogc/wms_server.html#wms-server
#"wms_getfeatureinfo_formatlist" "application/vnd.ogc.gml,text/html" #pour afficher attributs getfeatureinfo
#"wms_feature_info_mime_type" "gml" #pour afficher attributs getfeatureinfo du layer emprise
END #fin metadata
#attention : onlineresource doit etre identique au debut de l'URL du navigateur (= pas oublier le MAP)
#et le fichier mentionné DOIT EXISTER SINON PROBLEME LEGENDE SOUS QGIS !!
END #end web
#----- permet une legende avec encodage correct donc accents. Obsolète avec mapserver 7
LEGEND
LABEL
FONT "Arial"
TYPE TRUETYPE
SIZE 8
ENCODING "UTF-8"
END # fin label
END #fin legend
#-----debut layer interrégions
LAYER
NAME "Interregions"
TYPE POLYGON
OPACITY 30
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, nom_com, code_dept from activite.communes) as plop using unique gid srid = 2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
PROJECTION
"init=epsg:2154"
END #fin projection
LABELITEM "nom_com"
CLASSITEM "code_dept"
LABELMAXSCALEDENOM 450000
LABELMINSCALEDENOM 70000
CLASS #-----debut class CIF
NAME "Centre Ile-de-France" #apparait en legende
EXPRESSION /18|28|36|37|41|45|75|77|78|91|92|93|94|95/
STYLE
COLOR 255 240 140
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE CIF
STYLE
COLOR 255 240 140
OUTLINECOLOR 255 240 140
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE CIF
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 255 240 140
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 5
TYPE TRUETYPE
END #ENd label
END # end class CIF
CLASS #-----debut RAA
NAME "Rhône-Alpes Auvergne" #apparait en legende
EXPRESSION /01|03|07|15|26|38|42|43|63|69|73|74/
STYLE
COLOR 0 200 100
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE RAA
STYLE
COLOR 0 200 100
OUTLINECOLOR 0 220 100
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE RAA
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 0 200 100
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class RAA
CLASS #-----debut GEN
NAME "Grand Est Nord" #apparait en legende
EXPRESSION /08|10|51|52|54|55|57|88/
STYLE
COLOR 160 50 0
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE GEN
STYLE
COLOR 160 50 0
OUTLINECOLOR 180 50 0
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE GEN
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 160 50 0
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class GEN
CLASS #-----debut GES
NAME "Grand Est Sud" #apparait en legende
EXPRESSION /21|25|39|58|67|68|70|71|89|90/
STYLE
COLOR 180 220 150
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE GES
STYLE
COLOR 180 220 150
OUTLINECOLOR 180 220 150
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE GES
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 180 220 150
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class GES
CLASS #-----debut Med
NAME "Méditerranée" #apparait en legende
EXPRESSION /2A|2B|04|05|06|11|13|30|34|48|66|83|84/
STYLE
COLOR 255 200 100
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE Med
STYLE
COLOR 255 200 100
OUTLINECOLOR 255 200 100
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE Med
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 255 200 100
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class Med
CLASS #----debut grand ouest
NAME "Grand Ouest" #apparait en legende
EXPRESSION /14|22|27|29|35|44|49|50|53|56|61|72|76|85/
STYLE
COLOR 0 150 150
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE Grand Ouest
STYLE
COLOR 0 150 150
OUTLINECOLOR 0 150 150
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE Grand Ouest
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 0 150 150
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class Grand ouest
CLASS #-----debut Nord Pic
NAME "Nord-Picardie" #apparait en legende
EXPRESSION /02|59|60|62|80/
STYLE
COLOR 150 255 160
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE Nord Pic
STYLE
COLOR 150 255 160
OUTLINECOLOR 150 255 160
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE Nord Pic
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
#COLOR 0 200 230
COLOR 150 255 160
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class Nord Pic
CLASS #-----debut GSO
NAME "Grand Sud-Ouest" #apparait en legende
EXPRESSION /09|12|16|17|19|23|24|31|32|33|40|46|47|64|65|79|81|82|86|87/
STYLE
COLOR 220 140 255
OUTLINECOLOR 0 0 0
WIDTH 0.5
MAXSCALEDENOM 1500000
END #end STYLE GSO
STYLE
COLOR 220 140 255
OUTLINECOLOR 220 140 255
WIDTH 0.5
MINSCALEDENOM 1500000
END #end STYLE GSO
LABEL #apparait pour chaque entité sur la carte
FONT "dejavu"
COLOR 220 140 255
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
POSITION cc
SIZE 4.5
TYPE TRUETYPE
END #ENd label
END # end class GSO
METADATA
"wms_title" "Interrégions"
"wms_srs" "EPSG:2154"
END #fin metadata interrégions
End #end layer interrégions
#-----debut departements
LAYER
NAME "departements"
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, nom_dept, code_dept from activite.departements) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 3000000
LABELITEM "code_dept"
LABELMAXSCALEDENOM 3000000
LABELMINSCALEDENOM 450000
CLASS
STYLE #-----2 styles pour gerer le fond et le contour transparent
OUTLINECOLOR 150 150 150
WIDTH 0.5
END #-----fin style
STYLE
COLOR 255 255 255
OPACITY 0
WIDTH 0.1
END #-----fin style
LABEL
COLOR 80 80 80
#OUTLINECOLOR 80 80 80
#OUTLINEWIDTH 0.7
FONT "verdana-gras"
TYPE truetype
SIZE 6
POSITION auto
END #-----fin label
END #-----fin classe unique
METADATA
"wms_title" "départements"
END #fin metadata emprises
END #fin layer departements
#-----sols pollués
LAYER
#pas réussi à spatialiser directement dans le mapfile
#donc fichier de connection ovf crée à côté, avec chemin complet
#dans CONNECTION ci-dessous sinon marche pas !!!
CONNECTION "C:\ms4w\data\sites_pollues.ovf"
CONNECTIONTYPE OGR
DATA "sites pollues"
METADATA
"wms-srs" "2154"
"wms-title" "sites pollués"
#"gml_include_items" "all"
END
#TEMPLATE "bidon2.html"
NAME "pollution"
TYPE POINT
MAXSCALEDENOM 80000
LABELITEM "Code activite ICPE"
CLASS
NAME "pollution"
STYLE
SYMBOL "pollution"
SIZE 15
END #----fin style
LABEL
FORCE TRUE
FONT "dejavu"
SIZE 6
COLOR 255 50 0
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 1
MAXSCALEDENOM 30000
TYPE truetype
POSITION auto
END #-----fin label
END #-----fin class
END #-----fin layer sols pollués
#---cluster
LAYER
NAME "nombre operation"
TYPE POINT # point necessite symbol
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, numope from activite.vue_centroide) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MINSCALEDENOM 200000
CLUSTER
MAXDISTANCE 35 # in pixels
REGION "ellipse"
END #fin cluster
LABELITEM "Cluster:FeatureCount"
CLASS
NAME "nombre d'operation"
STYLE
SYMBOL "cluster"
SIZE 13
COLOR 255 0 0
OUTLINECOLOR 255 255 255
END #end style
LABEL
FONT "dejavu"
SIZE 5
COLOR 255 255 255
#OUTLINECOLOR 255 255 255
POSITION cc
TYPE truetype
END #fin label emprise
END #end class
METADATA
"wms_title" "wms_cluster"
END #fin metadata nombre_operation
END #end layer cluster
#-----debut layer centroide
LAYER
NAME "emprise_centroide"
TYPE POINT # point necessite symbol
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, numope, nomope from activite.vue_centroide) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 250000
MINSCALEDENOM 80000
LABELITEM "numope"
CLASS
NAME "emprise"
STYLE
SYMBOL "point"
SIZE 5
END #end style
LABEL
FONT "dejavu"
SIZE 4
COLOR "#9400D3"
OUTLINECOLOR 0 0 0
OUTLINEWIDTH 0.3
MAXSCALEDENOM 150000
TYPE truetype
POSITION lc
END #fin label emprise
END #end class
METADATA
"wms_title" "emprise centroide"
END #fin metadata emprise centroide
END #end layer emprise_centroide
#-----debut layer emprise
LAYER
NAME "emprises"
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, numope, annee, nomope, ro, typope from activite.emprise) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 80000
CLASSITEM "typope"
LABELITEM "numope"
CLASS
NAME "diagnostic"
EXPRESSION "diagnostic"
STYLE
COLOR 200 125 0
OPACITY 50
OUTLINECOLOR 200 125 0
WIDTH 1
#PATTERN
#9 2 2 2
#END #fin pattern
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 6
COLOR 0 0 0
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION auto #uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
END # fin class diagnostic
CLASS
NAME "fouille"
EXPRESSION "fouille"
STYLE
COLOR 170 0 0
OPACITY 50
OUTLINECOLOR 170 0 0
WIDTH 1
#PATTERN
#9 2 2 2
#END #fin pattern
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 6
COLOR 170 0 0
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
END # fin class fouille
CLASS
NAME "evaluation"
EXPRESSION "evaluation"
STYLE
OUTLINECOLOR 125 125 125
WIDTH 1
#PATTERN
#9 2 1 2
#END #fin pattern
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 6
COLOR 0 0 0
OUTLINECOLOR 150 150 150
OUTLINEWIDTH 1
POSITION uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
END # fin class evaluation
CLASS
NAME "surveillance"
EXPRESSION "surveillance"
STYLE
OUTLINECOLOR 180 180 180
WIDTH 1
#PATTERN
#9 2 1 2
#END #fin pattern
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 6
COLOR 180 180 180
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
END # fin class surveillance
CLASS
NAME "autres"
#EXPRESSION ""
STYLE
COLOR 160 160 160
OUTLINECOLOR 200 200 200
WIDTH 1
#PATTERN
#9 2 1 2
#END #fin pattern
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 6
COLOR 180 180 180
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
END # fin class surveillance
METADATA
"gml_include_items" "all" #obligé pour afficher attributs getfeatureinfo
"wms_title" "emprises"
END #fin metadata emprises
TEMPLATE "bidon.html" #obligé pour afficher attributs getfeatureinfo
END #fin layer emprises
#-----debut layer prescriptions
LAYER
NAME "prescriptions"
#STATUS ON
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, numope, numprescr, annee, nomope, ro, typope from activite.prescription) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 80000
#CLASSITEM "typope"
LABELITEM "numprescr"
CLASS
NAME "prescriptions"
STYLE
COLOR 146 255 3
OPACITY 35
OUTLINECOLOR 146 255 3
WIDTH 1
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 5
COLOR 0 0 0
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION auto #uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
TEMPLATE "bidon.html"
END #fin class
METADATA
"gml_include_items" "all" #obligé pour afficher attributs getfeatureinfo
"wms_title" "prescriptions"
#"wms_srs" "EPSG:2154"
END #fin metadata prescriptions
END #fin layer prescriptions
#---debut layer ouvertures
LAYER
NAME "ouvertures"
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, typouvert from activite.ouvertures) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 40000
CLASSITEM "typouvert"
CLASS
NAME "tranchée"
EXPRESSION "tranchée"
STYLE
OUTLINECOLOR 0 0 0
WIDTH 0.3
END #end Style
END # fin class tranchée
#CLASS
#NAME "sondage"
#EXPRESSION "Sd."
#STYLE
# OUTLINECOLOR 0 0 0
# WIDTH 0.3
#END #end Style
#END #fin class sondage
METADATA
"wms_title" "ouvertures"
END #fin metadata ouvertures
END #fin layer ouvertures
#-----layer vestiges
LAYER
NAME "vestiges"
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
#----DATA a requeter en selectionnant la geometrie polygone sinon ca plante car dans la couche POSTGIS, il y a des points...
DATA "geom from (select gid, geom, interpret from activite.uniteobservation where st_geometrytype(geom) = 'ST_MultiPolygon') as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 5000
CLASSITEM "interpret" #peut etre comment‚ et la couche fonctionne quand mˆme
CLASS
NAME "trou de poteau/piquet"
EXPRESSION ("[interpret]" in "trou de poteau,trou de poteau ?,trou de piquet")
STYLE
OUTLINECOLOR "#8B0000"
WIDTH 0.5
END #end Style
END # fin class tp
CLASS
NAME "fossé"
EXPRESSION ("[interpret]" in "fossé,fossé ?")
STYLE
OUTLINECOLOR "#FF8C00"
WIDTH 0.5
END #end Style
END # fin class fossé
CLASS
NAME "fosse"
EXPRESSION ("[interpret]" in "fosse,fosse ?")
STYLE
OUTLINECOLOR "#B8860B"
WIDTH 0.5
END #end Style
END # fin class fosse
CLASS
NAME "mur"
EXPRESSION ("[interpret]" in "mur, mur ?,muret")
STYLE
OUTLINECOLOR "#006400"
WIDTH 0.5
END #end Style
END # fin class mur
CLASS
NAME "sépulture"
EXPRESSION ("[interpret]" in "sépulture")
STYLE
OUTLINECOLOR "#1E90FF"
WIDTH 0.5
END #end Style
END # fin class sépulture
CLASS
NAME "autres vestiges"
STYLE
OUTLINECOLOR 50 50 50
WIDTH 0.5
END #end Style
END # fin class autres
METADATA
"wms_title" "vestiges"
END #fin metadata emprises
END #fin layer vestiges
#-----debut layer isolats
LAYER
NAME "isolats"
TYPE POINT
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, interpret from activite.uniteobservation where st_geometrytype(geom) = 'ST_Point') as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 5000
CLASSITEM "interpret"
CLASS
NAME "lithique"
EXPRESSION /[a-z]*éclat[a-z]*|[a-z]*lame[a-z]*|[a-z]*nucléus[a-z]*|[a-z]*silex[a-z]*|[a-z]*esquille[a-z]*/
#-----expressions regulières remplacent le like sql, pas implementé.
STATUS ON
STYLE
SYMBOL "isolat"
OPACITY 60
COLOR 125 125 125 #pour que le point soit bien gris, ne pas oublier FILLED TRUE dans le fichier de symbole
OUTLINECOLOR 0 0 0
WIDTH 0.2 #de l'outline
END #end Style
END # fin class lithique
CLASS
NAME "céramique"
EXPRESSION /[a-z]*céramique[a-z]*/ #-----expressions regulières remplacent le like sql, pas implementé.
STYLE
SYMBOL "isolat"
OPACITY 80
COLOR 255 0 0 #pour que le point soit bien rouge, ne pas oublier FILLED TRUE dans le fichier de symbole
OUTLINECOLOR 0 0 0
WIDTH 0.2 #de l'outline
END #end Style
END # fin class céramique
CLASS
NAME "roche"
EXPRESSION /[a-z]*grès[a-z]*|[a-z]*quartz[a-z]*|granit|gneiss|[a-z]*micaschiste[a-z]*/
#-----expressions regulières remplacent le like sql, pas implementé.
STATUS ON
STYLE
SYMBOL "isolat"
OPACITY 60
COLOR 0 0 0 #pour que le point soit bien noir, ne pas oublier FILLED TRUE dans le fichier de symbole
OUTLINECOLOR 0 0 0
WIDTH 0.2 #de l'outline
END #end Style
END #-----fin classe roche
CLASS
NAME "autres"
STATUS ON
STYLE
SYMBOL "isolat"
OPACITY 60
COLOR 255 255 255 #pour que le point soit bien noir, ne pas oublier FILLED TRUE dans le fichier de symbole
OUTLINECOLOR 0 0 0
WIDTH 0.2 #de l'outline
END #end Style
END #-----fin classe roche
METADATA
"wms_title" "isolats"
END #fin metadata isolats
END #-----fin layer isolats
#-----debut layer raster
LAYER
NAME "brgm"
TYPE RASTER
CONNECTIONTYPE WMS
CONNECTION 'http://geoservices.brgm.fr/geologie?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=SCAN_H_GEOL50&FORMAT=image/png'
PROJECTION
"init=epsg:2154"
END #fin projection
METADATA
"wms_title" "wms_carte_geologique"
END #fin metadata raster
END #end layer
END #-----fin mapfilej'ai besoin que le serveur desserve aussi un flux wfs sur certains layers,
seulement malgré la documentation je ne sais pas comment le configurer en wfs.
pourriez-vous me donner des indications ?
dois-je modifier celui-ci ou en créer un autre spécifique à ce flux ?
Dernière modification par ericire (Fri 02 February 2018 07:56)
Hors ligne
#2 Tue 30 January 2018 19:40
- Nicolas Ribot
- Membre
- Lieu: Toulouse
- Date d'inscription: 9 Sep 2005
- Messages: 1566
Re: mapserver>postgis en wfs ?
Bonsoir,
Un mapfile représente un serveur WFS avec une ou plusieurs layers.
Vous pouvez ajouter de nouvelles layers a votre mapfile existant.
Si ces layers n'ont rien a voir avec celles dans le premier mapfile, ca peut etre mieux de définir un nouveau serveur WFS (= nouveau mapfile), peut etre avec des MD différentes (validité, source des layers, projections déclarées, etc.)
Nicolas
Hors ligne
#3 Fri 02 February 2018 07:40
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
Re: mapserver>postgis en wfs ?
bonjour Nicolas
apparamment quand j'essaie de créer/sélectionner une couche wfs dans qgis avec
http://10.210.1.32:8080/cgi-bin/mapserv … er_ol3.map
qgis m'indique que "le protocole wfs version n'est pas géré".
d'où ma question :
comment configurer ce mapfil ou en créer un autre ?
Hors ligne
#4 Fri 02 February 2018 09:08
Re: mapserver>postgis en wfs ?
Bonjour,
Je déplacement le sujet dans le forum geolibre-webn, plus à sa place et répond à la question juste après.
Y.
Yves Jacolin, bénévole de l'association GeoRezo.net, agit au nom et pour le compte de l'association - Partageons ce qui nous départage !! - GeoRezo vous aide ? Aidez GeoRezo !
Hors ligne
#5 Fri 02 February 2018 09:11
Re: mapserver>postgis en wfs ?
Bonjour,
Ton mapfile est incorrecte pour service du WFS, regarde la doc : http://mapserver.org/fr/ogc/wfs_server.html Tes métadata ne sont pas remplies (wfs_name, etc.).
À mon avis le service WMS ne fonctionne pas non plus car aucun service n'est autorisé ("wfs_enable_request").
Y.
Yves Jacolin, bénévole de l'association GeoRezo.net, agit au nom et pour le compte de l'association - Partageons ce qui nous départage !! - GeoRezo vous aide ? Aidez GeoRezo !
Hors ligne
#6 Fri 02 February 2018 12:02
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
Re: mapserver>postgis en wfs ?
hello Yves
le wms fonctionne
j'avais déjà vu la doc de mapserver
voilà le mapfile qui ne fonctionne pas
Code:
MAP
NAME "Mapserver-Inrap"
#STATUS ON
#SIZE 400 300
SYMBOLSET "C:\ms4w\map\symbols\symbols.sym"
EXTENT 93501.1 6044342.00 1248133.25 7115784.50 #xmin ymin xmax ymax
UNITS METERS
#SHAPEPATH "../data"
#IMAGECOLOR 255 255 255
FONTSET "./fonts/fonts.txt"
DEBUG 5
CONFIG "CPL_DEBUG" "ON"
CONFIG "PROJ_DEBUG" "ON"
CONFIG MS_ERRORFILE "C:/ms4w/errorMapFile.txt"
PROJECTION # proj de sortie
"init=epsg:2154"
END #fin projection
#
# Start of web interface definition
#
WEB
IMAGEPATH "/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wfs_title" "WFS-Inrap, outil d'aide au montage des operations" ## REQUIRED
"wfs_onlineresource" "http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&" ## Recommended
"wfs_srs" "EPSG:2154" ## Recommended
"wfs_abstract" "This text describes my WFS service." ## Recommended
"wfs_enable_request" "*" # necessary
END
END
#
# Start of layer definitions
#-----debut layer prescriptions
LAYER
NAME "prescriptions"
#STATUS ON
TYPE POLYGON
PROJECTION
"init=epsg:2154"
END #fin projection
CONNECTIONTYPE POSTGIS
CONNECTION "host=10.210.1.32 dbname=activite user=POSTGIS password=#### port=5432"
DATA "geom from (select gid, geom, numope, numprescr, annee, nomope, ro, typope from activite.prescription) as foo using unique gid SRID=2154"
PROCESSING "CLOSE_CONNECTION=DEFER"
MAXSCALEDENOM 80000
#CLASSITEM "typope"
LABELITEM "numprescr"
CLASS
NAME "prescriptions"
STYLE
COLOR 146 255 3
OPACITY 35
OUTLINECOLOR 146 255 3
WIDTH 1
LINECAP round
END #end Style
LABEL
FONT "verdana"
SIZE 5
COLOR 0 0 0
OUTLINECOLOR 255 255 255
OUTLINEWIDTH 1
POSITION auto #uc
MAXSCALEDENOM 80000
TYPE truetype
END #fin label
TEMPLATE "bidon.html"
END #fin class
METADATA
"wfs_title" "prescriptions" ##REQUIRED
"wfs_srs" "EPSG:2154" ## REQUIRED
"gml_include_items" "all" ## Optional (serves all attributes for layer)
"gml_featureid" "ID" ## REQUIRED
"wfs_enable_request" "*"
END #fin metadata prescriptions
END #fin layer prescriptions
#
END #mapfileDernière modification par ericire (Fri 02 February 2018 12:08)
Hors ligne
#7 Fri 02 February 2018 12:39
Re: mapserver>postgis en wfs ?
ah ok donc tu as deux mapfile. Ce n'est pas une obligation. Pour ne pas à avoir à duplique rles informations, tu peux fusionner deux paramètres de nom identique en ows_<nom identique>.
Premier test : appel ton service WFS en GetCapabilities, quelque chose comme : http://10.210.1.32:8080/cgi-bin/mapserv … SION=1.1.0
Qu'affiche t'il ?
Y.
Yves Jacolin, bénévole de l'association GeoRezo.net, agit au nom et pour le compte de l'association - Partageons ce qui nous départage !! - GeoRezo vous aide ? Aidez GeoRezo !
Hors ligne
#8 Fri 02 February 2018 13:02
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
Re: mapserver>postgis en wfs ?
voici
Code:
<wfs:WFS_Capabilities version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><ows:ServiceIdentification><ows:Title>WFS-Inrap, outil d'aide au montage des operations</ows:Title><ows:Abstract>This text describes my WFS service.</ows:Abstract><!--WARNING: Optional metadata "ows_keywordlist" was missing for ows:KeywordList--><ows:ServiceType codeSpace="OGC">OGC WFS</ows:ServiceType><ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion><ows:Fees/><!--WARNING: Optional metadata "ows_fees" was missing for ows:Fees--><ows:AccessConstraints/><!--WARNING: Optional metadata "ows_accessconstraints" was missing for ows:AccessConstraints--></ows:ServiceIdentification><ows:ServiceProvider><ows:ProviderName/><!--WARNING: Mandatory metadata "ows_contactorganization" was missing for ows:ProviderName--><ows:ProviderSite xlink:type="simple" xlink:href=""/><!--WARNING: Optional metadata "ows_service_onlineresource" was missing for ows:ProviderSite/@xlink:href--><ows:ServiceContact><ows:IndividualName/><!--WARNING: Optional metadata "ows_contactperson" was missing for ows:IndividualName--><ows:PositionName/><!--WARNING: Optional metadata "ows_contactposition" was missing for ows:PositionName--><ows:ContactInfo><ows:Phone><ows:Voice/><!--WARNING: Optional metadata "ows_contactvoicetelephone" was missing for ows:Voice--><ows:Facsimile/><!--WARNING: Optional metadata "ows_contactfacsimiletelephone" was missing for ows:Facsimile--></ows:Phone><ows:Address><ows:DeliveryPoint/><!--WARNING: Optional metadata "ows_address" was missing for ows:DeliveryPoint--><ows:City/><!--WARNING: Optional metadata "ows_city" was missing for ows:City--><ows:AdministrativeArea/><!--WARNING: Optional metadata "ows_stateorprovince" was missing for ows:AdministrativeArea--><ows:PostalCode/><!--WARNING: Optional metadata "ows_postcode" was missing for ows:PostalCode--><ows:Country/><!--WARNING: Optional metadata "ows_country" was missing for ows:Country--><ows:ElectronicMailAddress/><!--WARNING: Optional metadata "ows_contactelectronicmailaddress" was missing for ows:ElectronicMailAddress--></ows:Address><ows:OnlineResource xlink:type="simple" xlink:href=""/><!--WARNING: Optional metadata "ows_service_onlineresource" was missing for ows:OnlineResource/@xlink:href--><ows:HoursOfService/><!--WARNING: Optional metadata "ows_hoursofservice" was missing for ows:HoursOfService--><ows:ContactInstructions/><!--WARNING: Optional metadata "ows_contactinstructions" was missing for ows:ContactInstructions--></ows:ContactInfo><ows:Role/><!--WARNING: Optional metadata "ows_role" was missing for ows:Role--></ows:ServiceContact></ows:ServiceProvider><ows:OperationsMetadata><ows:Operation name="GetCapabilities"><ows:DCP><ows:HTTP><ows:Get xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/><ows:Post xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/></ows:HTTP></ows:DCP><ows:Parameter name="service"><ows:Value>WFS</ows:Value></ows:Parameter><ows:Parameter name="AcceptVersions"><ows:Value>1.0.0</ows:Value><ows:Value>1.1.0</ows:Value></ows:Parameter><ows:Parameter name="AcceptFormats"><ows:Value>text/xml</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="DescribeFeatureType"><ows:DCP><ows:HTTP><ows:Get xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/><ows:Post xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/></ows:HTTP></ows:DCP><ows:Parameter name="outputFormat"><ows:Value>XMLSCHEMA</ows:Value><ows:Value>text/xml; subtype=gml/2.1.2</ows:Value><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="GetFeature"><ows:DCP><ows:HTTP><ows:Get xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/><ows:Post xlink:type="simple" xlink:href="http://10.210.1.32:8080/cgi-bin/mapserv.exe?MAP=C:/ms4w/map/fond_mapserver_wfs_ol4.map&"/></ows:HTTP></ows:DCP><ows:Parameter name="resultType"><ows:Value>results</ows:Value><ows:Value>hits</ows:Value></ows:Parameter><ows:Parameter name="outputFormat"><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value></ows:Parameter></ows:Operation></ows:OperationsMetadata><FeatureTypeList><Operations><Operation>Query</Operation></Operations><FeatureType><Name>prescriptions</Name><Title>prescriptions</Title><DefaultSRS>urn:ogc:def:crs:EPSG::2154</DefaultSRS><OutputFormats><Format>text/xml; subtype=gml/3.1.1</Format></OutputFormats><ows:WGS84BoundingBox dimensions="2"><ows:LowerCorner>-4.65284376785033 41.3915693544626</ows:LowerCorner><ows:UpperCorner>10.4140145983697 49.4522687008555</ows:UpperCorner></ows:WGS84BoundingBox></FeatureType></FeatureTypeList><ogc:Filter_Capabilities><ogc:Spatial_Capabilities><ogc:GeometryOperands><ogc:GeometryOperand>gml:Point</ogc:GeometryOperand><ogc:GeometryOperand>gml:LineString</ogc:GeometryOperand><ogc:GeometryOperand>gml:Polygon</ogc:GeometryOperand><ogc:GeometryOperand>gml:Envelope</ogc:GeometryOperand></ogc:GeometryOperands><ogc:SpatialOperators><ogc:SpatialOperator name="Equals"/><ogc:SpatialOperator name="Disjoint"/><ogc:SpatialOperator name="Touches"/><ogc:SpatialOperator name="Within"/><ogc:SpatialOperator name="Overlaps"/><ogc:SpatialOperator name="Crosses"/><ogc:SpatialOperator name="Intersects"/><ogc:SpatialOperator name="Contains"/><ogc:SpatialOperator name="DWithin"/><ogc:SpatialOperator name="Beyond"/><ogc:SpatialOperator name="BBOX"/></ogc:SpatialOperators></ogc:Spatial_Capabilities><ogc:Scalar_Capabilities><ogc:LogicalOperators/><ogc:ComparisonOperators><ogc:ComparisonOperator>LessThan</ogc:ComparisonOperator><ogc:ComparisonOperator>GreaterThan</ogc:ComparisonOperator><ogc:ComparisonOperator>LessThanEqualTo</ogc:ComparisonOperator><ogc:ComparisonOperator>GreaterThanEqualTo</ogc:ComparisonOperator><ogc:ComparisonOperator>EqualTo</ogc:ComparisonOperator><ogc:ComparisonOperator>NotEqualTo</ogc:ComparisonOperator><ogc:ComparisonOperator>Like</ogc:ComparisonOperator><ogc:ComparisonOperator>Between</ogc:ComparisonOperator></ogc:ComparisonOperators></ogc:Scalar_Capabilities><ogc:Id_Capabilities><ogc:EID/><ogc:FID/></ogc:Id_Capabilities></ogc:Filter_Capabilities></wfs:WFS_Capabilities>
et oui je préfèrerais n'avoir qu'un seul mapfile
Dernière modification par ericire (Fri 02 February 2018 13:20)
Hors ligne
#9 Fri 02 February 2018 13:46
Re: mapserver>postgis en wfs ?
Bonjour,
Ton mapfile renvoie bien un GetCapabilities. Il y a des alertes dans celui-ci que tu peux traiter mais qui ne sont pas bloquante.
As tu un message d'erreur quand tu l'utilises dans QGIS ?
Y.
Yves Jacolin, bénévole de l'association GeoRezo.net, agit au nom et pour le compte de l'association - Partageons ce qui nous départage !! - GeoRezo vous aide ? Aidez GeoRezo !
Hors ligne
#10 Fri 02 February 2018 14:57
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
Re: mapserver>postgis en wfs ?
toujour le même message "le protocole wfs version n'est pas géré"
Hors ligne
#11 Tue 13 February 2018 18:34
- ericire
- Participant occasionnel
- Date d'inscription: 6 Jun 2010
- Messages: 26
Re: mapserver>postgis en wfs ?
bonjour,
je n'ai toujours pas réussi à configurer ce mapfile ....
Hors ligne


