Visual map of users

Is there a way to create something like an embedded Google Map with the location of users embedded into it, either on a one-off basis (ie: manually created/updated 1x/month) or dynamically on the fly?

We run a private community website so the only people who could see it are the people who are logged in and have access. I looked around and while there is a Location field that appears on the user cards, I don’t see anywhere it’s surfaced in a way that allows us to either generate a map so that people can find & connect with one another individually or search for people within a geographic area if they happen to be visiting that region of the world.

Anyone have any thoughts here? I know that generally speaking, for a publicly available site there would be privacy concerns but these are generally not applicable to our community. Thanks!

9 Likes

Why not use the data explorer plug-in? This data model will help.

You’ll also need to use a service to convert the text location into coordinates so they can be mapped.

Location is shown on user cards:

2 Likes

Thanks! That points me in the right direction. It will probably take a little while to figure out, but at least now I have a starting point.

2 Likes

Yes, it is - however you have screen shot the user’s profile page…

… this is a user card:

Also be aware that the Location field is a “free text” area, so it could say “The Moon, Outer-space” or “In my car”.

1 Like

I understand that. I’m well versed in the accuracy of user-entered data. :slight_smile:

3 Likes

hey @MikeTaber, I’m curious what came of this – I’d love to add something like this to my site and it could be great if you could share anything you’ve learned about this!

This is still on our TODO list to be honest. I’m the co-host of MicroConf and got too busy to keep going down this road with all the other things that were going on and this fell down on the priority list. It’s something we’ll come back to, but I don’t have an exact timeline for when we’ll be looking at it because there are too many other things in the air.

4 Likes

I was asked to do something like this today. A fairly easy way to do it is to create the map of users on a WordPress site with an exising map plugin, and then use a custom onebox to embed it on your forum. I wrote a couple of functions in WordPress to add markers and some basic user-info to a map when the user fills out a ‘location’ field on their WordPress profile. I copied a onebox plugin that @fefrei posted on here yesterday to embed the map on the a forum.

With some changes that are being added to the wp-discourse plugin by @iamntz, it will soon be possible to use Discourse as an SSO provider for a WordPress site. Using that, it could be possible to set something up where one WordPress site provides a service like this to a number of forums.

This particular map plugin is quite good. It can potentially provide a lot of information.

5 Likes

I recognize the shape of the title bar and border :wink:

This is looking awesome!
What’s up with the black bar at the bottom, though?

1 Like

would be great if it took details from the location field within Discourse - we use wordpress however only have the membership within Discourse rather than WP.

2 Likes

Yes, I think that will be able to be done with using Discourse as an SSO provider for WordPress. The only difficulty I can see in using a location that is supplied as a user custom field on Discourse would be if there was some ambiguity in the location. For example, ‘Paris, United States’ returns 10 possible geolocations (supplied by the Mapzen Search API.) I currently have things setup so that the top result is selected. It looks like this can be quite accurate if ‘city’, ‘state/province’, and ‘country’ fields are all supplied.

If the location was entered on the WordPress site instead of on Discourse, it would be easier to add some validation to ensure that the correct location was being selected. This could be done with a dropdown menu populated with the results returned by a geolocation service.

In terms of user experience, if Discourse is used as the SSO provider for the WordPress site, the user should be able to click on a link on the Discourse site (‘Add me to the map’) that will take them to a WordPress page (for example, a simplified WordPress profile page) where they can add their location and then return back to the forum.

4 Likes

It’s the bottom of a poorly designed iframe-page template.

2 Likes

This may be helpful as well:

4 Likes

I would like to have such a map.

I have never written a Discourse plugin, but what about this approach:

  • write a discourse plugin that creates a new route to access a geo file (either kmz or geojson). This plugin - the plugin would need to do already the conversion from location names to coordinates (a new data field could be introduced for each user that holds the coordinates and gets updated on each profile change)
  • The map could then be rendered on some website based on the geojson file and leafletjs.com, mapbox.com or alike.
  • In a next step, the leafletjs.com rendered map (mapbox.com is paid-only) could get its own page in discourse
1 Like

That would be a definitely good feature, I’m looking for it in the two communities I manage.

But Discourse being an open-source project, it would be great to use OpenStreetMap rather than Google! :wink: Just my two cents…

This is already a thing (well almost). See the Locations Plugin:

https://meta.discourse.org/t/locations-plugin/69742/181?u=merefield

Agree!

7 Likes