Locations Plugin


(Anton) #41

Feature requests from @meglio

Hi @angus, great work! Many thanks for sharing this plugin with us.

Now that you have lots of experience extracting images from posts and making generating thumbnails, here is an idea for you to consider to considerably improve the map and make it much more customizable and server many different cases:

This map is a custom-programmed PHP script using Google Maps, which extracts all the information from a particular category. Read more in Discourse and Google Maps

Once the “N photos” link is clicked (see explanations in the previous screenshot), a simple JS gallery is shown with all the photos (photo URLs extracted right from the topic posts:


(Anton) #42

Translation to Russian


(Angus McLeod) #43

Hey Stephan. I have experimented with adding map layers and location markers from files, as Leaflet supports GeoJSON out of the box. It seems Mapbox maintains a decent looking Leaflet plugin that makes to easy to add KML files to a leaflet map.

Could you describe the use case and UX you have in mind in a bit more detail?

@meglio Yes, your customization is interesting :slight_smile: Just to clarify:

  • You have one map marker for each goat seller?
  • The location details of each seller are currently stored in an external database?
  • The details on each marker are:
    • Seller details. These are currently stored in an external database.
    • Goat details (description + photos). These are stored in Discourse (associated with posts).

The minimum work needed to support your use case is topic preview and profile preview support on custom leaflet markers. Either making Topic List Previews interoperable, or importing the relevant logic. The initial version of this would work like the TLP plugin, but just on markers on the topic list map in this plugin. There was already some argument for supporting multiple images in the TLP plugin, so, ideally, that aspect of the feature would fall naturally under TLP development.

Strictly speaking, for your use case it wouldn’t be necessary to support user locations, i.e. allowing the user to enter their location in their profile and then automatically associating that location with a post they make. The same result could be achieved just by the user adding their location using the existing plugin feature set whenever they post an advert for a goat.

That said, there was already an argument for supporting user locations in this plugin. The way it would work would be something like:

  1. User enters their location in their profile. Rather than the current plain text field, there would be a geo location input that automatically geocodes the location, like in the ‘Add Location’ modal in this plugin.

  2. If the user has entered their location in their profile, there is an option to automatically add their location to a post they make, either by a checkbox in the composer, or as a category setting.

So, the way I see this is there are some incremental improvements that can be made to TLP and this plugin, which would allow your use case to be supported.

For your particular case, there would be an issue of migrating the data. You already have a number of existing posts, and you currently have all seller data stored in an external db. For the existing posts that are currently active, you could just ask the Sellers to edit their post to add a location. As for the seller data in the external db, I imagine you probably use that data for other purposes as well. If you wanted to maintain that separately, you would probably need to amend your current setup so the seller details are kept in sync with their details in Discourse.


(Anton) #44

Well, I actually have 2 maps. Our setup is a bit complicated.

One map is with goat keepers. They make a single topic for their farms, which they keep up to date. One marker is put on the map for every topic.

Another map is made from advertising topics, each selling a goat (or a few of them). For this map, we still put one marker for each goat keeper, but enrich the popup windows with all their listings (we detect it by the author user of the ads topic).

This scenario is pretty complicated and will require a lot of effort to implement. However, what I’m proposing is to grab some ideas from what we did and made them features of your plugin. I can see a lot of applications. For instance, we have another category “Farmer products”. It is not as popular yet, but we are developing it. A map would greatly help for people to find nearest farms that sell organic food. I installed the plugin actually and started to ask people for their addresses. However, as is it is very non-informative: you have to click on a marker every time you want to see the details of the advertising. Hence the proposals above to make the map more informative.

Yes, that’s because we didn’t have your plugin, and anyway we needed to implement complex logic and many additional fields. The database of sellers is used in various sub-projects, so we made it a separate piece, out of the Discourse installation. Still, there are categories on our forum for which I’d like to introduce simpler maps with using your plugin.

Yes, but, again, that’s our complicated case. What I outlined in my screenshots above is simpler - one topic = one marker. To start with. Still, I’m pretty sure maps have many applications, so the more features you can make, the more scenarios can be covered by the plugin.

Okay, to make it clear, we wouldn’t switch to use your plugin for our use-case, because there is lots of complicated logic going on. One thing to take into account though is that I’d use topic locations for advertising listings, not user profile location. Restricting the usage to user profile location for all topics in all categories would limit use-cases covered by the plugin.

Re Topic List Previews, somehow, I still can’t use it — it changes the UI of the parts it should not, so every time I try it, I end up turning it off.


(Angus McLeod) #45

I see. As you say, adding richer topic previews to map markers would benefit most users. I’ll add that to my task list for this plugin.


(Stephan Eich) #46

Thanks, for your question.
I am thinking to import these kind of collectetd data, it is a database in kmz with location of modelairfields around the world.
These places are created in google earth and exported to kmz with the long and Lat and additional text for the name of the airfield.
And in finals case the places are shown with a flag, the discourse user could open the flg and add some personal experience, … .


and the descripion/Beschreibung could be a link to the website or something else.
here a downloadlink: USA « ArnoBertz.de


(Angus McLeod) #47

I see. It sounds like you want to create a new topic for every location in your kmz file and add the relevant location data so that the topic appears on the map. Is that right?

This would be a migration / init script of sorts which is a bit out of the scope of the plugin. For such a migration script to work you would need to also need content for the first post in each topic.

From a user experience perspective I think it would probably make more sense for you to select the 5 most popular model air fields and just create topics for each of them yourself using this plugin. Then you could see whether this approach works with Discourse and you could give the first post in each topic more of a personal touch. You could also let your users post new airfields they are using.

Otherwise you’ll have lots of empty topics in your forum which could be a bit strange.


(Anton) #48

Feature request - Address Localization

Would it be possible to make some “default” language, which will be used as an API parameter when carrying geocoding through geocoder API?

For instance, all addresses in our community are in Russian. It does locate an address in our language, however, it displays it in English:

So, at the end it should work like this:

  • user enters their per-topic address in Russian
  • the geocoding API finds the address and prefers Russian when displaying a dropdown list with found options to choose from
  • the address is saved in Russian and is show in Russian under the topic title

(Anton) #49

Feature request - location marker in topic lists

The same way we have a marker for closed, archived, deleted and private topics (PMs), can we add a Location marker, so that one can visually distinguish which topics have location assigned to them?

If you ask me, I’d make it a per-category setting (not a global setting).


Feature request - default per-category zoom level for Popup Map


(Anton) #50

Feature request - pick location on a map directly, on your own

Sometimes, the location address can’t be found. This is especially true for villages in countries like Ukraine.

Would it be possible to allow users to pick their location on a map, and then coordinates will be shown?

What is important here, is that the address returned by geocoding for those coordinates still is important. So for example if a village can be found, but not the avenue, then save coordinates (lat/lon) and save the Country + Village information, so that it can still be displayed under the topic title (rather than displaying just lat/lon numbers).

Does it make any sense?


(Stephan Eich) #51

Oh thanks for that idea of sorting.
If it will imported with the airfield name in the topic it is enough an they will find it by search.
And the other way all flags are shown in one map and after click. It will open for discuss about this point of interesed.
If think that is you extension for, isn’t it?
Stephan from Berlin


(Stephan Eich) #52

Oh thanks for that idea of sorting.

If it will imported with the airfield name in the topic it is enough an they will find it by search.

And the other way all flags are shown in one map and after click. It will open for discuss about this point of interesed.

If think that is you extension for, isn’t it?

Stephan from Berlin


(Angus McLeod) #53

Yes, I think this plugin could work for your use case. I suggest you start out by manually making 5 topics for 5 airfields initially and see how you go.


(Angus McLeod) #54

Thanks for all the feature suggestions. All good ideas / points. I will deal with each individually as I have the time over the next few days.


(Stephan Eich) #55

I have 100.000 airfields
That the world is intressted in.
Manual it is no way to do that.
Perhapse you find a way with csv upload for many datas. With catgory im make one for airfield supcat the state an then the mass import with kmz, kml or csv. If you let it happen. Thanks. Perhapse you will find a way. Thanks for sharing the idea.


(Angus McLeod) #56

Wow, that’s a lot of airfields :airplane:

I don’t think it’s a good idea to automatically create 100,000 empty topics.

Do you have an existing forum, or are you just starting out?

PM me and we can discuss this further if you like rather than clutter up this topic. I will respond in the morning, it’s late where I currently live :first_quarter_moon_with_face:.


(Stephan Eich) #57

Thank you Agnus
Yes i have one


Sorry these airfield database get around 10.000 not 100.000 Airfield adresses.
Sorry one zero too much.:sweat_smile:


(Anton) #58

@angus would you accept a donation for your amazing speed of plugin and feature development, and responsiveness? Please PM your PayPal.


Also, is the Map menu button translated? I updated the plugin with the translations you merged, but the button didn’t get a translation:

UPD. Fixed, please see:


(Chris Beach) #59

Ditto. Thank you so much for the work you’ve done in keeping the TLP up to date, @angus, and the exciting new locations and events plugins. Please PM me your PayPal address and I will buy you a virtual beer.


(Stephan Eich) #60

Dito, fo me as well.