#1 Mon 19 December 2011 10:58
- phil008
- Participant occasionnel
- Date d'inscription: 10 Sep 2011
- Messages: 23
Problème: Mapserver + Openlayers via WFS
Bonjour
Je suis sur Ubuntu et j'essaye d'afficher une simple couche Mapserver, sous OpenLayers 2.11 en mode WFS. Mais je n'y arrive pas. J'ai installé Firebug qui ne relève qu'une seule erreur: "maxExtent is null" (ce qui ne m'avance pas trop).
Voici mon mapfile:
Code:
MAP
NAME 'afrique'
IMAGETYPE PNG24
EXTENT -26.706248 -37.127960 70.493774 43.845013
UNITS dd
SIZE 600 500
SHAPEPATH '/var/www/projets/afrique/'
IMAGECOLOR 232 235 255
WEB
IMAGEPATH '/var/www/projets/files/tmp/'
IMAGEURL 'http://localhost/projets/files/tmp/'
METADATA
"wfs_title" "afrique"
"wfs_onlineresource" "http://localhost/cgi-bin/mapserv?map=/var/www/projets/afrique/afrique.map&"
"wfs_srs" "EPSG:4326"
END
END
############
LAYER
NAME 'afrique'
STATUS ON
METADATA
"wms_title" "afrique"
"wfs_title" "afrique"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
DATA 'afrique.shp'
STATUS OFF
TYPE POLYGON
CLASS
NAME 'afrique'
STYLE
COLOR 255 204 102
END
STYLE
OUTLINECOLOR 0 0 0
WIDTH 1
ANTIALIAS FALSE
END
END
END
############
ENDet voici mon fichier html
Code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="../../../OpenLayers-2.11/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../../../OpenLayers-2.11/examples/style.css" type="text/css">
<script src="../../../OpenLayers-2.11/lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( 'map' );
var afrique = new OpenLayers.Layer.WFS(
"afrique", "http://localhost/cgi-bin/mapserv?map=/var/www/projets/afrqiue/afrique.map&",
{typename: 'afrique'},
{ extractAttributes: true}
);
map.addLayer(afrique);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<h1 id="title">WFS Example</h1>
<div id="tags">
</div>
<p id="shortdesc">
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
</div>
</body>
</html>Qu'est ce qui cloche? Merci d'avance.
Dernière modification par phil008 (Mon 19 December 2011 12:10)
Hors ligne
#2 Mon 19 December 2011 11:31
- Laurent Jégou
- Participant assidu
- Lieu: Toulouse
- Date d'inscription: 5 Sep 2005
- Messages: 447
- Site web
Re: Problème: Mapserver + Openlayers via WFS
Je note un "STATUS OFF" dans le bloc layer.
Enseignant-Chercheur en Géomatique
UT2J - Dept Géo / CNRS UMR LISST-Cieu / Master Sigma - Revue Mappemonde
Hors ligne
#3 Mon 19 December 2011 12:03
- phil008
- Participant occasionnel
- Date d'inscription: 10 Sep 2011
- Messages: 23
Re: Problème: Mapserver + Openlayers via WFS
Exact, j'ai rectifié et mis ON, mais je n'ai toujours rien qui s'affiche.
Hors ligne


