Hey, yeah I did consider it briefly a month or so ago. What’s the use case you have in mind?
I have my personal instance for notes. I like to collect a database of restaurants with geotags so I can look at a map and see the ones I like. I often snap a pic of the menu while I’m there and upload it right away for future reference. Geotagging that spot would allow me to save the extra steps of looking up and entering the restaurants address.
Interesting! What do you reckon @ckshen? Would your community use something like that?
Probably limited for us. I think most of our users prefer to report their meals after the fact versus while they are eating.
Hi, ~recently I posted a desirable feature in Discourse there. Interesting to know, how that feature might cover your needs, guys!
Is it possible to add a link to the site map to the hamburger menu? Same as events plugin.
Learn how to build Discourse plugins by helping me
Yup, we can add that.
To do list:
Add a link to the Site-level map in the hamburger menu
Improve map filters (see e.g.).
Add auto-detection of user’s location.
Angus, please also leave an option for users to select their location manually. This way they can choose an approximate location that at least identifies the district they live in (and City/Country), without having to give up too much privacy :).
If not manual entry, might an option to reduce the scale cause enough blurring?
eg. instead of 43.12345, 43.12000
Is anyone else having issues with the OpenCage geocoder? I’ve signed up for the free tier, but it’s throwing errors in Discourse saying the API key is wrong (it’s not, I checked). Here’s the logs (cut’n’paste from the Discourse console isn’t great, sorry):
Message (4 copies reported)
GeocoderError (Geocoding provider api key invalid. Please contact your site administrator.) /var/www/discourse/plugins/discourse-locations/lib/geocode.rb:100:in `rescue in perform’
rescue in perform' /var/www/discourse/plugins/discourse-locations/lib/geocode.rb:86:inperform’ /var/www/discourse/plugins/discourse-locations/lib/geocode.rb:75:in
search' /var/www/discourse/plugins/discourse-locations/controllers/geocode.rb:8:insearch’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in
send_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:inprocess_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in
process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:inblock in process_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:131:in
run_callbacks' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:inprocess_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in
process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:inblock in process_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in
block in instrument' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:ininstrument’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in
instrument' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:inprocess_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in
process_action' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:inprocess_action’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in
process' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:inprocess’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/mini_profiler/profiling_methods.rb:104:in
block in profile_method' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:indispatch’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in
dispatch' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:indispatch’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in
serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:inblock in serve’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in
each' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:inserve’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in
public_send' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:inmethod_missing’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:17:in
block in <class:Constraints>' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:46:inserve’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in
block in serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:ineach’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in
serve' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.1/lib/rack/protection/frame_options.rb:31:in
call' /var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:24:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/conditional_get.rb:25:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/head.rb:12:incall’ /var/www/discourse/lib/middleware/anonymous_cache.rb:200:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:232:incontext’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/session/abstract/id.rb:226:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in
block in call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:inrun_callbacks’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/logster-1.2.9/lib/logster/middleware/reporter.rb:31:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in
call_app' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:incall’ /var/www/discourse/config/initializers/100-quiet_logger.rb:16:in
call' /var/www/discourse/config/initializers/100-silence_logger.rb:29:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/method_override.rb:22:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/mini_profiler/profiler.rb:285:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.4/lib/message_bus/rack/middleware.rb:63:in
call' /var/www/discourse/lib/middleware/request_tracker.rb:186:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in
call' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:inpublic_send’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in
method_missing' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:68:inblock in call’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:in
each' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/urlmap.rb:53:incall’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:606:in
process_client' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:701:inworker_loop’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:549:in
spawn_missing_workers' /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/lib/unicorn/http_server.rb:142:instart’ /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/unicorn-5.4.0/bin/unicorn:126:in
<top (required)>' /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/unicorn:23:inload’ /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/unicorn:23:in `<main>’
|REQUEST_URI|[/location/search?request%5Bquery%5D=10, /location/search?request%5Bquery%5D=Hochschule%20Bonn-Rhein-Sieg, /location/search?request%5Bquery%5D=ams, /location/search?request%5Bquery%5D=yay]|
|HTTP_USER_AGENT|Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0|
Anything else I can provide? We’re not over our usage, as far as I can tell (and presumably that would return a different error). I’ve reverted to Nominatim for now, as our usage isn’t high (yet), so it’s not urgent.
BTW, thanks for this & the events plugin, you do great work!
Can this plugin be used to display all forum members locations on the map?
Would it require extra programing?
Yes, this will always be the main option. Auto-location detection will be an optional feature.
I just gave it a whirl and it’s working ok for me: Location with OpenCage - Locations - Angus’ Sandbox
When is the error being thrown? In Site Settings or in the Add Location modal? If it’s in Site Settings make sure you’re adding the key first then switching to Open Cage for your provider (it won’t work if you switch provider first).
@Sudaraka and I have been working on that exact feature for the past couple of months He’ll be launching it here very soon.
It’s in the Add Location modal - I just got a red bar between the “Add a Location” and “Address” text, but no actual error appears. It was working to begin with, and seems to be working now, so perhaps it’s was a few hours of weirdness on the OpenCage end… I’ll monitor it, thanks!
This may be a big ask but is there a way to preview what the map location will be? Right now I’m having to either (a) repeatedly save/edit a post until I figure out a location that works, or (b) refine my search on the OpenCage demo site. Previewing the map in the modal would be amazing
In location input, there is postalcode but it is only possible to write numbers. Here in Quebec, Canada, we have letters, for example : J3K 8G4
This plugin is great, thank you! I was wondering if it is possible to change the location input from an address to a map where the user can click on the location(Think rural natural disasters, where there is no street address.)
2 minor formatting suggestions:
- Make the Location and Date/time button the same height.
- Keep them on the same row.
Good. Let me know if anything changes.
Yeah. I actually originally built it that way, but changed it back for some reason (I forget now). It may be time to re-add a preview map.
Yeah good point. I’ve removed that restriction.
You know it’s also possible to use a free text input right? (disable the
location input fields enabled site setting). Example with a number / letter postcode:
Great idea, will add it to the list. There is a manual way of adding locations with no geocoded address, as this plugin does support direct entry of latitude and longitude:
via the api (example curl cmd with lat / lon); and
via the input fields: enable
location input fields enabledsite setting and add
location input fieldssite setting.
Both should be true in the current version.
What version are you running and do you have any custom styles that could be affecting the buttons? (I see there’s an added
border-radius to your buttons).
Here’s what you see when you create a new topic in the events category on my sandbox:
To do list:
Add a link to the Site-level map in the hamburger menu <-- currently being worked on via Mentoring program.
Improve map filters (see e.g.).
Add auto-detection of user’s location.
Look closely at error handling for missing locations or api errors (there should be no blank error messages - see).
Add preview of location on map in Add Location modal.
Allow user to select topic location by clicking on map.
Just to expand on my idea from earlier. I think it would be great if the user could input an address, like the default settings, and have the map appear essentially confirming the location. At this point the user could click on the map to confirm a more accurate location.
@Angus and I have been working on a new feature for Locations plugin which permits adding user locations in a separate map for the last couple of months. So far, the new feature is working very well on the sandboxes we used and merged to the Discourse Locations Plugin
It’s live on Angus’s Sandbox
Here is a step by step guide to use the plugin,
First enable the setting in the plugin settings section in admin settings which allows users location functionality
Then add your location in the user profile preference page
- And save the changes by clicking the button in the latter part of the same page
- Now you can view your location and the locations of other users in
You can toggle users list and the map using nav buttons on top of the map
You can visit the profiles of users in the map by clicking on the map pin
Fantastic. Will take a look!