ElkArte Community

Extending Elk => Addons => Topic started by: Spuds on April 17, 2014, 07:00:39 pm

Title: [ADDON] Google Member Map
Post by: Spuds on April 17, 2014, 07:00:39 pm
This installs a member map to your website which allows your members to pin their location on a map. It uses Google Maps 3.0 API to generate the map and place the 'Push" pins.  Optionally uses pin clustering when you get to many pins on a map, clusters expand as you zoom in on an area.

Google Member Map V1.0.6

License
This Elkarte addon is released under a MPL V1.1 license, a copy of it with its provisions is included with the package.

Dependencies
The Google JavaScript Maps API V3 to create the map and place pins.  This API is available for any web site that is free to consumers. By enabling and using this addon you will be acknowledging and agreeing to the Google terms of use (http://"http://code.google.com/apis/maps/terms.html")

JSColor (http://jscolor.com/) project to select the pin color in the admin interface.  JSColor is by Jan Odv├írko and is released under the GNU Lesser General Public License. LGPL differs from GPL by allowing you to use JSColor even in non-(L)GPL applications.

Introduction
This installs a member map to your website which allows your members to pin their location on a map. It uses Google Maps 3.0 API to generate the map and place 'Push" pins.

Google Earth can also make use of the pin data. This mod allows for the exporting of user pin data in to a .kml file for those that want to use Google Earth to see their member locations.  Simply add a network link in Google Earth to point at http://www.example.com/forums/index.php?action=GoogleMap;sa=kml to get the data for Google Earth.  The capability to export .kml files is controlled by the permission to view the map, and keep in mind Google Earth will appear as a guest to your forum.

Features
o Adds a member map button to the main menu under the community dropdown
o Adds a member profile area for users to add their pin to their profile.  This will then appear on the map.
o Ability to search by location when placing their pin
o Adds Profile info bubbles to the map pins
o Ability to cluster pins together to improve map legibility.  Clusters will expand out as you zoom in on them

How to Use
In your admin panel you will need to enable it, which implies your acceptance of Google Maps terms of service.  Choose the settings that best work for your site.  There are many settings so you can fine tune the experience for your users and site.  Next, your members will need to edit their profiles and place a pin on the map to show their location and save their profile. That pin will then display on the main member map page. The admin will also need to set the map permissions so users can view the map as well as place a pin on the map.

Repo / Download
http://addons.elkarte.net/feature/Member-Map.html
Title: Re: [ADDON] Google Member Map
Post by: radu81 on June 23, 2014, 11:30:08 am
I am using Spuds's mod Google Member Map on SMF, I did not tryed this addon, but I would like to know if it is possible to import the data from SMF

thnks in advance
Title: Re: [ADDON] Google Member Map
Post by: Spuds on June 23, 2014, 02:53:19 pm
I'd have to write a quick import script to grab the data, but its the same db scheme so its doable.
Title: Re: [ADDON] Google Member Map
Post by: radu81 on November 17, 2014, 02:37:44 am
I just installed this addon on a fresh 1.0.1 elkarte, I activate the addon but I don't see any link in my menu. I tried index.php?action=googlemap but I see the index of my forum. Am I missing something? thank you

p.s. no errors in error log
Title: Re: [ADDON] Google Member Map
Post by: phantom on November 17, 2014, 06:17:50 pm
I just installed this addon on a fresh 1.0.1 elkarte, I activate the addon but I don't see any link in my menu.
I have "Member map" button under Community

I tried index.php?action=googlemap but I see the index of my forum. Am I missing something? thank you
Don't know if this is bug in action name, but mod is adding ?action=GoogleMap :)
Title: Re: [ADDON] Google Member Map
Post by: radu81 on November 17, 2014, 06:26:03 pm
 :-[ my fault, I didn't see it under comunity, I expected to find it near Community, and yes the correct link is the one you posted.It's working
Sorry  :-[
Title: Re: [ADDON] Google Member Map
Post by: radu81 on November 18, 2014, 12:15:49 am
I'd have to write a quick import script to grab the data, but its the same db scheme so its doable.
this would be nice to have for those who use the Smf mod ;)
Title: Re: [ADDON] Google Member Map
Post by: radu81 on November 21, 2014, 10:29:46 am
I had a look inside the tables of database and I sow there are 3 columns added to member table (longitude, latitude and pindate). The same columns are also in smf.

Assuming that both tables are on the same database which will be the sql command to insert the content of those three columns from smf_members to elkarte_members?

Thanks in advance
Title: Re: [ADDON] Google Member Map
Post by: Spuds on November 22, 2014, 01:06:46 am
First you must promise to backup your member tables.  Then assuming you have both databases on your server:

Code: [Select]
UPDATE newforum.elkarte_members
    INNER JOIN oldforum.smf_members
        ON oldforum.smf_members.email_address = newforum.elkarte_members.email_address
SET
newforum.elkarte_members.pindate = oldforum.smf_members.pindate,
newforum.elkarte_members.longitude = oldforum.smf_members.longitude,
newforum.elkarte_members.latitude = oldforum.smf_members.latitude

newforum = database name of the new forum, like elkarte_forum
oldforum = database name of the old forum, like smf_forum
smf_members = table name to copy from, as in old forum db_prefix_members
elkarte_members = table name to copy to, as in new forum db_prefix_members

I joined on email address since you can't depend on the member ID being the same across the two and email address should be unique.

Thats going to take a few seconds to run since its not optimal but should work.
Title: Re: [ADDON] Google Member Map
Post by: radu81 on November 22, 2014, 02:08:30 pm
That worked like a charm, thank you very much!

137 users were imported correctly ;)
Title: Re: [ADDON] Google Member Map
Post by: Spuds on November 22, 2014, 02:39:41 pm
Great, glad it worked for you :D
Title: Re: [ADDON] Google Member Map
Post by: radu81 on December 16, 2014, 12:38:00 am
in GoogleMap.english.php on second to last row
Code: [Select]
$txt['whoall_googlemap'] = 'Viewing the <a href="' . $scripturl . '?action=googlemap">Member Map</a>.';
should be
Code: [Select]
$txt['whoall_googlemap'] = 'Viewing the <a href="' . $scripturl . '?action=GoogleMap">Member Map</a>.';
GoogleMap
 ;)
Title: Re: [ADDON] Google Member Map
Post by: Spuds on December 16, 2014, 01:39:12 am
:D .... thanks will fix !

ETA: done and pushed, thanks again
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 05, 2015, 09:48:18 am
Installed the addon right now, but I am having three small problems:

1. $txt['googleMap_ButtonLocation'] is in language file but not in the settings.

2. The text from $txt['googleMap_DefaultZoom_Info'] is not shown when clicking on the question mark in the settings.

3. Why are there scroll lines? Because of my avatar?
Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 05, 2015, 10:28:04 am
3. Why are there scroll lines? Because of my avatar?

I've had the same problem, I don't remember which css file I changed, but try with Chrome inspector/ Firebug to change the size of that box
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 05, 2015, 10:35:17 am
Thanks!  :)

Btw: Whats the point of the legend? It seems there are no different pins described?

Oh, and the text of these two strings is not shown when clicking on the little help icon on the permission settings page:

permissionhelp_googleMap_place
permissionhelp_googleMap_view
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 05, 2015, 02:46:48 pm
Installed the addon right now, but I am having three small problems:
With my code, I'd call that a victory !
1. $txt['googleMap_ButtonLocation'] is in language file but not in the settings.
No longer used.  You used to be able to locate the button in different menu locations but now it just places it in community
2. The text from $txt['googleMap_DefaultZoom_Info'] is not shown when clicking on the question mark in the settings.
Where did you get the file from, the link in this thread or the addon site?  It works fine for me but I may have an old version in one of those download locations.
3. Why are there scroll lines? Because of my avatar?
Yes.  You will have to tweak the css to a size you like.  There are some oddities with how those infobox's are generated with the map API.
Btw: Whats the point of the legend? It seems there are no different pins described?
I think it will only be useful when you are using gender pins
Oh, and the text of these two strings is not shown when clicking on the little help icon on the permission settings page:

permissionhelp_googleMap_place
permissionhelp_googleMap_view
Thats a bug, I'll push a fix for that today

Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 06, 2015, 07:22:52 am
I used the download link in the first post:

https://bitbucket.org/spuds_/elk_membermap

Do you know which CSS file I have to edit to change the infobox in size? I tried some values in GoogleMap.css, but it didn't work. I think maybe .gmm_poster should be the right point, but there are no size values.  :o

And what is the difference between large 3D pan/zoom control, small 3D zoom control and best fit for viewport? I can't see any difference at my tests.  :-X
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 06, 2015, 04:14:09 pm
I updated the package file to fix a couple of the issues your reported:

1) missing text in the permissions help
2) who's online action hook was missing
3) tried to clean up the infobox avatar sizing code / css

So give that new package a try and see if it fixes the issues you were seeing.

The css for the popup box is a bit of a fight as the map API adds div's with inline styles to the base markup, so you kind of have to let it do its thing, can only fight it so much.  The update I just did seems to allow those boxes to behave better now.

Did not look at the zoom controls .. I think those will change based on the viewport size, but its could be that Google simply removed the option at some point, they really like to do things like that :P
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 06, 2015, 09:29:20 pm
Thank you very much! Can I use the link above and then simply overwrite the files on the server?
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 06, 2015, 10:05:22 pm
Since I added a hook, you need to uninstall and reinstall ... so uninstall, download the new package and install again.
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 07, 2015, 07:15:22 am
1) missing text in the permissions help
2) who's online action hook was missing
3) tried to clean up the infobox avatar sizing code / css

Thanks for the fix!  :)

1) and 3) are fixed. I can confirm that. Because of 2)... I saw yesterday that one of my users was listed at "looking at the KML export" (I use the german language so I don't know exactly what it's called right now) but these option is disabled in my board. Did you mean this?

Edit: I often saw this in the online list. Maybe this is when users edit their profile to set the pin in the map?
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 19, 2015, 08:18:25 am
Another small optical bug...
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 19, 2015, 02:45:21 pm
Thanks, tracked it ... looks like you are not using the legend so I'm going to guess I have a small layout issue in that area.
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 19, 2015, 03:37:43 pm
No legend and no "last edited or new entries are bold", right.
Title: Re: [ADDON] Google Member Map
Post by: Jorin on May 22, 2015, 07:40:31 am
Here's the german translation.
Title: Re: [ADDON] Google Member Map
Post by: Jorin on September 03, 2015, 02:03:28 pm
I don't see any pins anymore (using IE 11). Is it a bug? Can someone please have a look?

Here's the link to the map:

http://forum-alternative-antriebe.de/index.php?action=GoogleMap
Title: Re: [ADDON] Google Member Map
Post by: Spuds on September 03, 2015, 02:10:11 pm
Looks like only the cluster icons are showing up in IE11 ... I'll have a look and see whats needed to fix this.
Title: Re: [ADDON] Google Member Map
Post by: Spuds on September 03, 2015, 02:39:30 pm
Well the issue is ie11 blocks access to http://chart.apis.google.com/chart for some reason ... So we need to change all occurrences of that to http://chart.googleapis.com/chart

That involves editing two files ... GoogleMap.controller.php (in Controllers) and GoogleMap.template.php (in themes/default) ... do a search on 'apis.google' and replace it with 'googleapis'

I'll update the package later today as well
Title: Re: [ADDON] Google Member Map
Post by: Jorin on September 03, 2015, 02:55:44 pm
Thanks!  :)
Title: Re: [ADDON] Google Member Map
Post by: Jorin on September 03, 2015, 03:03:37 pm
I can confirm these changes are working!
Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 30, 2016, 02:04:59 am
I just installed the new version 1.0.2 and all seems to work fine ;)
Title: Re: [ADDON] Google Member Map
Post by: radu81 on August 17, 2017, 05:34:47 pm
I have some errors in Elkarte log, I use the 1.0.3 version of this addon


EDIT: forgot to insert the API key into ACP > Configuration > Add-on Settings > Member Map. No more errors now ;)
Title: Re: [ADDON] Google Member Map
Post by: Spuds on August 18, 2017, 12:28:31 am
I should make it log a more useful error ... but yeah Google began to require a key to use their map API.  Old sites received a no API grandfather for some period of time as well but I'd guess that is all past by now.  Anyway glad you got it sorted.
Title: Re: [ADDON] Google Member Map
Post by: radu81 on September 14, 2017, 11:59:22 am
This addons installs and seems to work fine on 1.1 RC2, but generates errors in elkarte log:

Type of error: Undefined
Notice: Undefined index: gender
http: ... /index.php?action=GoogleMap;sa=xml
File: ... /sources/controllers/GoogleMap.controller.php
Line: 657

Type of error: Undefined
Undefined index: image_href
http: ... /index.php?action=GoogleMap;sa=xml
File: ... /sources/controllers/GoogleMap.controller.php
Line: 556
Title: Re: [ADDON] Google Member Map
Post by: Spuds on September 15, 2017, 02:50:44 am
Replace GoogleMap.controller.php with the version attached ... it should clean up those 1.1 issues but want to make sure there are no more before I update the package.
Title: Re: [ADDON] Google Member Map
Post by: radu81 on September 15, 2017, 08:21:21 am
Thank you Spuds, no more errors in Elk log ;)
Title: Re: [ADDON] Google Member Map
Post by: Spuds on November 26, 2017, 11:31:14 pm
Updated package to support ElkArte 1.1
Title: Re: [ADDON] Google Member Map
Post by: badmonkey on December 11, 2017, 04:29:00 pm
Thanks for updating. FYI, uninstalling for purposes of upgrading removed all previous map settings, including the API key. This happened on both sites. If you upgrade, be sure to copy your map settings for reeentry.  ;)
Title: Re: [ADDON] Google Member Map
Post by: Jorin on December 12, 2017, 10:46:11 am
Aw, thanks!
Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 03, 2018, 02:37:25 pm
using elkarte 1.1.3 on php 7.2.5 I get some errors in elkarte log:
Unknown Error: Function create_function() is deprecated
index.php?action=profile;area=theme;u=1
File: sources/GoogleMapIntegration.php
Line 92
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 06, 2018, 03:57:01 pm
Yeah ... create function notices  :P

Here is an X updated file that should fix those errors ....

Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 06, 2018, 08:56:49 pm
Thank you Spuds, no more errors from this addon ;)
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 04, 2021, 09:18:40 pm
Well I have not updated this in some time, which is good since it still works with a couple of small issues.   The primary issue is that Google depreciated their chart API and that is what the addon utilized to create the map pins, specifically the icon and text pins, so what most often is shown is simply the default Google Maps pin regardless of what you have selected.

I did find an API call to a different address that works, for how long who knows, so if you want that style pin get the V1.0.5 release
Google Member Map V1.0.5 Release

Since we can't depend on that to work forever I also release a V1.0.6
Google Member Map V1.0.6 Release

https://addons.elkarte.net/feature/Member-Map.html
https://github.com/Spuds/Elk-Google-Member-Map/releases

Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 05, 2021, 08:55:08 am
just a small typo to correct:
The Google JavaScript Maps API V3 is a free service, available for any web site that is free to consumers. By enabling and using this SMF modification you are acknowledging and agreeing to the Google terms of use
Title: Re: [ADDON] Google Member Map
Post by: Spuds on May 05, 2021, 02:37:42 pm
LOL ... shows how long ago I wrote version 1.0!   Actually I'm not seeing that, is that possibly in your translation file?
Title: Re: [ADDON] Google Member Map
Post by: radu81 on May 05, 2021, 03:23:36 pm
Sorry, my mistake, my translation is very old and not fully translated