google maps - On click Data populate in info window of a polygon using GeoXMl3 -
i'm using geoxml3 parse multiple kml files @ time. i'm getting polygons plotted on map. when click on polygon info-window pops up. i'm not getting info-window coming requirement want edit content of info-window through java-script object
my java-script object
popupdetails = {'district-name':'content'}.
not getting how pass in parser
i have refered few links like:
https://code.google.com/p/geoxml3/wiki/usage
and how put data dynamically database in infowindow of polygon?
i'm parsing kml files way:
var mapprop = { center: new google.maps.latlng(51.508742,-0.120850), zoom: 5, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("googlemap"), mapprop); var parser = new geoxml3.parser({ map: map, processstyles: true, zoom: false, }); var infowindow = new google.maps.infowindow(); (i = 0; < listofpathsofkmlfiles.length; i++) { parser.parse([listofpathsofkmlfiles[i]]); }
advance help
i have figured out solution same.
you need overwrite createpolygon attribute of parser same.
var districtinfomap = {doc_url1:infowindow_content1, doc_url2:infowindow_content2 }; var parser = new geoxml3.parser({ createpolygon: mapdrawingtotype(), map: map, processstyles: true, zoom: false, singleinfowindow: true, }); mapdrawingtotype = function() { return function(placemark, doc) { var polygon = geoxml3.instances[geoxml3.instances.length-1].createpolygon(placemark, doc); if(polygon.infowindow) { polygon.infowindowoptions.content = districtinfomap[doc.baseurl]; } return polygon; }
}
here have made 1 object containing map of district url , window content have show.
this overwrite default behavior of how infowindow displayed , desired content want show displayed.
if still face issue please let me know.
Comments
Post a Comment