• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Googlemaps Visualisation Heat Maps

clivegarnham

New Member
Google Maps seem to allow 2 different ways to create heat maps: a JS API for client-side maps and Fusion Tables for server-generated heat maps. Is it possible it do either of these with the Fabrik Googlemaps visualisation? I want to show the greatest concentrations of a (large) number of locations, based on UK Postcode districts (i.e. the bit before the space).
 
Nope, not currently, although I'm always up for adding features to the map viz (I actually enjoy working on it, lol).

Is your heat map data directly related to a Fabrik 'googlemap' element? So the lat/lon data for the heat map is contained in the map element?

Do you need to display any actual map "pins", or just the heatmap?

I can't make any promises, but depending on the answers to those questions, I may have a look at adding heatmap as an option, next time I need some Coding Fun.

-- hugh
 
I couldn't resist. Turns out it was relatively easy to add heatmap as an option. Here's a snapshot of my "Cities in Rhode Island" map, as a heatmap:

heatmap.png

... and here's the commit:

https://github.com/Fabrik/fabrik/commit/64bf801c3a92bdbbfc6b68fa40c5437da15a17d2

So do a full github update, and make sure you clear your browser cache (to pick up changes to the Javascript). The new heatmap option is a radio button in the Options tab.

Of course, it'll only work if your data is in a googlemap element, same as if you were doing a normal map viz.

If you need to convert your dataset from separate lat/lon fields to a Fabrik googlemap field (which uses the format "(lat,lon):zoom"), it's not too difficult to add a map element) to your form, and then run a query by hand (in phpMyAdmin or whatever) to set the data, like ...

Code:
UPDATE yourtable SET mapfield = CONCAT('(', latfield, ',' lonfield . '):12');

Replace table and field names as appropriate, and change 12 to whatever you want the default zoom level to be (in form/details view, doesn't effect the map viz).

-- hugh
 
Another issue you may run in to with generating maps from very large datasets is slow loading. You can mitigate this by making sure the list you build the map from has only the absolutely essential elements published (id, map, and maybe the "Postcode" if you need to filter on that). This may mean copying the list, and in the copy, unpublish anything you don't need for the map viz, and build the viz on the copy.

You can also set the "Defer loading" option, so rather than building the dataset during page load (and thus having a long wait before the page even loads at all), the page and (empty) map load, with a "loading spinner", and the map loads via AJAX.

-- hugh
 
Hugh,

That's great, thank you so much. Its almost exactly what I want!!!

My data is organised so each row contains the postcode district, location, and a numeric weight or strength. Ideally I want the heat map to recognize the weight and show the heat of each location accordingly - the higher the number, the more heat that place has. I could denormalize the data (i.e. rather than 1 record with weight=3 I could have 3 records for the same postcode), but that would mean a table of ~250,000 records rather than 2,800. I'm pretty sure that the Google API can cope with this, so hopefully it shouldn't be too hard.

Thanks again,
Clive
 
The API usage isn't a problem, it's the backend stuff ... need to add YAFO (Yet Another Option) to designate the weighting element, add that data from the list into the marker structure that gets handed to the Javascript, and modify the Javascript to add that data to the structure that gets passed to the API.

I'll see if I have some "spare" time soon(ish).

-- hugh
 
Hugh,

Many thanks for your help with this, I guess you are still pretty busy at the moment. Is there any way I can help? Perhaps I could do some of the run-of-the-mill stuff for you? Adding another option can't be that hard, there must be other code in there that does something pretty similar, perhaps I could copy and change the necessary bits for you...?

Thanks,
Clive
 
OK, try this:

https://github.com/Fabrik/fabrik/commit/d09c7c0a6781991044a3e743a46b8ba500940698

Adding another option can't be that hard,

No, it's not hard - technically it's trivial. It's just time consuming adding and testing new options. And there's a very finite limit on the time I can invest in any given month for the cost of a sub. It's all too easy to get to the point where I could be earning more per hour wearing a paper hat and asking people if they want fries with that. :)

-- hugh
 
(as you can see from the time on my last two posts, it took 58 minutes ... so you can easily figure out my hourly rate on your sub this month, assuming you don't have any more issues I need to work on. I'm not trying to be an ass, just setting expectations of what a sub buys you)
 
@clivegarnham - did you ever test this?

The weighted heatmap seems to be working well for me.

-- hugh
Hi,

Yes, I've tried it, without much success. I thought it might be a problem with my data as initially it looked like my weighting factor was in a text field, but changing it to numeric made no difference. The maps it produces look like the weighting factor is 1 for every data item. I started looking through your code to see if I could work out what the problem was, rather than asking for more of your time. However, if it is working for you perhaps I could see your test data, and compare that to mine to see if I can work out what the problem is?

Thanks again for your time on this,

Clive
 
I'm using one of my standard map viz datasets, which is a list of US cities by state and ZIP. I've added a "weighting" field (and selected that in the map viz options as the weighting element) and just played around with changing the weightings by hand. I've filtered the list down to just zip codes in Providence, RI, which is a data set of 12 rows.

So here's all weightings set to 1:

View attachment 17100
View attachment 17101

Here's all weightings set to 10 (which I thought would look the same as all 1, but isn't):

View attachment 17102
View attachment 17103

And here's the 10's, but with one set to 20 and one set to 30:

View attachment 17104
View attachment 17105

-- hugh
 
So it's definitely working, but the weighting numbers don't exactly behave like you might expect (which is down to Google, obviously). You might want to play around with a small dataset and tweaking numbers by hand, to see what kind of effect to expect.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top