[Qgis-psc] Fw: qgis web migration to osgeo

Paolo Cavallini cavallini at faunalia.it
Mon Jun 9 07:33:54 PDT 2008


Otto Dassau ha scritto:
> Hi, 
> 
> I was on the "LinuxTag" Conference in Berlin the last days (also hold a 1h talk
> about QGIS :-)). I had a chance to talk to german OSM project members (Frederik
> Ramm and Jochen Topf). They don't intend to provide WMS services for free,
> because it would cause too much traffic on their servers, as they said, so they
> will offer WMS access for money via their company geofabrik.de.
> 
> Not interesting for us, I think, although it would be the easiest way to
> include the data. Anyway, I talked to other people as well and I am sure we
> find a solution for a nice usermap with OSM data, without paying for direct WMS
> access at the OSM project.

A possible use (thanks to Niccolo Rigacci):
     <title>OpenStreetMap</title>

     <!-- bring in the OpenLayers javascript library -->
     <!-- see: 
http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers-js.html 
-->
     <script src="http://openlayers.org/api/OpenLayers.js"></script>

     <!-- bring in the OpenStreetMap OpenLayers layers. -->
     <script 
src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>

     <script type="text/javascript">

         // JavaScript function to change overlay opacity.
         var map = null;
         var layerStrade = null;
         var maxOpacity = 0.9;
         var minOpacity = 0.1;
         function changeOpacity(byOpacity) {
             var newOpacity = 
(parseFloat(OpenLayers.Util.getElement('opacity').value) + 
byOpacity).toFixed(1);
             newOpacity = Math.min(maxOpacity,
                                   Math.max(minOpacity, newOpacity));
             OpenLayers.Util.getElement('opacity').value = newOpacity;
             layerStrade.setOpacity(newOpacity);
         }

         // Start position for the map.
         var lat=43.820735626
         var lon=11.132031754
         var zoom=15

         var map; //complex object of type OpenLayers.Map

         //Initialise the 'map' object
         function init() {

             map = new OpenLayers.Map ("map", {
                 controls:[
                     new OpenLayers.Control.Navigation(),
                     new OpenLayers.Control.PanZoomBar(),
		    new OpenLayers.Control.MousePosition(),
                     new OpenLayers.Control.Attribution(),
		    new OpenLayers.Control.Permalink(),
		    new OpenLayers.Control.Scale(),
		    // Currently there is a bug in the ScaleLine control :-(
		    //new OpenLayers.Control.ScaleLine(),
		    new OpenLayers.Control.LayerSwitcher() ],
		// See http://trac.openlayers.org/wiki/SphericalMercator
		projection: new OpenLayers.Projection("EPSG:900913"),
		units: "meters",
		maxResolution: 156543.0339,
		maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 
20037508.34, 20037508.34),
		displayProjection: new OpenLayers.Projection("EPSG:4326"),
		numZoomLevels: 18
	    });

             // Define the base map layers
             layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
             layerOsmarender = new 
OpenLayers.Layer.OSM.Osmarender("Osmarender");

             // Define the overlay.
             layerStrade = new OpenLayers.Layer.MapServer("Strade",
		"/cgi-bin/mapserv?map=/var/www/maps/openlayers.map",
		{format: 'image/png'},
		{isBaseLayer: false, opacity:0.6, transparent:true}
	    );

             map.addLayer(layerMapnik);
             map.addLayer(layerOsmarender);
             map.addLayer(layerStrade);

             var lonLat = new OpenLayers.LonLat(lon, lat).transform(new 
OpenLayers.Projection("EPSG:4326"), new 
OpenLayers.Projection("EPSG:900913"));
             map.setCenter (lonLat, zoom);
         }

     </script>

-- 
Paolo Cavallini, see: * http://www.faunalia.it/pc *



More information about the Qgis-psc mailing list