Technical: Embedding Maps into Discourse Forum

I have been doing some basic background research into how we might embed Google Maps (or other things) into discourse. The purpose of this would be to ultimately embed an Ideal Network Map (INP) safely.

ChatGPT suggests the following:

Discourse has a handful of plugins and built-in “onebox” handlers that leverage oEmbed to safely embed content from supported providers (e.g. YouTube, Twitter—and with the right plugin, Google Maps). The most popular community option is the discourse-oembed plugin (sometimes called “onebox-oembed”) which:

  1. Adds oEmbed support for extra sites
    – Beyond the built-in list, you can whitelist additional oEmbed providers (e.g. Google Maps, Mapbox, SoundCloud, Vimeo, etc.).
  2. Handles link-only embeds
    – You simply paste a share URL on its own line; the plugin fetches the oEmbed JSON endpoint, sanitizes the returned HTML (stripping scripts/CSS), and renders a safe <iframe> or <blockquote>.
  3. Respects Discourse’s security
    – All embed HTML is passed through the same sanitizer, so you never open up your site to arbitrary iframes—only those the admin has explicitly enabled.
  4. Is easy to configure
  • Install via your host (if using a hosted service) or clone the repo into plugins/ on self-hosted forums.
  • In Admin → Settings → oEmbed, add the provider’s oEmbed endpoint (e.g. https://www.google.com/maps/oembed?url=%{url}).
  • Optionally set max width/height, timeout, and caching rules.
  1. Supports caching
    – oEmbed responses are cached in your Discourse database to avoid repeated external calls.

There were also some other links given:

Any thoughts on this or an alternative for embedding maps into the forum? Is Google Maps preferred or is there perhaps something that might better meet our needs?

If we are able to get the Well Known Text representation, it’s conceivable that we could host it ourselves.

1 Like

Could you perhaps provide more detail about it?

There are open source mapping solutions that we can host on our domain. E.g. inp.btq.org.au.

These solutions simply require us to provide the data in a format it can understand. Well Known Text (WKT) is a map geometry standard. I’m not sure whether google maps supports WKT export.

1 Like

Here’s an example of some of the things that can be done.

1 Like

If we can download anything from GMaps then there’s probably a converter.