Locations Plugin

Check the setting location users map limit. If it’s lower than the number of users who have added their location, the ones after the limit number will not be shown on the map.

5 Likes

That was it. Thanks. :smile:

2 Likes

Some of my users encounter a rate limit with the default provider (nominatim) that makes them wait one minute before trying again.

Weirdly, I don’t come across any kind of limit.

See: The location field in profile is kind of broken - Forum Feedback - Unicyclist.com

  1. Any idea why I don’t encounter any limit whereas some users encounter it? I tried writing long locations’ names while typing fast.
  2. What would be your second choice for the location_geocoding_provider setting (for a free usage)?
  3. What’s the location_geocoding_debounce setting?

I see that in nominatim’s usage policy that “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.”

There is no auto-completion in the location button on a new topic, but there is one in the custom user field:

image

image

chrome_tOtNSZ2dXy

  1. Is this a forbidden usage? :thinking:

Yes, and no. Mostly no. It can be against GDPR, if the location comes automatically without user’s action AND the site is driven by a company or community, meaning not a private person, AND it is not needed.

But… geo-location is really unaccurate. I don’t know how things are in France but in Finland all operators act countrywide so every time my IP changes, changes my location and everytime it points to wrong city.

And IP is not considered as personal data, but more or less as public data that cannot use to identify a single person.

But in use of the plugin geo-location isn’t forbidden, prohibited or unlegal, because an user wants to show it. And using IP as source of location is never unlegal.

There can be some more moral issues, though. But it depends of forum.

I may misunderstand how the plugin works actually. I’ll have to read all this topic. Thanks for your reply. :slight_smile:

You can only use Nominatim for testing. For production use I would recommend

2 Likes

Just following this up from last month, apologies, I’d somehow missed any notifications to replies :man_facepalming:

Our other site, which is displaying the larger text is using Leaflet v1.5.1

I see the Locations plugin was 1.3.4 and is now 1.7.1, which means the version isn’t an issue.

Agreed.

Just to remind people, the text is so small on our Locations map that it’s unreadable.

Example with screen shots here: Locations Plugin - #736 by Richie

Thanks Robert @merefield yes I do have access to the source of the other site where the text is larger but on the same basemap.

The difference I believe is that there is an additional parameter being passed:

tileSize: 512

It’s applied in this context:



// Attribution
var mbAttr = 'Map &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, Content &copy; <a href="https://GreyArro.ws/">Grey Arrows Drone Club</a>',
	mbUrl = 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token=<%=Variabs.GlobalVariables.strOpenStreetMapKey%>',
	mbMaxZoom = '20'
;


// Basemaps
var
	// Full list: https://gis.stackexchange.com/a/244797/145060
	// Full list: https://docs.mapbox.com/help/troubleshooting/migrate-legacy-static-tiles-api/#which-classic-styles-are-being-deprecated
	// Full list: https://docs.mapbox.com/api/maps/#mapbox-styles
	dark = L.tileLayer(mbUrl, { id: 'dark-v10', maxZoom: mbMaxZoom, attribution: mbAttr, tileSize: 512, zoomOffset: -1 }),
	road = L.tileLayer(mbUrl, { id: 'outdoors-v11', maxZoom: mbMaxZoom, attribution: mbAttr, tileSize: 512, zoomOffset: -1 }),
	satellite = L.tileLayer(mbUrl, { id: 'satellite-v9', maxZoom: mbMaxZoom, attribution: mbAttr, tileSize: 512, zoomOffset: -1 }),
	hybrid = L.tileLayer(mbUrl, { id: 'satellite-streets-v11', maxZoom: mbMaxZoom, attribution: mbAttr, tileSize: 512, zoomOffset: -1 })
;

Therefore, I think I have a feature request :slight_smile:

Please can we add a tileSize to the plugin settings?

Unless I can somehow pass the desired tilesize in the Map tile layer uri setting? :thinking:

Hello,

I noticed an issue with composer location button I think.
Discourse version a6abf8d07a

Thank you :slightly_smiling_face:

1 Like

Thanks @Don I can repro, although it doesn’t seem to stop the show, I’ll take a look v soon

2 Likes

It’s due to a breaking change from this commit in core: FIX: Use CSS transition to make room for composer (#16750) · discourse/discourse@9ea8a4a (github.com)

I’ve pushed a fix together with some minor formatting tweaks to improve the L&F:

4 Likes

Thank you Robert :slightly_smiling_face: I am really appreciate you fix this so quickly out of maintenance time. I will update soon and update this post as well how it works. :slightly_smiling_face:

Works fantastic thanks again! :slightly_smiling_face:

1 Like

Hi. Anyone know if it’s possible somehow to add a location to a map by dropping a pin with this plugin?

The locations of some communities are in places that are hard to identify without the use of coordinates, which might put some users off adding a location. Thanks!

2 Likes

I was sure someone requested this before but it’s not on the current list afaics.

Feature requests can be made here: Feature Request

But please note we are usually busy enough maintaining the plugins that new features are rare without someone sponsoring the work.

We would also welcome PRs. This is an especially good feature to add.

5 Likes

Hello,

I noticed an issue with location under topic title. If a user remove a previously added location from /preferences/profile
Then it will show an empty location under topic title instead of remove it.

Screenshot 2022-07-04 at 11.41.30

Thank you :slightly_smiling_face:

Hi!

I’ve modified list/topic-list-item.raw template to display the location on the topic list:

    {{#if topic.location}}
      <div class="title-location">
        {{d-icon 'map-marker-alt'}} {{location-format topic.location opts}}{{location-label-container}}
      </div>
    {{/if}}

But I think my condition isn’t properly written, because if I disable the plugin, the topic list loop breaks.

What would be the correct way to check if the topic location exists in the handlebars template?

1 Like

Overriding this seems a bit extreme, why not use connectors?:

topic-list-after-title OR
topic-list-before-category

Take a look at An interesting strategy for passing properties via raw template plugin outlets

2 Likes

Because I didn’t find the right ones (or maybe they didn’t exist at the time I modified the template, about 2 years ago) :sweat_smile:

Will probably be easier this way, I’ll give it a try, thanks!


Uh… Can’t achieve to use these connectors.

Boring stuff I've tried and looked at

I’ve read Developer’s guide to Discourse Themes.

Assuming this is how we add HTML code in a connector:

<script type="text/x-handlebars" data-template-name="/connectors/topic-above-post-stream/test">
  <div style="height: 200px; width: 200px;background: red"></div>
</script>

I tried

<script type="text/x-handlebars" data-template-name="/connectors/topic-list-after-title/test">
  <div style="height: 200px; width: 200px;background: red"></div>
</script>

But it didn’t work. Is that because topic-list-item is a .hbr and not a .hbs file?

I used Plugin outlet locations theme component but the outlets inside the topic list don’t show up.

I also looked at this What is the difference between raw.hbs handlerbar files and only .hbs handlerbar files?.

Or maybe I just need to create a theme component with an additional file, like this https://github.com/discourse/discourse-topic-thumbnails/blob/main/javascripts/discourse/connectors/topic-list-before-link/topic-thumbnail.hbr?

But here, new connectors are created, while topic-list-after-title and topic-list-before-category already exist… So I’m a bit puzzled here.

2 Likes

Maybe this helps?:

image

image

{{context.topic.location.street}}

or even better:

{{location-format context.topic.location}}

which leads to:

which you can then refine with CSS (eg move to new line).

2 Likes

Yup, perfect, thanks a lot Robert!

So, for those who are interested, this theme component simply adds the locations to the topic list.

3 Likes

Using the outlet is way more elegant, but there is an issue.

The outlet location is just after the topic title… And before the badges div (where it shows the dot indicating unread messages or new topics). The result:

image

I see no easy solution to fix this, even with CSS (I tried stuff).

I also feel that asking for a new outlet in #feature wouldn’t be interesting enough to be added to Discourse.


Edit: I made it so the badge is next to the location. That will do.

image

1 Like