Pages: 1
- Sujet précédent - [Mapserver] Configuration du .map pour fonctionner avec QGis - Sujet suivant
#1 Wed 17 June 2009 00:46
- GuZzO
- Juste Inscrit !
- Date d'inscription: 17 Jun 2009
- Messages: 9
[Mapserver] Configuration du .map pour fonctionner avec QGis
Bonjour,
j'utilise QGis et j'arrive parfaitement à mes connecter à des serveurs WMS distant. Pour des raisons de mutualisations des données et de non-support de l'ecw, j'ai voulu monter un serveur carto pour afficher les fonds.
J'ai installer la dernière version de MS4W et je me suis servi de QGis pour générer un fichier .map. J'ai éditer le fichier en question mais je n'arrive pas à visualiser les fonds dans QGis....
J'ai voulu faire au plus simple pour reprendre du début et j'essaye maintenant juste d'afficher un shapefile de la France projeté en L2E.
[img]http://img14.imageshack.us/img14/9896/000qtc.th.jpg[/img]
Je dois avouer que malgré la lecture de ce forum et d'autres sources, le contenu du .map automatiquement généré reste assez obscure! Je crois y détecter un problème de projection?!
Code:
# Map file created from QGIS project file C:/ms4w/Apache/htdocs/map/mywms.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
  NAME test
  # Map image size
  SIZE 512 512
  UNITS meters
  EXTENT -175172.350037 1594005.749963 1378632.350038 2703866.250017
  PROJECTION
    'proj=lcc'
    'lat_1=46.8'
    'lat_0=46.8'
    'lon_0=0'
    'k_0=0.99987742'
    'x_0=600000'
    'y_0=2200000'
    'a=6378249.2'
    'b=6356515'
    'towgs84=-168,-60,320,0,0,0,0'
    'pm=2.3372291666985'
    'units=m'
    'no_defs'
    ''
  END
  # Background color for the map canvas -- change as desired
  IMAGECOLOR 192 192 192
  IMAGEQUALITY 95
  IMAGETYPE png
  OUTPUTFORMAT
    NAME png
    DRIVER 'GD/PNG'
    MIMETYPE 'image/png'
    #IMAGEMODE PC256
    EXTENSION 'png'
  END
  # Legend
  LEGEND
      IMAGECOLOR 255 255 255
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END
  # Web interface definition. Only the template parameter
  # is required to display a map. See MapServer documentation
  WEB
    # Set IMAGEPATH to the path where MapServer should
    # write its output.
    IMAGEPATH '/tmp/'
    # Set IMAGEURL to the url that points to IMAGEPATH
    # as defined in your web server configuration
    IMAGEURL '/tmp/'
    # WMS server settings
    METADATA
      'wms_title'           'test'
      'wms_onlineresource'  'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
      'wms_srs'             'EPSG:4326'
    END
    #Scale range at which web interface will operate
    # Template and header/footer settings
    # Only the template parameter is required to display a map. See MapServer documentation
  END
  LAYER
    NAME 'DEP'
    TYPE POLYGON
    DATA 'C:\SIG\Vecteurs\Referentiels\DEP.shp'
    METADATA
      'wms_title' 'DEP'
    END
    STATUS DEFAULT
    TRANSPARENCY 100
    PROJECTION
    'proj=lcc'
    'lat_1=46.8'
    'lat_0=46.8'
    'lon_0=0'
    'k_0=0.99987742'
    'x_0=600000'
    'y_0=2200000'
    'a=6378249.2'
    'b=6356515'
    'towgs84=-168,-60,320,0,0,0,0'
    'pm=2.3372291666985'
    'units=m'
    'no_defs'
    ''
    END
    CLASS
       NAME 'DEP' 
       STYLE
         SYMBOL 0 
         SIZE 2 
         OUTLINECOLOR 0 0 0
         COLOR 144 50 207
       END
    END
  END
ENDLa commande:
http://localhost/cgi-bin/mapserv.exe?map=c:/ms4w/apache/htdocs/map/mywms.map&REQUEST=GetCapabilities&SERVICE=WMS&VERSiON=1.1.0
retourne le code suivant:
Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?> <!DOCTYPE WMT_MS_Capabilities (View Source for full doctype...)> - <!-- end of DOCTYPE declaration --> - <WMT_MS_Capabilities version="1.1.0"> - <!-- MapServer version 5.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE --> - <Service> <Name>OGC:WMS</Name> <Title>test</Title> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> <ContactInformation /> </Service> - <Capability> - <Request> - <GetCapabilities> <Format>application/vnd.ogc.wms_xml</Format> - <DCPType> - <HTTP> - <Get> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Get> - <Post> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Post> </HTTP> </DCPType> </GetCapabilities> - <GetMap> <Format>image/png</Format> <Format>image/gif</Format> <Format>image/png; mode=24bit</Format> <Format>image/jpeg</Format> <Format>image/vnd.wap.wbmp</Format> <Format>image/tiff</Format> <Format>image/svg+xml</Format> - <DCPType> - <HTTP> - <Get> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Get> - <Post> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Post> </HTTP> </DCPType> </GetMap> - <GetFeatureInfo> <Format>text/plain</Format> <Format>application/vnd.ogc.gml</Format> - <DCPType> - <HTTP> - <Get> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Get> - <Post> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Post> </HTTP> </DCPType> </GetFeatureInfo> - <DescribeLayer> <Format>text/xml</Format> - <DCPType> - <HTTP> - <Get> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Get> - <Post> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&" xlink:type="simple" /> </Post> </HTTP> </DCPType> </DescribeLayer> </Request> - <Exception> <Format>application/vnd.ogc.se_xml</Format> <Format>application/vnd.ogc.se_inimage</Format> <Format>application/vnd.ogc.se_blank</Format> </Exception> <VendorSpecificCapabilities /> <UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0" /> - <Layer queryable="0" opaque="0" noSubsets="0"> <Name>test</Name> <Title>test</Title> <SRS>EPSG:4326</SRS> <LatLonBoundingBox minx="-11.0688" miny="40.929" maxx="11.1177" maxy="51.3402" /> - <!-- WARNING: This layer has its status set to DEFAULT and will always be displayed when doing a GetMap request even if it is not requested by the client. This is not in line with the expected behavior of a WMS server. Using status ON or OFF is recommended. --> - <Layer queryable="0" opaque="0" cascaded="0" noSubsets="0"> <Name>DEP</Name> <Title>DEP</Title> <LatLonBoundingBox minx="-11.1694" miny="52.9596" maxx="11.2334" maxy="62.6445" /> - <Style> <Name>default</Name> <Title>default</Title> - <LegendURL width="54" height="23"> <Format>image/png</Format> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://my.host.com/cgi-bin/mapserv?map=wms.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=DEP&format=image/png&STYLE=default" /> </LegendURL> </Style> </Layer> </Layer> </Capability> </WMT_MS_Capabilities>
et la commande suivante 
http://localhost/cgi-bin/mapserv.exe?map=c:/ms4w/apache/htdocs/map/mywms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=getmap&LAYERS=DEP
retourne une erreur:
Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?> <!DOCTYPE ServiceExceptionReport (View Source for full doctype...)> - <ServiceExceptionReport version="1.1.1"> <ServiceException code="MissingParameterValue">msWMSLoadGetMapParams(): WMS server error. Missing required parameter SRS</ServiceException> </ServiceExceptionReport>
cependant j'arrive à afficher ma carte dans Firefox avec la commande:
http://localhost/cgi-bin/mapserv.exe?mode=map&map=C:/ms4w/Apache/htdocs/map/mywms.map
et finalement quand je fais:
http://localhost/cgi-bin/mapserv.exe?map=c:/ms4w/apache/htdocs/map/mywms.map&REQUEST=GetCapabilities&SERVICE=WMS
sous Qgis, il m'affiche une couche disponible mais si j'essaye de l'afficher j'ai un message d'erreur super explicite:
Ne peut dessiner 001 parce que:
001 est le nom de ma connexion vers le serveur WMS...
[img]http://img195.imageshack.us/img195/8315/001gqx.th.jpg[/img]
Question subsidiaire: j'ai essayé de visualiser ce même fichier .map avec la méthode du tutoriel d'openlayer (ICI)
Et j'obtiens un affichage très bizarre, l'image est découpé par tronçon qui peuvent se répéter plusieurs fois:
[img]http://img188.imageshack.us/img188/157/002kxw.th.jpg[/img]
Voilà pour le détail de mes soucis...
J'espère avoir assez détaillé sans être trop lourd!
Merci par avance pour l'aide que vous pourrez m'apporter!!
G.
Hors ligne
#2 Wed 17 June 2009 00:52
- GuZzO
- Juste Inscrit !
- Date d'inscription: 17 Jun 2009
- Messages: 9
Re: [Mapserver] Configuration du .map pour fonctionner avec QGis
Si j'essaye de modifier la projection dans le fichier .map:
# Map file created from QGIS project file C:/ms4w/Apache/htdocs/map/mywms.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
NAME test
# Map image size
SIZE 512 512
UNITS meters
EXTENT -175172.350037 1594005.749963 1378632.350038 2703866.250017
PROJECTION
'EPSG:27572'
END
# Background color for the map canvas -- change as desired
IMAGECOLOR 192 192 192
IMAGEQUALITY 95
IMAGETYPE png
OUTPUTFORMAT
NAME png
DRIVER 'GD/PNG'
MIMETYPE 'image/png'
#IMAGEMODE PC256
EXTENSION 'png'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END
# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH '/tmp/'
# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL '/tmp/'
# WMS server settings
METADATA
'wms_title' 'test'
'wms_onlineresource' 'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
'wms_srs' 'EPSG:27572'
END
#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See MapServer documentation
END
LAYER
NAME 'DEP'
TYPE POLYGON
DATA 'C:\SIG\Vecteurs\Referentiels\DEP.shp'
METADATA
'wms_title' 'DEP'
END
STATUS DEFAULT
TRANSPARENCY 100
PROJECTION
'EPSG:27572'
END
CLASS
NAME 'DEP'
STYLE
SYMBOL 0
SIZE 2
OUTLINECOLOR 0 0 0
COLOR 144 50 207
END
END
END
END
j'ai une erreur:
msProcessProjection(): Projection library error. projection not named
Dernière modification par GuZzO (Wed 17 June 2009 00:53)
Hors ligne
#3 Wed 17 June 2009 09:16
Re: [Mapserver] Configuration du .map pour fonctionner avec QGis
Bonjour,
Relis la doc de MapServer "section projection" pour l'utilisation d'un code EPSG 
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
#4 Wed 17 June 2009 12:07
- GuZzO
- Juste Inscrit !
- Date d'inscription: 17 Jun 2009
- Messages: 9
Re: [Mapserver] Configuration du .map pour fonctionner avec QGis
arf...   effectivement il me manque déjà un init=
PROJECTION
"init=epsg:27572"
END
je resteste chez moi ce soir!
Hors ligne
#5 Sun 21 June 2009 01:23
- GuZzO
- Juste Inscrit !
- Date d'inscription: 17 Jun 2009
- Messages: 9
Re: [Mapserver] Configuration du .map pour fonctionner avec QGis
j'ai réessayer (avec succès!) en modifiant le bloc PROJECTION!
j'avais aussi d'autres erreurs mineures mais c'était clairement le bloc PROJECTION qui posait les plus gros problèmes!
tout s'est résolu avec ces modifs, merci pour les commentaires qui 'mont réorienté!
Hors ligne
Pages: 1
- Sujet précédent - [Mapserver] Configuration du .map pour fonctionner avec QGis - Sujet suivant





