Using MySQL and PHP with Google Maps
XML Reference:
<marker id="1"
title="ABC"
description="<img src="http://ift.tt/2p4RkK1">
<br/>description about 2nd point. <br/>
<a href="http://ift.tt/2oTVjgl">Read More</a>"
lat="-33.869843"
lng="-151.225769"
type="bar"
district="xyz" />
Infowindow supports my HTML, show my title with image and a link to my page:
downloadUrl('http://ift.tt/2p4Nm4e
/json/mapmarkers2.xml', function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName('marker');
Array.prototype.forEach.call(markers, function(markerElem) {
Portion to be edit
var id = markerElem.getAttribute('id'); var name = markerElem.getAttribute('name'); var details = markerElem.getAttribute('details'); var type = markerElem.getAttribute('type'); var point = new google.maps.LatLng( parseFloat(markerElem.getAttribute('lat')), parseFloat(markerElem.getAttribute('lng')));
Type markers are in different colours
var text = document.createElement('text');
text.textContent = address
infowincontent.appendChild(text);
var icon = customLabel[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
label: icon.label
});
marker.addListener('click', function() {
infoWindow.setContent(infowincontent);
infoWindow.open(map, marker);
Please help me to complete my assignment. Regards
Aucun commentaire:
Enregistrer un commentaire