If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

The above code creates a heatmap over Google Map. See their original documentation here :-

Code:

https://developers.google.com/maps/documentation/javascript/layers

There is documentation for the heatmap layer. In that, instead of merely adding Latitude and Longitude, there is option to add an intensity value too , the latter making the heatmap areas red where intensity is high and green where it is low...This can be given as shown below (like it is in documentation. The example is shown below) :-

As you can see from the first code, the heatmap generation is via client side through JavaScript. I want it to be more flexible and dynamic so that the Javascript values in the SECOND code that I posted can be imported from the XML data that I generated through MySQL. Is it possible?

Users who have thanked xelawho for this post:

yes, it's very possible. You make an ajax call to retrieve the xml file then iterate through the nodes, building your array.

google made a little tutorial that does more or less what you are trying to do - dunno if you have seen it. It's here

Yes, I have seen that already and tested it. It's working.

But here , I want to import XML data as a MVC array like the one shown in the first code. Then it can be easily made into a heatmap layer. I am new to the scripting of JavaScript and that is why I am confused...

I don't know if I'm getting the difference - you import your data via ajax, create the objects, push them onto an array and initialize it as an MVC array. That last bit's easy:

Code:

pointArray = new google.maps.MVCArray(taxiData);

what specifically are you getting confused about?

I am not confused about the script of the first code. The first code is just an example and as such it is not what I want.

I want an XML data generated by my PHP code to get incorporated into the array of 'taxidata' so that it offers me a much more dynamic choice.

Otherwise, I would have to type in the various Lat and Long positions myself in the JavaScript.

My XML output is of the form

Code:

<markers>
<marker> lat="",long="",intensity=""/>
</markers>

I want this 'lat', 'long','intensity' to be incorported into the first code (that is, instead of the example data of the taxidata array, I want my XML data to be part of it) so that it's more dynamic.

In that taxidata example, there is only the Lat and Long options. But Google documentation says that it's possible to include an additional variable of intensity in it too. That intensity value is there in my XML data.

You're not listening. hObj is just an object, and every time the loop iterates it gets overwritten. That's why you need to push it onto an array (inside the loop) and then pass the array to the heatMapLayer (outside the loop).