HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


How to update ocUsermap to use Google maps API v3 in 3 easy steps.

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#72801 (In Topic #15262)
Avatar

Community saint

Following are the instructions and code needed to update ocUsermap so that it uses Google maps API v3 and Marker Clustering to group nearby member on the map together.

Here is an example of the updated ocUsermap in use:
Once you have this base, you can then customise to your hearts content by changing just the template. In keeping with my site's gaming theme, my map looks like this: OK. Now for the instructions.

Step 1:

In /sources_custom/blocks/main_google_map_users.php, replace the run() function with this:

Expand: New PHP Code New PHP Code

Step 2:

In BLOCK_MAIN_GOOGLE_MAP_USERS.tpl, replace {CONTENT} with this:

Expand: New template code New template code

Step 3:

Copy the following file to /data_custom/get_member_tooltip.php
Attachment
» Download: get_member_tooltip.php (3 Kb, 140 downloads so far)


That's all there is to it.

Enjoy!

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72802
Avatar

Hi,

Funnily enough I was asked to look at that clustering thing last night for an upcoming project. Would you like me to take this code and put it into a new version of the map block, and re-credit it to yourself?
I just need you to put out as public domain or BSD license for this.

Chris


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72806
Avatar

Community saint

Happy to make this public domain.

Putting it into a new map block would make it easier for some people to implement, so please go ahead.

I was originally considering doing that, but decided against it only because I knew you made a few changes to ocUsermap to fix custom profile field creation problems so did not want to mess with it. That, and the fact that I'm still using v7.01 which don't include your fixes yet.

Notes about the block assistant:

* API keys are no longer required (which I'm sure you were aware of) so you can remove references to it.
* When the centre check box is unchecked the initial map is displayed such that all clusters and markers are visible on the map. This may or may-not me noteworthy.
* Title description refers to time instead of title
* Inconsistent use of centre/center

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72807
Avatar

Thanks!


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72817
Avatar

Community saint

Thanks for your your effort temp. And for your contribution to the community.

@Chris - Great to see you incorporate this into the add-on. Winn-win for everybody.

Bob
Back to the top
 
Posted
Rating:
#72826
Avatar

Community saint

Thanks Temp for this awesome work!:thumbs:

Thank you Chris for incorporating it with the block!:)
Back to the top
 
Posted
Rating:
#72827
Avatar

Community saint

Jean said

Thanks Temp for this awesome work!:thumbs:

Thank you Chris for incorporating it with the block!:)
Yes, this is cool on both counts! I second Jean's comments


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#72833
Avatar

Community saint

This thread bookmarked in my 'Admin Notes' for when I may need to use it.

Good one, temp!

thanks

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#72840
Avatar

Community saint

I'm looking forward to the use of this also.

Fletch said

This thread bookmarked in my 'Admin Notes' for when I may need to use it.
Same here about 8 hours ago!  :thumbs:

Steve
Back to the top
 
Posted
Rating:
#72869
Avatar

Attachment


Consider this beta, but it seems to work perfectly on my tests (only tried Google Chrome though).

Changes
  • incorporates temp1024's code above, and his suggestions
  • user geolocation from within the block is still there (temp1024 stripped it;)) but it is controlled by a block option which explains it will ask the users permission if the option is enabled
  • Fixed missnamed block options: longfield/latfield renamed to longitude/latitude
  • API key code is still there but not advertised, just in case Google bring API keys back
  • temp1024's clustering is controlled by a block option
  • general code cleanups, meets our standard better, more user friendly
  • block parameter to filter results based on username
  • block parameter to filter results based on primary usergroup
  • better performance (no longer uses 1 query per user)
  • if no longitude/latitude is given for the default position it will geolocate the current user
  • new option for specifying the Google maps region code (defines how it looks for local expectations)
  • example code on how to give different usergroups different marker icons (commented out inside template)
  • example code on how to grab longitude/latitude of mouse clicks (useful for developers)



Last edit: by Chris Graham


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72872
Avatar

Community saint

thanks

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#72874
Avatar

Equivalent updates to ocdatamap.

Attachment


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72883
Avatar

Community saint

Thanks Chris, Nice improvements :thumbs: .

Chris Graham said

user geolocation from within the block is still there (temp1024 stripped it;))
I thought I did leave it in, what did I miss O_o ? The code in the template was untouched, and main_google_map_users.php could not know about any new location because they are only passed to set_coordinates.php.

Chris Graham said

Equivalent updates to ocdatamap.
I suspected that you would do that also.

EDIT: Just had a bit of a play and I can't get filters to work properly.

* For usergroup filter, tried "administrators" and "staff", neither of which worked.
* For term filter "testc6" works, but not "test*", but I note that it does not say that is supports ocFilter like the usergroup filter. Is it supposed to? If not why not?


Last edit: by temp1024

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72898
Avatar

The code in the template was untouched

'SET_COORD_URL' was not referenced in it. I'm not accusing you (;)), I think not having it is good for 50% of cases because of that browser permissions request it generates. Hence why I put it back but only as an option.

For usergroup filter, tried "administrators" and "staff", neither of which worked.

Numeric IDs.

For term filter "testc6" works, but not "test*", but I note that it does not say that is supports ocFilter like the usergroup filter. Is it supposed to? If not why not?

It's an SQL LIKE clause, but I think I also tied it to a substring, so you don't need the wildcards. If you do want wildcards, they have to be SQL ones: % and ?.
ocFilter doesn't do wildcard string searching, the operators provided in that are for ranges or subtree selection. However this isn't ocFilter because there are no "ranges"/"trees" as far as usernames are concerned.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72900
Avatar

Community saint

Chris Graham said

The code in the template was untouched

'SET_COORD_URL' was not referenced in it.
It wasn't referenced in my template changes, but it was in the rest of the template. My instructions were to only replace {CONTENT}, not the entire template.

I'm not accusing you (;))
And I'm not saying you can't read instructions ;).

Thanks for clarification on the filters :thumbs: .

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72901
Avatar

:lol: ok


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: