Static map support

This has been a big item on the to-do list for new Maps features for a few months now, but I finally managed to make some time for it, and just checked in the last code into the MediaWiki SVN repo :)

Let’s start at the beginning: what is static map support? Supporting static maps means that you are able to display maps as plain images instead of via a JavaScript (or other non-html language, for example flash) mapping API. This is very important since it makes viewing the maps possible for people who are browsing the web with a browser that does not support JavaScript (or this other language), or simply have it disabled for some reason. This actually made this feature a requirement for getting Maps onto Wikipedia and other Wikimedia Foundation wiki’s. Another reason to use such a feature is that it can significantly reduce the load on the servers from which the map tiles are fetched, since the plain images can be cached.

So how does it work? Maps now accepts a new parameter called ‘static’ that accepts the values ‘yes’ and ‘no’. When set to no (or not provided, assuming the default is unchanged, so on ‘no’), you’ll get the same map as you always did, with no changes whatsoever. When the values is ‘yes’, you’ll get a plain .png image fetched from a WF server. If you have JavaScript enabled, and click on the image, it’ll be replaced with the dynamic map.

Maps 0.5 will support this for the display_map parser function when using the OSM service. It’s possible I’ll also add support for display_point(s). Note that my work is just a link in a big chain here. Most effort to make this functionality possible is done by the guys doing the mapping server side work. Also, a lot of my code Maps is using for displaying static maps is heavily based on code from the SlippyMap extension by Ævar Arnfjörð Bjarmason and others.

Since there are no demo’s available anywhere yet, here you have some screenshots:

A static map:

Maps displaying a static map of Brussels, Belgium

The dynamic map you get after clicking the static map:

Maps displaying a dynamic map of Brussels, Belgium

And yes, the zoom level is off, this is a bug that still needs to be fixed :)

Posted in Programming Tagged with: , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">