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:
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 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:
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.
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.
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.
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, … .
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.
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).
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
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.
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.