Wikivoyage:How to use dynamic maps

From Wikivoyage
Jump to: navigation, search
See also: Wikivoyage:How to draw static maps, Wikivoyage:Dynamic maps Expedition

Need a map that will dynamically update as listings are added, updated and removed?

Here's how.

Embed a dynamic map[edit]

Map of How to use dynamic maps
Map of How to use dynamic maps

Place the {{Mapframe}} template at the point on the page where you wish the embedded map to appear. It will display on the right side of the page by default. It should usually be placed right underneath the "Get around" heading so that it is not too far from subsequent listings.

The syntax is

{{Mapframe|latitude |longitude |zoom=zz |height=nnn |width=nnn |layer=layers |staticmap=image file |align=align}}

where

latitude is the decimal latitude co-ordinate ( 2 to 5 decimal places ) e.g. 6.78 or 23.54321
longitude is the decimal longitude co-ordinate ( 2 to 5 decimal places )
zz is a number between 1 and 18 that specifies the enlargement or zoom level at which the map is initially displayed on the page (this can then be adjusted by the reader). A zoom level of 13 to 15 is often appropriate for maps of settlements. Optional - default is 14.
nnn is the width and height in pixels that the embedded map will display at on the page. Optional - default is 420px for both height and width.
layers is one or more optional letters to specify the map layers displayed and whether options such as hill shading are used. Again, these can then be adjusted by the reader by clicking "radio buttons" from a menu at the upper right hand corner of the displayed map. Optional - default is O.
image file is optional and is the file name of a normal png or svg file for a static map image. Optional - if specified, a hyperlink with the text "View static map" is displayed at the lower corner of the map frame.
align is the alignment of the map frame. Optional - default is right aligned (other values are "left" and "none" (center)).


If no layers are specified then the default "Mapquest Open" layer is used. You can specify one basic opaque layer, but as many additional transparent layers from the second list as you prefer, either singly or in any combination or order:

Basic layers (opaque)[edit]

A =Mapquest Aerial
M =Mapnik (OSM, OpenStreetMap)
N =Traffic line Network,
O =Mapquest Open
W =Wikivoyage (default layer), based on OpenStreetMap

NOTE: Wikimedia Maps layer is shown by default in any map to preserve the user's privacy. The other layers can be choosen by any user clicking on the legenda placed in the top right corner of the map. The symbol of the external link near the name of a layer, mean that its content will be downloaded by a third party website, so choosing it, will be accepted to share own IP address with this company.

Additional layers (transparent)[edit]

C =Cycling
D =Destinations
G =GPX tracks
H =Hiking
L =Mapquest Labels for Mapquest aerial layer,
P =Points of Interest (default layer)
S =Hill Shading
-P =no Points of Interest displayed

Incrementally numbered, coloured icons will appear automagically on the embedded dynamic map as Points of Interest (PoI) for each listing in the article that has both lat and long attributes set.

Adding images[edit]

Popup image on map

There's an additional image attribute that can be added to a listing so that the tiny image pops up on the dynamic map when a PoI is clicked. This preview image can be enlarged by clicking.

Syntax: image=filename

Examples:
{{listing | name=Tourismus-Amt | ..... | image=Hornburg Tourismus-Amt.jpg | ..... }}

{{see | name=Old Faithful | ..... | image=Old Faithful Rainbow.jpg | ..... }}
.... = other parameters: | lat= | long= | etc | etc

Where do I put the dynamic map?[edit]

Put it right underneath the "Get around" heading.

If it's placed there, folks using the mobile version of Wikivoyage (which opens with all sections collapsed, apart from the lede paragraphs) will know which section to click on to open the dynamic map. If for some reason it is added to a different location, explain the reasoning in an edit comment or on the article's talk page.

What do all these numbers mean?[edit]

Wikivoyage uses the decimal degrees system for geographical co-ordinates. Each listing needs a unique pair of numbers, called latitude and longitude, which represent its location on a map. They are also known as geodata, co-ordinates, coords, or in short form, lat and long. Adding coordinates to points of interest is called geocoding.

Latitude refers to the north-south aspect, ranging from -90.00000° to 90.00000°. Negative latitudes are in the southern hemisphere, and those positively numbered are north of the equator.
Longitude specifies if the location is either east or west of the Prime Meridian at 0.00000° passing from the North Pole to the South Pole (through Greenwich, England) in the range from -180.00000° (west) to 180.00000° (east).

What about the decimal places? They measure the accuracy of the coordinates, i.e. how much error that is expected. Two decimal places means that it is accurate up to 500m to 1km (depending on how far north/south of the equator you are), which means you might actually be 250 to 500m away from where you want to be! Five decimal places reduces that error to about 1m, so more than 6 decimal places is almost certainly overkill. Each pair of latitude and longitude must have the same number of decimal places, even if that requires trailing zeroes.

Geocoding listings[edit]

Geodata is subject to copyright terms just like any data, so personal geodata and OpenStreetMap (OSM) coordinates are preferred over all other derivative sources. If possible, state your sources.

The most convenient tools for Wikivoyagers are GeoMap, which provides a very quick and easy way to get coordinates for one location, and Geobatcher, which provides a method to look up and hone in on coordinates for an entire Wikivoyage article at once, without ever needing to type or copy-paste the coordinates themselves!

Each listing has a separate icon depending on its type. Specific listing templates like See, Do, Buy, Eat and Sleep should only be used in their sections. For other sections like Get in and Cope, use the general {{listing}} template.

  • 1 See. Example for a See listing.
  • 1 Eat. Example for an Eat listing.
  • 1 Listing. Example for a general listing.

The automatic numbering in each section starts with "1". Exception to the general listing template, which is numbered throughout the article.

Method 1: GPS[edit]

GeoMap

Go to the place with a GPS or smartphone, and add the listing in this format: lat=12.34567 | long=45.67890

Method 2: Dynamic Map[edit]

If the location of a POI is known, click on the place in the dynamic map. A pop-up will open with the coordinates. Copy and paste this data into the appropriate listing.

Method 3: GeoMap[edit]

Open GeoMap. Fill in an address eg. 33, Long Row, Nottingham or Wall Street Bar, Roppongi. The search is multilingual, but is limited to OSM recognized terms. Click on the red marker. Then transfer the values ​​displayed with copy & paste to the article.

Method 4: Geobatcher[edit]

Use Geobatcher to find and map up to 100 coordinates at a time.

How to use Geobatcher
  1. Enter the city and/or country in the first field.
  2. Choose to search by either Name or Address. Searching by name matches OpenStreetMap's Points of Interest database, while searching by address relies on block addresses which may have gaps (eg cannot find 20 Main St between 1 Main St and 50 Main St).
  3. From the Wikivoyage article's Edit tab, copy-paste the listings into the large text field.
  4. Press the Find coords button. 1 listing generally takes 1 second to find.
  5. Listings whose coordinates have been found are mapped, and those without coordinates are marked with a question mark on the map.
  6. Drag and drop the markers to adjust the coordinates. If you don't know where the other listings are, press the Remove ?s button.
  7. lat/long attributes have been inserted in the third text field.
  8. Copy the listings of the third text field back to Wikivoyage.

Bonus: Search OSM using the textbox above the map, and the returned coordinates are listed and mapped with the red marker.

Method 5: ShareMap[edit]

Sharemap org screenshot

ShareMap.org - open, creative commons, social mapping tool (http://sharemap.org) can be used to generate entire list of POI's for some article. With ShareMap user can easily use search services (Nominatim), import OSM data (wizard or XAPI queries) or even calibrate old raster maps (please be careful the create content on CC licenses)

Detailed tutorial screencast can be found here - http://www.youtube.com/watch?v=Xc5F98q87uo

Method 6: OSM[edit]

Go to this site and either use the search or zoom the map to the location of your listing. Centralize the map so the cross is exactly on top of your point of interest. Map coordinates are given under the search bar: copy/paste to Wikivoyage and you're done. Be aware that, just to annoy us, coordinates are given as long/lat instead of lat/long.

From OSM's website itself, you can obtain coordinates through the "Share" tool on the right-hand sidebar. Check the "Set Marker" box, then pick the blue marker with your mouse and drop it onto the desired map position. On releasing the mouse button, the map will re-center to the marker, giving the coordinates in your url bar ready to copy and paste.

Method 7: Google Maps[edit]

Please avoid using this method if possible as it would introduce a lot of licensing issues when collaborating with OpenStreetMap. If this method is used, be sure to name Google Maps as the source of the coordinates in your edit summary.

Enable Google Maps's LatLng dropper as described here. Then find the place, and right-click, drop LatLng, copy-paste, add the lat= and similar parts. This also works on Google Street View, which is very convenient to recognize places where you have been, or check the name written in front of a restaurant.

You can also right click any spot on a Google Map, select "What's here?", and the coordinates will pop up in the search field.

Converting from DMS system[edit]

To convert from a traditional Degrees/minutes/seconds format like lat=N45°30'0", long=W73°36'0", use the following formula:

  • X°Y'Z" = X+(Y/60)+(Z/3600)
    • for S, add "-" to lat; for N, assume "+"
    • for W, add "-" to long; for E, assume "+"

Adding a map[edit]

Geo template[edit]

Inserting a Mapframe

You might have noticed a Map mag.png small map icon at the top of the screen, which links to a large map of the area an article covers. Not there? Use GeoMap and select the Geo option at the left side to fill out the {{geo}} template which might look like {{geo|1.3421|129.0122|zoom=14}}. The numbers mark the centre of the city or region, while the zoom number determines the scale of the map. 1 covers the entire earth, and 18 marks the city block level.

Mapframe[edit]

For in-article maps, insert a {{Mapframe}}. Use Geomap and select the Mapframe option. Adjust the height and width as best as possible. Try to size it such that either most of the listings or the most important listings are present in the map. It is also recommended to include a static map by taking a screenshot of the dynamic map.

  • {{Mapframe|51.47766|0.00115|zoom=14}}
  • {{Mapframe|51.47766|0.00115|zoom=14|height=400|width=400|layer=W|staticmap=map.png}}

If the (lat, long) and zoom are omitted, {{mapframe}} alone will now default to a scale and position that fits all of the current article's POIs onto the map. These defaults are usually adequate.

There is one added parameter "group" which may specify which markers (listing, see, do, buy, eat, drink, sleep) to display.

The "staticmap" works poorly, as the Kartographer extension does not resize maps which are too large to fit the box.

Mapnik (M), Cloudmade-modified (W) below

The ability to select layers from wiki code is largely disabled, to force queries onto Wikimedia's map server instead of exposing data to external sites. This default set of tiles appears to be M= Mapnik (OSM).

Previously, a Mapquest Open layer (layer=O) was set as the default map tile, as it was particularly useful for urban areas. Rural areas may benefit from using a Mapnik layer (layer=M) as it shows tracks and hiking trails more clearly. Other layers included: M= Mapnik (OSM), W=Wikivoyage, T=Tourism, N= Traffic line Network, O= Mapquest Open, A= Mapquest Aerial, P= Pois of Interest, L= Labels, H= Hiking, S= hill Shading, C= Cycling, D= Destinations, G= GPX tracks. Any combination was possible.

Some of these layers may be still available for manual selection by the user, but can no longer be set as the default.

Not detailed enough?[edit]

Maybe the area where you're trying to add a map doesn't have enough details, with a single solitary main road compared to the dozens in reality. This means that the base map data just isn't enough, and you'll have to head over to OpenStreetMap and use their new iD editor or another in-browser editor like Potlatch. To add roads and buildings, trace over satellite images. If the roads are unnamed, name them.

If you don't feel up to it, ask at Wikivoyage:Dynamic maps Expedition or Wikivoyage:Requests for maps, and someone may come along and add the details to OpenStreetMap instead.

Adding boundaries and tracks[edit]

OpenStreetMap boundaries and tracks[edit]

The preferred method for adding boundaries is to use {{mapshape}}, which pulls data from the OpenStreetMap database to render a mask, shape or line using OpenStreetMap data; see the mapshape template documentation for further details.

Custom boundaries and tracks[edit]

If the boundary or track does not exist in OpenStreetMap then it must be manually created using the {{mapmask}} template.

Creating GeoJSON data[edit]

Wikivoyage originally used POImap2, which expected GPX tracks and boundaries. This has now been replaced by mw:Extension:Kartographer, which uses GeoJSON.

Creating a GPX for conversion[edit]

It is possible to generate the needed data by creating a GPX track and then converting to GeoJSON. To create the boundaries that designate the area (example) or GPX tracks for an itinerary (example) then the following steps are necessary:

  1. Generate the boundary or track data
    Option #1: Download the data directly from OpenStreetMap.org:
    1. Download JOSM, which is an editor for OpenStreetMap data.
    2. Find the boundary or route object in OpenStreetMap that you are interested in. For example, if looking for city boundaries:
      1. Navigate to the desired city on openstreetmap.org
      2. Click on the "?" icon to query features.
      3. Click on the map at a point you are interested in (for example, the city name if generating city boundaries).
      4. After clicking, a list of "enclosing features" will appear in the left nav. Select the feature you are interested in (example: "City boundary city name")
      5. You should then see a view of the selected object, and the left nav will show the boundary type and ID, for example "Relation: city name (id)" - remember these values as they will be used in the next step.
    3. In JOSM, go to File → Download Object. Enter the object type and ID that you found on OpenStreetmap. JOSM will then display the object.
    4. Edit the object in JOSM as needed - for example, if there are extraneous objects they can be deleted. In most cases this step should not be necessary.
    5. In JOSM go to File → Save As, choose "GPX files" as the file type, and use any file name you like.
    Option #2: Create a trace yourself:
    1. Use a route editor like Gnuher. Do not use Google Maps to trace a boundary/track - Google maps licensing is incompatible with the OSM license.
    2. Create a track by clicking the map at different points. Save as mytrack [TRACK].
  2. Go to the Wikivoyage GPX formatter tool and upload the GPX file you just created. This tool will reformat the information into a format that can be consumed by the Wikivoyage map tools. Verify that the map preview shown at the bottom of the page after submitting matches what you expect. If the map is not what you expect you will need to modify the GPX data. If you are not sure what needs to be done ask for help from other Wikivoyage users.

Various third-party utilities may be used to generate GPX traces, which may then be converted to GeoJSON for use in Wikivoyage:

  • GPX online editor. See online help for instructions. Download as a track.
  • http://gpxcreator.com is a free, open-source Java desktop app which displays an OpenStreetMap and allows a user to trace a path, generating a GPX file. Only minor changes (such as a text editor search-and-replace to remove "elevation=0" from each point) are needed to convert these paths into usable format for itineraries.
  • OpenStreetMap provides JOSM as a utility to generate GPX traces, see http://josm.openstreetmap.de/download/josm.jnlp

Conversion to GeoJSON[edit]

Various online utilities convert GPX or other standard formats to GeoJSON, for example:

Once the track or boundary is in a compatible format, various options allow its use in Wikivoyage:

See Trans-Siberian Railway for an example of a direct call to <maplink> to draw an itinerary across Russia. The <maplink> co-ordinates are in the article, at the end of the page.

See St. Petersburg for an example of Commons as a data source, data from commons:Data:Saint_Petersburg_Districts.map is transcluded with:

{{Mapframe|59.92|30.24|30.30|zoom=9|show=other}}
<maplink class="no-icon" text="" group="other">
{
  "type": "ExternalData",
  "service": "page",
  "title": "Saint_Petersburg_Districts.map"
}</maplink>

The {{GPX}} template subpages are now deprecated. User:Yurik/Sandbox/Gpx1 and User:Yurik/Sandbox/Gpx2 contain converted versions of the existing GPX traces which were already in Wikivoyage at the time mw:Extension:Kartographer was deployed. These may be imported back to the original articles by removing the (lat, long, zoom) parameters - allowing the new {{mapframe}} to autodetect the correct scale and extents. Special:Diff/3142916/3207633 is an import of one of these maps onto Trans-Labrador Highway, for example. (See also phab:T154908 and phab:T137677.)

See also[edit]