OpenStreetMap

MapBBCode: free maps for everyone

Posted by Zverik on 31 October 2013 in English (English)

It is now time to mark a milestone in my month-long programming marathon and announce the first release of the MapBBCode library: a way to integrate maps into almost everything, but primarily written for forums and blogs. There is a long introduction on the official site, but the problem it solves is very common and somewhat annoying, especially with biking and construction sites: they have no maps.

Mapping plugins for forums tend to focus on geolocating users, which is a dull and useless task. What if I want to draw a route and allow fellow bikers to download it as GPX before setting off? The world of embedded maps is dominated by monstrosities, like the one I've spotted in Shaun's blog (40€ for a map!). We have Leaflet, we have the best map in the world, and forum/blogging engines have API — let's get coding.

MapBBCode

Map BBCode is a string enclosed in [map]...[/map] tags. It can be copied anywhere and edited as text; essentially it is GeoJSON with restricted set of properties and adapted for forums. A small javascript library turns it into a Leaflet map panel and allows editing code not by entering numbers, but by drawing on a map. You can try in on the project's page. There are also modules for phpBB forums: this Monday a popular local forum on road construction has installed it, and now I'm pushing it to local cycling forums. Someday there will hopefully be plugins for vBulletin, WordPress, SMF, MediaWiki and others.

As an example of library's versatility, MapBBCode Share website was born. The idea was simple: put strings in a database — and you've got a map sharing service, simple and accessible, like pastebin or imgur. And you can copy raw code to a forum or a blog. This vision started to shatter when GIS-Lab community used the site for planning a mapping party by openly publishing an edit link. And then I added import and export to a dozen of formats, personal libraries (so you won't have to store bookmarks locally) and API. It turned out that sharing maps is only a fraction of the site's potential.

MapBBCode Share

Now you can plan a trip together with friends, place markers, embed the developing map in a forum post, and a day before the trip you can download the route and waypoints in GPX format right from a forum page. You can import CSV and immediately download it as HTML with no external dependencies (besides Leaflet). No iframes — unlike every other service, MapBBCode Share produces full-featured HTML that works offline and can be included in a website by copying code. You can upload OSRM-generated routes, quickly edit poly files, inevitably export GeoJSON, — the site "competes" not only with geojson.io and uMap, but even with JOSM. Privacy is bulletproof: you sign in with OpenID (google/yahoo accounts will do), your ID is immediately hashed before storing, so even the administrator doesn't know who is using the website. The hash doesn't leave the server, so no one can link maps to users.

Today I am releasing the whole package: more than 200K of code, 60K of documentation, 7 new Leaflet plugins, everything published under the most permissive license of all, WTFPL. The development goes on, but now all changes are logged, and the author is responsible for keeping backwards compatibility. Please use MapBBCode Share and write plugins for embedding the code into forum and blog engines. Let's make the [map] tag a standard, and make sharing maps no harder than sharing images or code.

Comment from Stalfur on 31 October 2013 at 21:14

This looks fantastic! Looking forward to delving into it and test it out!

Hide this comment

Comment from Richard on 31 October 2013 at 21:42

Superb. Really hope this gets adopted widely.

Hide this comment

Comment from Glassman on 1 November 2013 at 01:18

What a great tool. Thanks!!!

Hide this comment

Comment from Tom Chance on 1 November 2013 at 11:06

This is fantastic, thank you.

Where can you add labels to polygons, as in your second screenshot?

Hide this comment

Comment from Zverik on 1 November 2013 at 11:38

Those are not polygon labels, but regular markers inside polygons. There is a way to add popups to polygons by editing the raw code, but adding markers was proved to be more intuitive for users.

Hide this comment

Comment from Tom Chance on 1 November 2013 at 11:47

Ah, got it, thanks.

Hide this comment

Comment from malenki on 1 November 2013 at 14:20

I kuldn't resist to excavate teh lolcat uf awzumnez for yur græt workz, Mistah Zferik!

Or to say it with Terry Pratchett: !

Hide this comment

Comment from Zverik on 1 November 2013 at 14:31

Oh wow. That is the greatest honour one can receive in this project. My life is now complete. Thank you :)

Hide this comment

Comment from baditaflorin on 1 November 2013 at 15:33

Wow, it is really great :)

One Request, the posibility to delete a line. Now you cannot delete a line, you can only detele points, until you remain with 2 points.

Hide this comment

Comment from Zverik on 1 November 2013 at 15:39

baditaflorin, did you try clicking on a line (between points)? There is a popup panel with a "Delete" button.

Hide this comment

Comment from Harry Wood on 1 November 2013 at 15:58

There's a standardisation opportunity which is constantly evading us here. It's always bothered me, ever since I wrote the two MediaWiki extensions years ago, and I've been meaning to come back to this. So MapBBCode has a new "map sharing" syntax, and it's also a map sharing service, or maybe the term should be something like "annotation services"? Recently we've seen umap come along, and also geojson.io They all do slightly different things, adopting different syntaxes. The other family of similar map sharing ideas comes from static map image services which we've had for a while. With some services the data needs to be put into a URL params. This is even possible on the OpenStreetMap.org front page (marker and box parameters) but as with the syntax approaches… no real standardisation yet it would seem.

Hide this comment

Comment from Zverik on 1 November 2013 at 16:18

The problem is, only one of those services/plugins offer raw textual data for user's objects that can be edited by hand and copied into another medium, and it's GeoJSON — rather cumbersome and hard to read, especially in small textareas. Most of these just show a map with almost no extra information. So that makes MapBBCode the first attempt at the task. The bbcode can be integrated into your MediaWiki extensions, just by allowing content inside the tags. But OpenLayers is so 2009 :)

I intend to see the adoption of the bbcode through. There is a module in the works for OSM's forum, and we are planning to invade a lot of russian offroading and cycling forums, making open source plugins along the way. It, of course will take time, but surely is inevitable.

Hide this comment

Comment from Vincent de Phily on 4 November 2013 at 09:58

Many thanks. I tried to write an ad-hoc gpx-display plugin for Blogger a couple of years ago and gave up after much frustration.

I realistically won't have time to look at it again for a while, but please put Blogger on your radar of interesting targets (and savour the irony of a Google platform getting OSM support before GM support).

Hide this comment

Comment from FTA on 30 November 2013 at 17:41

This is great!

Hide this comment

Leave a comment

Parsed with Markdown

  • Headings

    # Heading
    ## Subheading

  • Unordered list

    * First item
    * Second item

  • Ordered list

    1. First item
    2. Second item

  • Link

    [Text](URL)
  • Image

    ![Alt text](URL)

Login to leave a comment