#1 Tue 25 August 2009 16:31
- skerdreux
- Participant actif
- Lieu: Nantes
- Date d'inscription: 13 Mar 2006
- Messages: 112
[MapServer] Image blanche en utilisant avec mapfish
Bonjour,
J'ai publié en local (distribution Ubuntu 9.04) un service cartographique à partir du mapfile suivant :
Code:
# Map file created from QGIS project file /home/administrateur/QGIS/Ireland/Ireland.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
NAME Ireland
# Map image size
SIZE 400 600
UNITS dd
EXTENT -190207.439460 8702.958502 554897.499660 470744.181397
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'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 'localhost/tmp/'
# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL 'localhost/www//tmp/'
# WMS server settings
METADATA
'wms_title' 'Ireland'
'wms_onlineresource' 'http://localhost/cgi-bin/mapserv?map=/var/www/MAPFILE/Ireland_MapFile.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 'Regions'
TYPE POLYGON
DATA '/var/www/SIG_DATA/Regions.shp'
METADATA
'wms_title' 'Regions'
END
STATUS DEFAULT
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
''
END
CLASS
NAME 'Regions'
STYLE
SYMBOL 0
SIZE 2
OUTLINECOLOR 0 0 0
COLOR 36 108 203
END
END
END
ENDbref un fichier mapfile très classique.
j'arrive très bien à afficher une carte via :
http://localhost/cgi-bin/mapserv?map=/var/www/MAPFILE/Ireland_MapFile.map&mode=map
et par ailleurs j'ai testé le WMS qui me retourne bien une image via :
http://localhost/cgi-bin/mapserv?map=/var/www/MAPFILE/Ireland_MapFile.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Regions&STYLES=&SRS=EPSG:4326&BBOX=-190207.439460,8702.958502,554897.499660,470744.181397&WIDTH=400&HEIGHT=300&FORMAT=image/png
J'ai ensuite créer une page simple pour utiliser avec mapfish. voici la partie javascript :
Code:
<script type="text/javascript">
Ext.onReady(function() {
var map = new OpenLayers.Map($('olmap'));
var wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://localhost/cgi-bin/mapserv?map=/var/www/MAPFILE/Ireland_MapFile.map&", {layers: 'Regions'}, {buffer: 0});
map.addLayers([wms]);
map.zoomToMaxExtent();
});
</script>et là le résultat est le suivant :
[img]http://img31.imageshack.us/img31/8500/testlsq.jpg[/img]
il semble donc générer une image mais vide.
si je remplace l'adresse du service par celui par exemple :
http://labs.metacarta.com/wms/vmap0
il m'affiche correctement l'image à l'écran.
Quelqu'un aurait une idée d'où pourrait provenir l'erreur ? (à priori du mapFile).
Merci d'avance
Sylvain K.
CapGemini
Hors ligne
#2 Tue 25 August 2009 16:36
Re: [MapServer] Image blanche en utilisant avec mapfish
Ton url est incorrecte :
Code:
http://localhost/cgi-bin/mapserv?map=/var/www/MAPFILE/Ireland_MapFile.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Regions&STYLES=&SRS=EPSG:4326&BBOX=-190207.439460,8702.958502,554897.499660,470744.181397&WIDTH=400&HEIGHT=300&FORMAT=image/png
Car tu définies une "projection" en latlong (WGS84, EPSG: 4326) mais tes coordonnées sont le lambert (?).
ton problème vient du fait que tu n'as pas définie la projection de tes données régions. Si tu veux tester avec la projection utilisé, ta bbox doit être du style "-5,40,10,52"
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
#3 Tue 25 August 2009 17:52
- skerdreux
- Participant actif
- Lieu: Nantes
- Date d'inscription: 13 Mar 2006
- Messages: 112
Re: [MapServer] Image blanche en utilisant avec mapfish
je viens de faire différents test avec différents fichiers SHP et il semble que l'export vers MapFile depuis QGIS pose problème. En effet ce dernier me configurer toujours la projection par défaut sur du WGS84 quand j'ajoute des couches à un projet nouvellement créer. il semble donc que ça soit QGIS le problème.
Je regarderais ce problème demain et je mettrais à jour ce post en conséquent (en espérant que ça puisse un jour aider quelqu'un).
en tout cas merci pour ce début de piste !
Sylvain K.
CapGemini
Hors ligne


