Hi
I'm trying to overlay polygons extracted form a kml file on a map but
it does not work. I've tested my kml file on google earth and it
works. I've also tested the file on googlemaps and it works like
that :
http://maps.google.com/maps?q=http://www.eliaz.fr/chantier/labo/plugi...
So i think i've got a problem with my code on my site here :
http://www.eliaz.fr/chantier/labo/spip.php?rubrique1
The code i use contains special things (#SET, #CHEMIN, ...) cause it's
in a plugin for a gpl cms (spip). This code creates markers on the map
by extracting datas from an xml file. I'd like to add some states line
to the map after thet is done but it doesn't work.
I'm not sure but i thnik maybe my problem is that i use GMarkerManager
and addOverlay in the same script...
Could anyone help me please ? Thanks
Here is the code i use :
<script type="text/javascript">
//<![CDATA[
URLbase = "#URL_SITE_SPIP/";
var map;
var markerManager;
<BOUCLE_centrado(GIS){id_article?}{id_rubrique ?}{0,1}>
#SET{latitude,#ENV{latit,#LAT}}
#SET{lonxitude,#ENV{lonxit,#LONX}}
</BOUCLE_centrado>
#SET{latitude,#ENV{latit,42.94}}
#SET{lonxitude,#ENV{lonxit,-8.228}}
<//B_centrado>
var geoXml = new GGeoXml("[(#CHEMIN{bzh.kml})]");
function load() {
if (GBrowserIsCompatible()) {
// facelo mapa
map = new GMap2(document.getElementById("map"));
map.addControl(new mapTypeControl());
map.addControl(new mapZoomControl());
map.addControl(new mapMoveControl());
map.setCenter(new GLatLng(#GET{latitude}, #GET{lonxitude}),
#ENV{zoom,7}, G_SATELLITE_MAP);
center = map.getCenter();
map.enableDoubleClickZoom();
map.enableContinuousZoom();
markerManager = new GMarkerManager(map);
map.addOverlay(geoXml);
//leemo-lo documento dos marcadores
$.get('[(#URL_PAGE{rss-gis})]', {[id_rubrique:(#ID_RUBRIQUE)]
[, id_mot:(#ID_MOT)][, id_auteur:(#ID_AUTEUR)][, recherche:
(#RECHERCHE)][, id_article:(#ID_ARTICLE)]}, function(xml){
//xml almacena en un objeto xml los datos recogidos del
documento leido
$("item", xml).each(function(item){
/*primero buscamos dentro del objeto xml almacenado en xml
todos los nodos "item", el contenido de cada nodo "item" del documento
xml
se almacena en la variable xmlItem (*en la variable item se
almacena la posicion del "item" actual en el array de items y asi
podemos
recorrerlos con facilidad)*/
var xmlItem = xml.documentElement.getElementsByTagName("item")
[item];
agregarMarcador(xmlItem, 0);
});
markerManager.refresh();
});
}
}
//]]>
</script>