User blog:Jsteel7/Guide to Maps

The Maps extension on Wikia is a new-ish extension, and the help page doesn't explain entirely how it works, so I'm going to write this blog as a guide for anyone using or considering to use the Maps extension. Because the Maps extension isn't enabled on Community Central, I'll will link to a blog post with examples on my home wiki (which has maps enabled)

What is the Maps Extension?
Firstly, what is the maps extension? Well the maps extension is an extension that is optional - in that you need to write into Special:Contact to ask Staff to enable it. The maps extension provides maps, using either Google Maps or OpenLayers Maps, both of which are fully capable of doing the job needed.

Displaying a single point
Google Maps is the basic map and the default map. The most common type of map is a map displaying a certain landmark or feature. This can be displayed in two ways

By coordinates
If you have the coordinates of a landmark, which can be obtained from Google maps, you can use the following syntax (with the coordinates -33.883705, 151.206286):

Take note of the underscore in the coding. The underscore is vital - without it, the map will not work. You can see the result of this map at here

By name
If you can enter a location and have a result on Google Maps, It is likely it will work in maps. Therefore, you can use the following syntax to display an address or the name of a landmark (e.g. Central Railway Station, NSW)

You can see the result of this map at here

Displaying a single point without the marker
All this is good, but what if you wanted to display a map without that marker. The marker is good for marking specific locations, but what if you wanted a generalized map focused on a specific city (e.g. Sydney). Well, you can use the syntax:

You can see the result of this map at here

Multiple Points
What if you want to show multiple points? Do you need a separate map for each one? No, you just need a single map, with the following syntax (coordinates work as well):

Make sure you put a semicolon (;) after every point except for the last point. It doesn't matter if each point is on a separate line or not, as long as they are separated by a semicolon. You can see the result of this map at here

If you have too many locations or you just cannot be bothered to type out all the locations, you can use the awesome helping-hand page that magically appears when you install the maps extension. This page is located at Special:MapEditor on your wiki, but if for some reason you cannot access it, you can visit the map editor at Semantic MediaWiki. If you use this to display multiple points, you get a code like this for example:

As you can see, this code would be a nightmare to type out, which is what the MapEditor page comes in use for. The MapEditor Page has many other uses, which I will discuss later. To see what this map looks like, you can see that here

Marker Clustering
What happens if you wanted to show clusters of markers to neaten the map up? There are two ways to go about this. The first is to get all the coordinates and display them as above then adding  to the end of it, producing:

You can see what this looks like here. This is all good, but what if you have multiple points with obscure coordinates. Typing it all out is a nightmare, so you use the Special:MapEditor page again. Taking that code, you add the  to the end of it, and  the marker clustering starts to serve a purpose. This code would look like:

This map looks like this

Resizability
With a map, you can add a resizable parameter that allow the user to change the size of the map, as if it were a window on a computer. Using this code :, you can create a resizable map, which looks like this

Fixed Sizes
Normally a map molds to the size available, which may not be what you are looking for. If you want the map to stay a fixed width, you can use the following code:

This produces a map which looks like this

Shapes/Polygons over the top
The code for a shape or polygon is really tedious, so it is recommended that you use the Special:MapEditor page, which has a built in shape drawer for maps, which allows you to position, colour and alter the shape to your heart's content. This produces code that looks like this:

Which, is too impossible for someone to remember, or be bothered to type out. This example looks like this

Display Traffic
You can even use a map to display the current traffic conditions, with the following syntax:

which produces this

Satellite Mode
You can make a map default into satellite mode by placing this line at the end of the code  so that it looks like this:

This map looks like this.

Change the default marker
You can even change the marker that marks the location of the landmark with syntax such as this:

This code produces a map which looks like this.

OpenLayers Map
You can use the other mapping service provided by placing  at the end of the code. This looks like:

This produces a map which looks like this.

Static Map
If you want a map to be static (i.e. the user cannot move the view), you can use the following code, which looks like this

Adding Text to Labels
You can add text to a label by placing a tilde (~) after the coordinates. The code for this looks like this:

This produces a map which looks like this

What else can I do with the maps extension?
If you know how to use the maps extension, it can be very invaluable to the delivery of information on your wiki. However, customizing and applying the code can be very tedious if it is required on a large number of pages. If the pages you want to apply it to are the same name as the location (like if the page was named Sydney Harbour Bridge for example), you could create a template with the code  so that you only have to place map (or something similar) on the page, which can easily be done with a bot.

Using this techniques, you can create a template which shortens the parser function, making it more user friendly. This could look like  and be in a template such as m, which would make it much easier to apply to a page.

What wikis could benefit from maps?
Many wikis could benefit from maps, and I'll try to create a basic list.
 * Wikis that focus on a specific country or city or state.
 * Wikis that involve landmarks such as railway stations.
 * Wikis about video games that involve real world locations.
 * Wikis about TV shows or movies which involve real world locations.
 * On any wiki about TV shows or movies to show filming locations and the like.
 * Any wiki which has pages on locations.

Help
If you have any questions or comments, feel free to post them in the comments below. There is also the repository of information about maps located at semantic-mediawiki.org which has many more examples for you to use.