Google Map help

loudy

Member
Hello, I really need help.
I have a list of users:
Name - Age - Address - city - State - Postal Code

I have almost 400 records.

1)
What I'm trying to do is create a simple database that will export the data to build in google map.
so when I look at the map. I see where are the clients are.
so the map will group them and show their locations.
the idea is the same like Store Locations. but here are real clients.

Thanks,
 
We have a 'geocode' Scheduled Task plugin, which will process a list with address data, and use the Google Maps geocode API to look up and set the lat/lon coords for a map element in the list.

So ... I'm assuming you have created a Fabrik list from your data (either by creating the list directly from your client table, or with a CSV import). Add a 'googlemap' element to it.

Create a 'geocode' Scheduled task.

Set the various address fields appropriately.

In the options, you can specify when to geocode (if the map element is empty, or if is set to a specific default value, or always). You can also specify a "batch" size - Google rate limit the geocode API usage, and will block if you run too many queries in a short time. You should be OK doing 400, but you might want to set this down to something small while you test, like 10, until you are happy that the plugin is working. Then up it to 50, and if that works, up it to 100. Depending on your PHP and server setup, you may also find you run in to maximum script execution time issues if you set it too high, as the process of geocoding and updating the data takes a while.

You will also need to configure a Google Maps "API Key" in the global Fabrik options, if you haven't already done so. I think the geocode API will work without it, but the limits will be much lower, and you'd probably get locked out.

https://developers.google.com/maps/documentation/javascript/get-api-key

We then use that ey in all usage of Google maps (this geocode plugin, the googlemap element, and the googlemap viz).

Set the plugin to be "Unpublished", as you don't want it running on an actual scheduled basis. Instead, once you have set it up, save & close it, select it from the list, and hit the "Run" button.

You should get some feedback about how many records were updated.

You can also check the #__fabrik_log table for more feedback.

Once you have geocoded all your records, you can then set up a map visualization to display your locations.

-- hugh
 
Oh, forgot to say, I had to apply to fixes to the geocode plugin, as Google have made some changes to the API recently.

You'll need to do a full github update to pick up the working code. See my sig for details on doing that if you haven't done it before.

And you'll probably need to do a "Discover" in J!'s extension manager, and install the geocode plugin from there, if you haven't already installed it.

-- hugh
 
great thank you so much for all the advise.
so what I'm looking most to extract information from my table as the postal code stored is only 3 letters: for example:
in Canada each are set with 3 unique postal code: example:
T5J
N6B
G5E
... etct.

So in my list I have:
the postal code element as datajoing to the table that has the list of 3 letters of the postal codes.
Example:
Name - Age - Address - city - State - Postal Code
John Smith - 39 - 12 545 St. - Edmonton - AB - G5J

so what I really want do is: pull information from the list into google map and then I will see how many clients are living in the postal code start with: G5J in the map.

so basically, I want to use marker clustering to show the number of the client in the certain postal code.
examples:
S0u1o.jpg
S0u1o.jpg googlemaps2.png


Please help.
 
I think I got stuck, spent 5 hours to figure out that but I could not have it done.
I added the site under my sites.
so what I have is the following:
List: Postal Codes, that is datajoin with city list and datajoin with province.
the postal code is only the first characters, example:
Postal Code, city, province
T4J, Torotno, ON
T5U, Torotno, ON

.... etc.

then I created another list to count the clients:
Client name, postal code.
example:
client 1, T4J
client 2, T4J
client 3, T5U
.... etc
so there is 2 client who has the same postal codes: T4J.

so I installed the geocode plugin. also I added my Google map key to options. tried to follow your instructions, but I could not fine the button run:
Set the plugin to be "Unpublished", as you don't want it running on an actual scheduled basis. Instead, once you have set it up, save & close it, select it from thelist, and hit the "Run" button.

Please can you have alook and let me know how I can have this done.

Thank you so much
 
You hadn't enabled the geocode plugin after discovering / installing it, so it wasn't showing up in the list of available plugins.

I set it up for you, but set the batch limit to 10. So it processed the first 10 rows. Only one (the first) has a Post Code set, so it correctly located that. The other 9 just cenetered in the middle of Calgary.

I set it to "Always" process, so whenever you run it, it will re-encode everything, rather than ignoring any which already have a location set (or have the default location).

I think you have your default wrong on the map element. Calgary is at -114W, not 114.

You may want to change the zoom level in the geocode, from the default of 4, under Options.

The Run button is top left of the Scheduled Tasks screen. Select the geocode task, and press Run. You'll need to raise the batch limit (geocode options).

If you look at your Viz, you'll see you now have an extra pin in Calgary, for the first record that has the Post Code.

NOTE - for rows that geocode to the exact same lat/lon, you will only see one pin on the map. That's not a Fabrik thing, that's a Google maps thing. So for example, you'll see one pin in the center of Calgary, even though you have a lot of rows that have that exact lat/lon (the default). Also one pin somewhere in Mongolia (your incorrect 114 default), which is the hundreds of rows with the incorrect default.

This may or may not be a problem for you, as I don't know where you have multiple rows which are going to resolve to the exact same lat/lon.

-- hugh
 
Hello,
Thank you so much for helping in this, I'm very grateful for your help.

It works great, but I how I can achieve the following:

1)

The cluster is not working when you zoom in, as I'm tying to see how many people are in the same postal code area. now it shows only red icons. but there is no information for me to know how many peoples are there, which is the most target I'm looking to achieve, the main use of this is to look at google map and see how many clients in each postal code are.

no cluster.PNG

But if I zoom out, it show some clusters, but that is very small and we can not identify the area. and once we zoom in, the clusters disappears and the red icons shows with no information

far.PNG

I try to set the cluster zoom to 0 as well the map zoom to 0 but there is no effects.

Please help

2)

I noticed when I click on the red icons, a pop up shows with some codes:

class="btn fabrik_edit fabrik__rowlink btn-default" data-list="list_1_com_fabrik_1"
data-isajax="0"
data-rowid="6"
data-iscustom="0"
href="/index.php/map/form/1/6"
title="Edit">

issue.PNG
 
I set the zoom level to 20 in the clustering option in the googlemap viz, but still did not work.

zpppp,.PNG
 
It depends on the grid size if markers are clustered. If multiple markers are in one grid it will show a cluster marker instead of single ones (as long as your zoom level is lower than max. zoomlevel).
So set Max Zoom Level to 27 (I think this is the max) and play with the grid size.

Ah, and you won't get any cluster if the googlemap location is exactly the same. For identical locations you'll only get one marker containing the information of each record in the bubble template (e.g. in your screenshot the links to the records 7,8,9 with this location; seems something is going wrong with the edit link)
 
I noticed when I click on the red icons, a pop up shows with some codes:

class="btn fabrik_edit fabrik__rowlink btn-default" data-list="list_1_com_fabrik_1"
data-isajax="0"
data-rowid="6"
data-iscustom="0"
href="/index.php/map/form/1/6"
title="Edit">

 
Hi, I think all the popups in the map have the same issue:
class="btn fabrik_edit fabrik__rowlink btn-default" data-list="list_1_com_fabrik_1"
etc.

please see the following some snapshots:

2.PNG 9.PNG

Any idea why this message shows when I click on the map icon?
Thank you so much.
 
OK, the edit link issue is (kind of) fixed in github:

https://github.com/Fabrik/fabrik/commit/01e81a1d8024c240791ad520474fe216af8a6c95

The issue is really the "Convert newlines" option, which replaces newlines with BR tags. And because the edit and view links happen to be formatted with newlines, doing an nl2br() on them breaks them, by putting BR tags in the middle of an A tag.

That commit "fixes" things, by basically ignoring the "Convert newlines" setting if no custom bubble template content is provided and we are automatically inserting the edit/view link.

However, it's still going to be an issue if anyone manually uses {fabrik_edit_link} or {fabrik_view_link} as a placeholder, but then ... they'll just have to turn Convert newlines off and handle formatting themselves.

The only other fix would be to make the newline replacement more intelligent, and attempt to only replace newlines that aren't within tags, but that's a lot of trouble to go to.

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

Thank you.

Members online

Back
Top