Hi, i`m using google and kml layer, The problem is that the icons that uses the kml to refer the placemark are displaced in the coordinates upwards. However, the ballon mark well the point. Anyone can help me.
Best Regards and sorry for my english
function init(){
var options = {
controls: []
};
var map = new OpenLayers.Map('map', options);
map.projection= new OpenLayers.Projection("EPSG:4326");
map.maxExtent = new
OpenLayers.Bounds(-5.84473,38.11727,-0.40649,41.36032);
map.minScale=4000000;
map.maxScale=3000;
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets"
// the default
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP}
);
var pruebaKml = new OpenLayers.Layer.GML("Equipamientos",
"http://prej2ee.cit.jclm.es/CatalogoTIC/kml/<?= $_GET['fichkml'];?>", {
projection: map.projection,
format: OpenLayers.Format.KML,
formatOptions: {
extractStyles: true,
extractAttributes: true
}
});
pruebaKml.displayInLayerSwitcher=false;
map.addLayer(pruebaKml);
map.addLayers([gphy, gmap, ghyb, gsat]);
var selectControl = new
OpenLayers.Control.SelectFeature(pruebaKml,
{onSelect: onFeatureSelect, onUnselect:
onFeatureUnselect});
map.addControl(selectControl);
selectControl.activate();
var nav = new OpenLayers.Control.NavigationHistory();
map.addControl(nav);
var navegacion = new OpenLayers.Control.NavToolbar();
var barraZoom = new OpenLayers.Control.PanZoomBar();
var posicionPuntero = new OpenLayers.Control.MousePosition();
var escalaNumero = new OpenLayers.Control.Scale();
var escalaLinea = new OpenLayers.Control.ScaleLine();
var panel = new OpenLayers.Control.Panel({defaultControl:
navegacion});
panel.addControls([nav.next, nav.previous]);
panel.addControls([posicionPuntero]);
panel.addControls(escalaNumero);
panel.addControls(escalaLinea);
panel.addControls(navegacion);
panel.addControls(barraZoom);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(panel);
//**************************************************************************
**********
/* var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
// this Handler.Box will intercept the
shift-mousedown
// before Control.MouseDefault gets to see it
this.box = new OpenLayers.Handler.Box( control,
{"done": this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
},
notice: function (bounds) {
OpenLayers.Console.userError(bounds);
}
});
map.addControl(control); */
//***************************************************************
// map.setCenter(new OpenLayers.LonLat(-3, 39), 9); //Centrar
el mapa
map.zoomToMaxExtent();
function onFeatureSelect(feature) {
selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(100,100),
"<h2>"+feature.attributes.name +
"</h2>" + feature.attributes.description,
null, true, onPopupClose);
feature.popup = popup;
map.addPopup(popup);
}
function onPopupClose(evt) {
selectControl.unselect(selectedFeature);
}
function onFeatureUnselect(feature) {
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
}
}
</script>
</head>
<body onload="init()">
<!-- <div id="paneldiv" title="paneldiv" class="olControlNavToolbar"></div>
-->
<div id="map" class title="map"></div>
</body>
__________________________________
Emilio López Pasamontes
Dep. Desarrollo. Serv. Informática
Consej. Industria, Energía y M.A. (JCCM)
[email protected]
equipamientos_kml.kml
Description: application/vnd.google-earth.kml
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
