Locations Plugin

(Angus McLeod) #101

Marker clustering is handled by the marker cluster plugin for leaflet. Have a look at the options they allow and tell me which ones you think would help. I would only want to add a few key options; not all of them. Their docs link to various useful demos for most options.

The only option this plugin uses atm is spiderfyDistanceMultiplier which is set to 6, as topic titles in marker labels can take up a fair bit of space.

This one will be relatively instance-subjective. I’ve added a class to tooltips which you can use.

I think you’ll want something like:

div.topic-title-map-tooltip {
  white-space: normal;
  width: 100px;


I got an odd issue for you. I switched mapping provider from Mapzen to Mapquest about an hour ago. Since then, sometimes the mapping is done through Mapquest, sometimes is through Mapzen. tried clearing out the browser cache and switched browser to no avail.

I’ve attached a video. The first split second shows Mapquest, while later in the video its Mapzen, all in one address input.

Also, perhaps because of the switching of providers? the individual location doesn’t seem to show properly:

But the overall map looks fine.

(Angus McLeod) #103

This one’s a bug. I fixed it a few days ago. Update to the latest and you should be fine here.

What’s your location geocoding timeout set at? You seem to be getting a lot of error messages. Maybe timeout related.

I can repro the provider issue. I’m looking into that now.


Its set at 3.

I was thinking originally about restarting the server tonight to see if the provider issue goes away.

(Angus McLeod) #105

Provider issue

This is a bit of a head scratcher. tl;dr: it will behave as you expect now.

Longer explanation:

Initially I thought it might be related to the caching of results, i.e. the address was previously searched with the old provider, the results were cached (as they should be), and then when that same address was searched again the cached result from the old provider was used. But I don’t think this is it, the switching of providers seems unrelated to whether or not the results are cached.

It seems to be that old config still lingers around in the Geocoder class (from the gem) after it’s been set to new values. It could be an issue with the gem itself. It could also be a ‘feature’ of the gem, but I haven’t found anything relevant in the docs or github issues.

Also, this issue only presents itself in production environments. I can only repro it on my sandbox, not locally.

In the meantime, I’ve forced each lookup to use the provider set in settings. So you will see results from the provider you’ve set, as expected.

Frequent errors issue.

This was also an issue of gem <> plugin interaction (not a timeout issue). The gem throws an error whenever the response it gets from the geocoder api is not parseable json, e.g. when there are no results. I’ve precluded this error from being passed through to the client, to prevent it from appearing unnecessarily.

Other changes

  1. I’ve added a loading spinner for when locations are being retrived

  2. I’ve cleaned up the auto-complete style so that the dropdown is flush with the input.

  3. I’ve added a “No results” message for when no results are found


Thanks Angus! I will update the plugin and try!


I just updated the plugin an hour ago. Curiously, no matter what address I entered (e.g. 10 Downing), and what provider I used (Mapzen, Mapquest) it still says No results. Do others have the same issue, or is it just me?

(Angus McLeod) #108

No I’m not seeing that (e.g. try creating an event with a location on my sandbox).

Are there any console messages?

Link me to where you’ve deployed it and I’ll take a look.


Odd, works just fine on your sandbox.

On my site- I am not very adept in reading console error messages, but it doesn’t seem like they are related to the plugin.

Its here:

(Angus McLeod) #110

Well there was an issue with rate limiting. It was hardcoded to 6 requests per minute, which you hit pretty quickly if you’re searching around for an address (also the rate limit error message wasn’t showing properly). That was happening to me a fair bit on your site. I’ve added a setting for rate limiting which you can increase if your users are seeing an error like this too frequently.

42 PM

As to the main issue of no results showing up, I’m not seeing any relevant errors. PM me your geocoding api config and the contents of https://www.hungryonion.org/logs. Also check your accounts on mapzen and mapquest. Are they registering requests?

(Quim Gil) #111

I was wondering how to make the best use of location information in a WordPress-Discourse integration setup.

Imagine that the location information would be introduced in new WordPress entries (probably using a plugin) and then the generated Discourse topics would inherit it. Other combinations would be technically possible.

(Angus McLeod) #112

If I’m right in reading the question here being as whether it is possible to pass location information from Wordpress to a Discourse topic, then the answer is yes!

You can add location information to any discourse topic, by passing a location object as a topic param, the paradigm case being creating a topic via the API. See further:

I can give you more specific advice if you flesh out what you’re trying to do a bit more.


Hi Angus,

I pm you the setting. As for the log, I tested the plugin. I went back to the log, no log was captured in the few minutes I tested the plugin. I checked Mapquest, there hasn’t been any request to them. Doesn’t look like its an issue with the settings either. So I am planning to rebuild without the plugin later this week, and then rebuild with the plugin and see if it fixes matters.

(Chris Beach) #114

@angus, FYI, Mapzen is shutting down:

(Angus McLeod) #115

Yes it seems so :frowning:

I will be removing Mapzen as a supported provider from this plugin on Wednesday, 10th Jan.

If you are using Mapzen, please switch to an alternative provider:

@jomaxro Could you wikify the first post so I can edit it? Thanks.

(Joshua Rosenfeld) #116

Looks like Matt beat me to it.


The acceptable usage policy for Nominatim strictly forbids Auto-complete search:

This is not yet supported by Nominatim and you must not implement such a service on the client side using the API.

It’s part of the forbidden uses of the service that will get your application banned. Maybe it would be interesting to figure out a way to serve our own Nominatim in a sustainable way… My first option would be to have the service sponsored as part of a larger cartographic effort, and then provide limited access to certain domains that would cover the costs in bandwidth. Having such a server hosted in the EU would probably help keep the costs down. Are there some OSM people here who would be interested in working this out so that Discourse users could as well integrate more closely with OSM?


The location map zoom value doesn’t seem to have any effect on my map zoom level. Is anyone else having this issue?

(Angus McLeod) #119

Thanks for reminding me / us about this, it’s an important point.

Keep in mind that this plugin:

  1. Uses a widely used ruby gem, which supports its use(s) of Nominatim.

  2. You can control the geocoding rate limit using the setting location geocoding rate limit. I just added another setting that lets you control the search debounce on the client: location geocoding debounce

  3. Has 2 different types of search. One could be described as “Auto-complete” (depending on the other settings you’re using). The other - “input fields” alongside a “Find Address” button - is definitely not Auto-complete.

I am currently using nominatim in developing and staging environments with the second type of search - input fields with a button - in various ways (e.g. in a Custom Wizard form).

But yes, you shouldn’t be using Nominatim (with either type of search) for medium or heavy production use, which is what their policy is concerned with. You can see what they have in mind with “Auto-complete” by their top line usage requirement:

No heavy uses (an absolute maximum of 1 request per second).

Generally speaking, as mentioned in the OP, particularly if you are using this in production, it is important that you review the T&Cs of any geocoding service you’re using and assess them according to your own circumstances. Complying with the T&Cs of a service you’re using is your responsibility.

Could you give me some more details? What zoom setting are you using? Which map is it (mini-map or topic list map)?


Have you tried OpenCageData? They seem to do basically what you’re suggesting and are already supported by this plugin.


Here are my map settings:

The only plugins installed are event and locations. You can see that the settings shown above do not propagate whether I enter “2” or “92” (the expanded view remains on the default zoom as well). Any suggestions on how I can further investigate?

Also, I’ve noticed that when I am selecting an address, the location list doesn’t disappear after making a selection: