Locations Plugin

Very curious indeed! Strangely they are working fine on my data. I also note on your map, there is an error when hovering over a cluster.

Leaflet version is seriously dated … might be an issue …

1 Like

OK I’ve pushed the version of Leaflet and its popular marker cluster plugin to latest, see if that helps:

We might as well break it properly with latest code :sweat_smile:

(there is no point in even discussing such issues if we are running an old library, who knows what they’ve fixed!).


Thanks for the quick update. On an initial test it’s behaving better now. I’ve not got the weird east to west coast jump on the couple of tests i’ve tried. I’ll do some more testing tomorrow.


Yeah, I can see. Great! Thanks for rechecking promptly.


After more testing today it looks like the last update has fixed the blank map on first opening and also the weird east to west coast jump from clustered locations :grinning:


Thank you for pointing this out to me, and sorry, that I was not around here for some days to comment.

That really sounds promising. :slight_smile: But at the moment, we do not have the AI Chatbot active in our forum. I am still struggling with guessing how much this would cost us to get an API key from OpenAI. As we run our community in a non-profit way and do not charge, we hardly get the server and domain costs out of the few donations and other stuff like this. So that is an important topic for us. :wink:

The link to the answer in the post with the example calculations does not work anymore. Can you tell me where to find it? :slight_smile:

And besides the AI Chatbot integration: Are you thinking about putting a distance information into the plugin as well? So simply showing the distance from the current logged in user to an event or to another user - if both sides have set an location? That was the simple way it was handled in the location plugin for phpBB we used before.

The cost post was deleted I’m afraid as the Topic was getting stupidly long. I’ll remove that from the OP. (Done)

I suggest trying it out : permission staff only initially.

No, I don’t plan to make it available in the Locations plugin without the Chatbot.

For all you subversive subfolder users out there, @renato has kindly PR’d to make sure the markers work in such a configuration:

Thanks very much @renato! :pray:


One quick question:
How do I update this plugin? run ./reset-all-repos seems risky.
Goal is to only update this plugin, and not lose the data of the 180 projects already entered.

1 Like

That’s not really a plugin specific question, but you will need to be running tests-passed and update to latest to get all the new stuff working.

It’s always risky :sweat_smile: , unless you want to run a Stable install? (in which case this update is not yet relevant).

The online upgrade (from /admin/upgrade) might work for you, or as usual, rebuild with ./launcher rebuild app - assuming you are running a standard install?

I cannot vouch for the rest of your plugins maintenance levels, but good luck! :sweat_smile:

1 Like

Encountered the same problem.

I tried the method listed here

But not working.
Ubuntu system, reboot not working,
./launcher restart app, ./launcher start app not working.

Error Message when running ./launcher rebuild app

111:M 12 Dec 2023 12:11:02.199 * DB saved on disk
111:M 12 Dec 2023 12:11:02.200 # Redis is now ready to exit, bye bye...

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3553 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

Thank you for @itsbhanusharma

It says caused by earlier error, I list them here

I, [2023-12-13T00:50:13.222274 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundl                e exec rake db:migrate'
2023-12-13 00:50:18.347 UTC [3597] discourse@discourse ERROR:  invalid input syntax for type double precision: ""

2023-12-13 00:50:18.347 UTC [3597] discourse@discourse STATEMENT:  INSERT INTO locations_topic                 (topic_id, latitude, longitude, name, street, district, city, state, postalcode, country, count                rycode, international_code, locationtype, boundingbox, updated_at, created_at) (
        FROM topic_custom_fields tc
        WHERE tc.name = 'location'
        AND tc.value NOT IN ('"{}"', '{}', '')
        AND tc.value::json->'geo_location'->>'lat' IS NOT NULL
        AND tc.value::json->'geo_location'->>'lon' IS NOT NULL

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

ERROR:  invalid input syntax for type double precision: ""
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb: 110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb: 110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/mini_sql-1.5.0/lib/mini_sql/postgres/connection.rb:202:in `run'

Caused by:
PG::InvalidTextRepresentation: ERROR:  invalid input syntax for type double precision: "" (PG:: InvalidTextRepresentation)
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb: 110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/db/pg.rb:  110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/mini_sql-1.5.0/lib/mini_sql/postgres/connection.rb:202:in `run'

and the docker ps message

/var/discourse# docker ps
CONTAINER ID   IMAGE                 COMMAND        CREATED             STATUS         PORTS                                                                      NAMES
d3c8e85149a8   local_discourse/app   "/sbin/boot"   About an hour ago   Up 6 minutes>80/tcp, :::80->80/tcp,>443/tcp, :::443->443/tcp   app

Your error is not the same as OP. Could you provide full log of rebuild?

Thank you Bhanu, I have redo the rebuild process, and generated the “earlier errors” in the former post. Could you please help understand and solve the problem?

Looks like an issue with locations plugin, Could you try rebuilding without it to see if that fixes the build issue?

1 Like

Great! I just rebuild the system, and it works.

While I have to say, location plugin is very good. So I hope relative debugging can be done.

What version of discourse you’re currently on?

I believe many people have migrated to the new Locations fact tables with no issues, so this is something peculiar to your instance.

As you can see from the code, I’ve tried to capture safely many cases where the data is bad (and ignore them), but might have missed a scenario and there is some kind of illegal json value.

Can you please either delete that Topics Custom Field (TopicCustomField) or fix its value, then retry.

There’s probably no point in keeping it because it’s likely an illegal value.

If there are not many Topics with locations, you can browse through them with this on the rails console:

TopicCustomField.where(name: "location").all

You can still access that custom field without the plugin installed.

Let me know what you find.

If this can be confirmed, I might improve the script.

I’m not aware of another report of this issue on this plugin.


I think that was a hangover from the posts being split from another topic before Locations was identified as the issue.


I was from 3.2.0 beta2, upgrading to version 3.2.0 beta4-dev.

using branch test-passed.

I used too many topics with location, so don’t really dare to delete them.

Hope the next version of rebuild is OK for this plugin.

I’m afraid you are going to have to do some investigation or it will likely fail again.

Please read my post above carefully.