Pages: 1
- Sujet précédent - [OpenLayers + MapServer] Impossible d'afficher la carte avec openLayer - Sujet suivant
#1 Wed 26 October 2011 15:13
- skwi6
- Juste Inscrit !
- Date d'inscription: 26 Oct 2011
- Messages: 2
[OpenLayers + MapServer] Impossible d'afficher la carte avec openLayer
Bonjour,
Je n'arrive pas à afficher la carte à l'aide d'openLayers, pourtant j'arrive à voir un résultat lorsque je rentre manuellement une URL pour aller chercher la map.
Ma fichier *.map sur le serveur est le suivant :
Code:
MAP
NAME "mywms"
IMAGETYPE PNG24
EXTENT 1.732831 42.376795 4.842498 44.870497
SIZE 600 300
UNITS METERS
IMAGECOLOR 250 255 255
SHAPEPATH "/var/www/languedoc"
TRANSPARENT on
WEB
IMAGEPATH "/var/www/tmp"
IMAGEURL "tmp"
METADATA
### WMS
"wms_title" "WMS Demo Server"
"wms_onlineresource" "localhost/cgi-bin/mapserv?map=/var/www/tuto.map&"
"wms_srs" "epsg:4326"
"wms_format" "image/png"
### WFS
"wfs_title" "WFS Demo Server"
"wfs_onlineresource" "localhost/cgi-bin/mapserv?map=/var/www/tuto.map&?" ## Recommended
"wfs_srs" "epsg:4326" ## Recommended
END
END
PROJECTION
"init=epsg:4326"
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
TRANSPARENT ON
END
###### Layer 1 #######################
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE POLYGON
STATUS ON
DATA languedoc/buildings
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 1 ######
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE POLYGON
STATUS ON
DATA languedoc/natural
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 2 ######
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE Point
STATUS ON
DATA languedoc/places
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 2 ######
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE Line
STATUS ON
DATA languedoc/waterways
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 2 ######
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE Line
STATUS ON
DATA languedoc/railways
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 2 ######
LAYER
NAME Indonesie
STATUS ON
METADATA
### WMS
"wms_title" "Indonesie"
### WFS
"wfs_title" "Indonesie"
"gml_featureid" "NAME"
"gml_include_items" "all"
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
TYPE Line
STATUS ON
DATA languedoc/roads
CLASS
COLOR 217 217 217
OUTLINECOLOR 10 0 0
END
END###### END OF Layer 2 ######
END ###### END OF Map File ######Lorsque que je rentre l'url suivante dans mon navigatuer j'obtients la carte demandée.
http://qgis/cgi-bin/mapserv?map=/var/ww … =Indonesie
Le code html pour utiliser openlayers est le suivant:
Code:
<html>
<head>
<script src="OpenLayers.js" type="text/javascript"></script>
<script type="text/javascript">
function init() {
var map, ol_wms; // (1) instanciation du constructeur
map = new OpenLayers.Map('map');
// (2) Choix des couches
var ol_wms = new OpenLayers.Layer.WFS("mywms", "http://qgis/cgi-bin/mapserv?map=/var/www/tuto.map&", { layers: 'Indonesie', format: 'png');
// (3) ajout des couches a la carte
map.addLayers([ol_wms]);
//On zoom au max
//map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init();" >
<div id="map" style="width:400px;height:300px;border:1px solid black;"></div>
</body>
</html>C'est à ce moment que je bloque ![]()
Auriez-vous une petite idée ?
Merci
Hors ligne
#2 Thu 27 October 2011 12:19
- skwi6
- Juste Inscrit !
- Date d'inscription: 26 Oct 2011
- Messages: 2
Re: [OpenLayers + MapServer] Impossible d'afficher la carte avec openLayer
En revanche quand je rentre cette URL http://qgis/cgi-bin/mapserv?map=/var/ww … ,44.870497 j'obtiens l'erreur suivante :
Code:
<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd"> <ServiceException code="InvalidParameterValue" locator="typename"> msWFSGetFeature(): WFS server error. TYPENAME 'Indonesie' doesn't exist in this server. Please check the capabilities and reformulate your request. </ServiceException> </ServiceExceptionReport>
Dernière modification par skwi6 (Thu 27 October 2011 12:19)
Hors ligne
Pages: 1
- Sujet précédent - [OpenLayers + MapServer] Impossible d'afficher la carte avec openLayer - Sujet suivant


