#1 Wed 09 February 2011 13:52
- zorgglub
- Juste Inscrit !
- Date d'inscription: 9 Feb 2011
- Messages: 5
Openlayer pour afficher un mapfile
Bonjour
Je suis débutant sur Openlayer.
Avec Mapserver le mapfile s'affiche.
Code:
MAP
IMAGETYPE PNG
EXTENT 534939.812465 46660.126962 690104.815208 171430.130363
SIZE 800 800
SHAPEPATH "/ms4w/apps/test"
IMAGECOLOR 255 255 255
WEB
IMAGEPATH "http://10.8.*.*/ms4w/tmp/ms_tmp/"
IMAGEURL "http://10.8.*.*/ms_tmp/"
METADATA
"wfs_title" "layer"
"wfs_onlineresource" "http://10.8.*.*/cgi-bin/mapserv?map=/ms4w/apps/test/map2.map&layer=communek1lamb1&layer=oa_sra_surf&mode=map" ## Recommended
"wfs_srs" "epsg:27561"
END
END
SCALEBAR
INTERVALS 2
UNITS meters
OUTLINECOLOR 0 0 0
STYLE 0
STATUS embed
LABEL
SIZE small
COLOR 0 0 0
END
END
LAYER
NAME communek1lamb1
DATA communek1lamb1
STATUS ON
TYPE POLYGON
CLASS
STYLE
COLOR 200 200 200
OUTLINECOLOR 0 0 0
END
END
METADATA
### WFS
"wfs_title" "communek1lamb1"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
DUMP TRUE
END
LAYER
NAME oa_sra_surf
DATA oa_sra_surf
STATUS ON
TYPE POLYGON
CLASS
STYLE
COLOR 125 0 0
OUTLINECOLOR 30 30 10
END
END
METADATA
### WFS
"wfs_title" "ope"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
DUMP TRUE
END
PROJECTION
"init=epsg:27561"
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
TRANSPARENT ON
END
ENDmais quand j'essaye un affichage openlayer, rien ne s'affiche, juste le zoom
voilà le code
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MapServer Layer</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="http://10.8.*.*/openlayers/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init() {
var options =
{
projection: new OpenLayers.Projection("epsg:27561"),
displayProjection:new OpenLayers.Projection("epsg:27561"),
};
map = new OpenLayers.Map('map',options);
var layer = new OpenLayers.Layer.WFS( "layer","http://10.8.1.*.*/cgi-bin/mapserv.exe?map=/ms4w/apps/test/map2.map&"
, {layers: "communek1lamb1", format: 'image/jpeg' }, {buffer: 1, isBaseLayer: true} );
map.addLayers([layer]);
map.addControl(new OpenLayers.Control.Scale('scale'));
map.addControl(new OpenLayers.Control.MousePosition());
}
</script>
</head>
<body onLoad="init()">
<div id="name"></div><br />
<div id="map" style="width:900px;height:650px"></div>
</body>
</html>voilà le résultat
je pense que cela vient des projections mais je ne trouve pas d'ou cela vient !!
mon fichier shape est en lambert I Nord
merci pour votre aide
zorgglub
Dernière modification par zorgglub (Wed 09 February 2011 14:00)
Hors ligne
#2 Wed 09 February 2011 14:08
Re: Openlayer pour afficher un mapfile
Bonjour,
Peux tu installer Firebug si ce n'est pas déjà fait et vérifier que la requête WFS envoyée par OpenLayers est correct.
Et un lien vers le wiki de GeoRezo pour expliquer en image comment utiliser Firebug : http://georezo.net/wiki/main/logiciels/ … rs/firebug
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 Wed 09 February 2011 14:37
- zorgglub
- Juste Inscrit !
- Date d'inscription: 9 Feb 2011
- Messages: 5
Re: Openlayer pour afficher un mapfile
bonjour
apparement j'ai
Code:
ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd"> − <ServiceException code="MissingParameterValue" locator="typename"> msWFSGetFeature(): WFS server error. Incomplete WFS request: TYPENAME parameter missing </ServiceException> </ServiceExceptionReport>
j'ai essayer de rajouter
Code:
{TYPENAME: "communek1lamb1",layers: "communek1lamb1", format: 'image/jpeg' }, {buffer: 1, isBaseLayer: true} );
map.addLayers([layer]);
map.addControl(new OpenLayers.Control.Scale('scale'));
map.addControl(new OpenLayers.Control.MousePosition());
}mais cela ne marche pas
merci
zorgglub
Hors ligne
#4 Wed 09 February 2011 15:01
Re: Openlayer pour afficher un mapfile
Dans le cas d'un WFS il n'y a pas de paramètre layers mais typename. De même le format jpeg pour une couche vecteur ![]()
continuer à corriger votre code et à regarder les appels WFS réaliser par OL. Il y a probablement d'autres problèmes.
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 Wed 09 February 2011 15:54
- zorgglub
- Juste Inscrit !
- Date d'inscription: 9 Feb 2011
- Messages: 5
Re: Openlayer pour afficher un mapfile
Merci Yves,
c'est parfait
en effet, jpeg pour une couche vecteur et le typename ![]()
zorgglub
Hors ligne


