OpenLayers: Add points to an OpenLayers map

Platform:OpenLayers
Task:Add points to an OpenLayers map
Discussion:
You need to add a custom point to an OpenLayers map.
Example:
    <script type="text/javascript">
        function init(){
            var map = new OpenLayers.Map( 'map' );
            
            var lyrOpenLayers = new OpenLayers.Layer.WMS( "Alaska","http://labs.metacarta.com/wms/vmap0",{layers: 'basic'} );
            map.addLayer(lyrOpenLayers);
            
            var lyrSites = new OpenLayers.Layer.Markers( "ARCN Study Sites" );
            var size = new OpenLayers.Size(8,8);
            var icon = new OpenLayers.Icon('icons/marker.png',size);
            lyrSites.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(-165,68),icon));
            lyrSites.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(-160,67),icon.clone()));
            map.addLayer(lyrSites);
            
            map.setCenter(new OpenLayers.LonLat(-155,65),4);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
        }
        


    </script>
Back to Index