var map; var selectControl, selectedFeature; //------------------------------------------------------------------------------------------------- function onPopupClose(evt) { selectControl.unselect(selectedFeature); } //------------------------------------------------------------------------------------------------- function onFeatureSelect(feature) { selectedFeature = feature; var text= "Brak ostrzeżeń."; popup = new OpenLayers.Popup.FramedCloud("chicken",feature.geometry.getBounds().getCenterLonLat(),null,"
"+text+"
", null, true, onPopupClose); feature.popup = popup; map.addPopup(popup); } //------------------------------------------------------------------------------------------------- function onFeatureUnselect(feature) { map.removePopup(feature.popup); feature.popup.destroy(); feature.popup = null; } //------------------------------------------------------------------------------------------------- function init() { map = new OpenLayers.Map("map"); var mapnik = new OpenLayers.Layer.OSM(); var fromProjection = new OpenLayers.Projection("EPSG:4326"); var toProjection = new OpenLayers.Projection("EPSG:900913"); var position = new OpenLayers.LonLat( 19.4118359375003,52.06827300198528).transform( fromProjection, toProjection); var zoom = 6; var epsg4326 = new OpenLayers.Projection("EPSG:4326"); map.addLayer(mapnik); map.setCenter(position, zoom ); map.addControl(new OpenLayers.Control.LayerSwitcher()); }