[OpenLayers-Users] Using POI popups

Marc Coevoet marcc at dommel.be
Thu Mar 31 06:06:27 EDT 2011


Hello,

I only built two openlayer apps,
http://lijnhaltes.tk  (bus stops in Flanders/North Belgfium)
and
http://www.dxradio.byethost14.com/research/radio/fmmaps/
FM transmitters in some coutroies around Germany.

I have this source code for Openlayers and would like to add a Close Box 
to the popups ...

%%%%%%%%%%%%%%%%%%%%%
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <style type="text/css">
#map {
         width: 100%;
         height: 100%;
         border: 0px;
         padding: 0px;
         position: absolute;
      }
body {
         border: 0px;
         margin: 0px;
         padding: 0px;
         height: 100%;
      }
     </style>
     <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
     <script 
src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
     <script type="text/javascript">
         <!--
         // complex map object
         var map;

         // Start position for the map (hardcoded here for simplicity,
         // but maybe you want to get from URL params)
         var lat = 50.89517;
         var lon = 2.7206;
         var zoom = 7;

         function init(){
             map = new OpenLayers.Map('map',
                     { maxExtent: new 
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                       numZoomLevels: 19,
                       maxResolution: 156543.0399,
                       units: 'm',
                       projection: new OpenLayers.Projection("EPSG:900913"),
                       displayProjection: new 
OpenLayers.Projection("EPSG:4326")
                     });

             var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");

             var layerTah = new 
OpenLayers.Layer.OSM.Osmarender("Tiles at Home");

             map.addLayers([layerMapnik,layerTah]);

             var pois = new OpenLayers.Layer.Text( "My Points",
                     { location:"./textfile.txt",
                       projection: map.displayProjection
                     });
             map.addLayer(pois);

             map.addControl(new OpenLayers.Control.LayerSwitcher());

             var lonLat = new OpenLayers.LonLat(lon, 
lat).transform(map.displayProjection,  map.projection);
             if (!map.getCenter()) map.setCenter (lonLat, zoom);
         }
         // -->
     </script>
   </head>
   <body onload="init()">
     <div id="map"></div>
   </body>
</html>
%%%%%%%%%%%%%%%%%%
-- 
What's on Shortwave guide: choose an hour, go!
http://shortwave.tk
700+ Radio Stations on SW http://swstations.tk
300+ languages on SW http://radiolanguages.tk


More information about the Users mailing list