[OpenLayers-Users] icons displaced in kml layer
Christopher Schmidt
crschmidt at metacarta.com
Tue May 12 09:55:52 EDT 2009
On Tue, May 12, 2009 at 03:22:41PM +0200, Emilio López Pasamontes wrote:
> Thank´s Christopher, but
>
> What i do not understand then is why the ballon yes marks the exact point?
"Because it works differently." It uses a slower method of determining
the location to get it in line with the base layer, but that slowdown is
impractical when dealing with many locations.
-- Chris
>
>
> > -----Mensaje original-----
> > De: Christopher Schmidt [mailto:crschmidt at metacarta.com]
> > Enviado el: martes, 12 de mayo de 2009 14:49
> > Para: Emilio López Pasamontes
> > CC: users at openlayers.org
> > Asunto: Re: [OpenLayers-Users] icons displaced in kml layer
> >
> > On Tue, May 12, 2009 at 02:10:37PM +0200, Emilio López
> > Pasamontes wrote:
> > > 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.
> >
> > THis is probably
> > http://faq.openlayers.org/vector-related-questions/why-dont-my
> > -vector-features-work-over-google-yahoo-virtual-earth-etc/
> > .
> >
> > > 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) emiliol at jccm.es
> > >
> > >
> >
> >
> > > _______________________________________________
> > > Users mailing list
> > > Users at openlayers.org
> > > http://openlayers.org/mailman/listinfo/users
> >
> >
> > --
> > Christopher Schmidt
> > MetaCarta
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list