OpenLayers est un mapping framework conforme OGC (Open Geospatial Consortium). Ce dernier a pour objectif de définir des standards favorisant l'intéropérabilité des systèmes d'informations géographiques. L'idée de ce tutoriel est d'apprendre à utiliser OpenLayers tout en comprenant la logique d'intéropérabilité par les standards.
Ce cours s'appuie sur les documents suivants :
Pour la bonne marche du tutoriel, voici les ressources disponibles :
Le tutoriel offre des exemples que vous êtes amenés à manipuler. Il sont déjà déployés et disponibles ici : http://ogo.heig-vd.ch/ologctuto
Même si vous pouvez les déployer sur votre serveur web, nous allons utiliser la VM OGO Live comme serveur d'applications géographique/cartographique (GeoServer) et comme serveur web (Apache) pour servir les applications web du tutoriel.
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> span { font-weight: bold; } #map img { width: 800; height: 400; position: absolute; top: 50; } </style> <script type="text/javascript" src="js/jquery-1.5.1.js"></script> <script type="text/javascript"> var ctrx, ctry, x, y; $(document).ready(function(){ // Put some code here ... }); </script> </head> <body> <p> PAN: <span id="eastBtn">East</span> - <span id="northBtn">North</span> - <span id="westBtn">West</span> - <span id="southBtn">South</span> | ZOOM: <span id="zinBtn">In</span> - <span id="zoutBtn">Out</span> </p> <div id="map"> <img id="layer1" src="http://spin3d.com/Combo.jpg" alt="Put a map here ..."> </div> </body> </html>
<DescribeFeatureType version="1.1.0" service="WFS" xmlns="http://www.opengis.net/wfs" xmlns:ogo="http://geosysin.iict.ch/ogo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <TypeName>ogo:cities</TypeName> </DescribeFeatureType>
<wfs:GetFeature service="WFS" version="1.1.0" xmlns:ogo="http://geosysin.iict.ch/ogo" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> <wfs:Query typeName="ogo:cities"> <wfs:PropertyName>ogo:wup_capit</wfs:PropertyName> <wfs:PropertyName>ogo:capit_1_0</wfs:PropertyName> </wfs:Query> </wfs:GetFeature>