Change KML file dynamically via javascript
-
Hi,
I’m looking for a solution to change / load a KML file dynamically via javascript.
I used to do it with Google Map and this simple code:function mapRedraw(idmap,url) { if(jQuery("body").data(idmap) != url) { var kml="/maps/" + url + "?v="+(new Date()).getTime(), f = new FlexibleMap(); f.dblclickZoom=false; f.scrollwheel=true; f.mapTypeControl=false; f.zoomControl = false; f.showKML(idmap, kml); jQuery("body").data(idmap,url); } } jQuery(window).ready(function() { jQuery(".map-link").click( function(e){ e.preventDefault(); var kml_link = jQuery(this).data("url"), kml_map = jQuery(this).data("map"), kml_type = jQuery(this).data("type"), kml_lang = "_" + jQuery(this).data("lang"); if(kml_type == undefined) kml_type="kml"; if(kml_lang == '_undefined') kml_lang="_en"; var link = kml_link + kml_lang + "." + kml_type; mapRedraw(kml_map,link); }); });
But I’m stuck with OSM :/
Any help appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Change KML file dynamically via javascript’ is closed to new replies.