Fandom

Community Central

Comments0

Guide to Maps

Jsteel7 September 16, 2013 User blog:Jsteel7

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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.

How to insert a Map

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):
{{#display_map: -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)
{{#display_map: Town Hall Train Station, NSW, Australia }}
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:
{{#display_map:|centre= Sydney, Australia }}
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):

{{
#display_map:
Central Railway Station, NSW, Australia;
Circular Quay Railway Station, NSW, Australia;
Newcastle Railway Station, NSW, Australia
}}

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:

{{#display_map: -33.86852273854561,151.2158203125; -33.77040330341181,150.6884765625; -33.92779613048281,150.9246826171875; -33.9642515784714,151.116943359375; -33.827463185401214,150.90545654296875; -34.146294391495864,150.70770263671875; -34.05532185312871,150.875244140625; -33.84343313423251,151.138916015625; -33.952860928286,151.2213134765625; -33.781818322716944,151.25701904296875; -33.838870596189636,151.10595703125; -33.97108523651547,151.17462158203125; -33.85483841351915,151.1114501953125; -33.870803246161266,151.09222412109375; -32.93532057890514,151.75689697265625; -32.905348361714516,151.64703369140625; -32.89843025480895,151.7156982421875; -32.905348361714516,151.688232421875; -33.85711926924701,151.19659423828125; -33.287306299639866,151.435546875; -33.287306299639866,151.41632080078125; -33.28501032193499,151.435546875
}}

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 | markercluster=on to the end of it, producing:

{{
#display_map:
Central Railway Station, NSW, Australia;
Circular Quay Railway Station, NSW, Australia;
Newcastle Railway Station, NSW, Australia
| markercluster=on
}}

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 | markercluster=on to the end of it, and the marker clustering starts to serve a purpose. This code would look like:

{{#display_map: -33.86852273854561,151.2158203125; -33.77040330341181,150.6884765625; -33.92779613048281,150.9246826171875; -33.9642515784714,151.116943359375; -33.827463185401214,150.90545654296875; -34.146294391495864,150.70770263671875; -34.05532185312871,150.875244140625; -33.84343313423251,151.138916015625; -33.952860928286,151.2213134765625; -33.781818322716944,151.25701904296875; -33.838870596189636,151.10595703125; -33.97108523651547,151.17462158203125; -33.85483841351915,151.1114501953125; -33.870803246161266,151.09222412109375; -32.93532057890514,151.75689697265625; -32.905348361714516,151.64703369140625; -32.89843025480895,151.7156982421875; -32.905348361714516,151.688232421875; -33.85711926924701,151.19659423828125; -33.287306299639866,151.435546875; -33.287306299639866,151.41632080078125; -33.28501032193499,151.435546875
| markercluster=on
}}

This map looks like this

Customizing the map

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 : {{#display_map:Sydney, NSW, Australia|resizable=yes}}, 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:

{{#display_map: Strathfield Railway Station, NSW, Australia
| height= 600px
| width= 400px
}}

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:

{{#display_map: 
|circles=18.2994600363217,-116.71875:2694688.6180095034
|polygons=65.64666809577011,-59.0625:47.498183954727445,26.71875:56.929615418707094,52.03125:74.20432100988442,-11.25:73.81697591988235,-113.90625:65.64666809577011,-105.46875~ ~ ~#00FF77~1~ ~#FFFFFF
|rectangles=5.9517671659013205,170.859375:-49.16216625572869,98.4375
}}

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:
{{#display_map:Sydney, NSW, Australia|layers=traffic}} which produces this

Satellite Mode

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

{{
#display_map:
Central Railway Station, NSW, Australia;
Circular Quay Railway Station, NSW, Australia;
Newcastle Railway Station, NSW, Australia
|type=satellite
}}

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:

{{
#display_map:
Newcastle, NSW, Australia;Sydney, NSW, Australia;Dubbo, NSW, Australia
| icon=Wiki.png
}}

This code produces a map which looks like this.

OpenLayers Map

You can use the other mapping service provided by placing |service=openlayers at the end of the code. This looks like:

{{
#display_map:
Gosford, Australia
| service=openlayers 
}}

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

{{#display_map:Sydney, NSW, Australia|static=yes}}

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:

{{#display_map: -27.071660497913754,139.21875~Australia
}}

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 {{#display_map: {{PAGENAME}} }} 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 {{#display_map: {{{1}}} }} 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.

Also on Fandom

Random Wiki