User:SHB2000/Getting a line on an itinerary

A simple guide to getting a line marker for an itinerary. Such examples where it can be seen are Quebec Route 389, Stuart Highway, Oxley Highway, E8 through Finland and Norway, Tourist Drive 33 or Trans-Labrador Highway. This can also be used for getting hiking trails on a map, as seen in pages such as Mungo National Park.

If you're having difficulties or having issues with the line markers, see the troubleshooting section.

This is needed if the itinerary route doesn't exist at OpenStreetMap, or linking is too much of a hassle for your needs. Often the route should be moved to Wikimedia Commons' data: namespace, but that step is not covered here, and it can be handled later.

Step 1
You will need to go to geojson.io and then use the line tool on the right in the map frame. Then map out your route and click the last point to finish your line off. Be aware that this can take a really long time though, but the result pays the price. Do not close the tab. Keep it open, as it'll be needed for step 4.

Step 2
To add the map, insert the following code in the article, where you want your map:

Add any parameters from mapframe, if you want some tailoring.

Step 3
Go to the very bottom of the article, below everything, add the following code in: Fill the latitude and longitude in. If you want it to autoalign, then simply remove those words, and it'll look something like this:

Keep the  like it is, and do not enter anything into it. Adjust the zoom if you wish, although it's the zoom on that will matter.

Step 4
Now paste the json code that you've drawn on geojson.io between the maplinks. Basically something like

So an example of it would look like:

Then, you should all be done and your map should be showing the line.

Branching routes
If there is a branch on your route, then you need one more line. You may note that  is plural. The "[" starts a (comma separated) list and the first "{" after it starts the first line (or whatever). You can just plot your next line at geojson.io to get both lines at the same time and paste them in as if you had just one line.

If you already closed your geojson.io window, you can go to the site again, paste in your code into the json window and then plot the second line. The other option is to copy just the code that pertains to the second line, and make sure you get the "{"s, "["s, commas and line headers right. You might also want to add a comment on what each line is about; comments in the json code start with double slash ("//") and extend to the end of the code line.

In some cases you want two separate routes. Then do as with the first line, adding a new &lt;maplink ... >&lt;/maplink> section, with  instead of. In the full screen map window you will now have route1 and route2 as separate layers, which can be activated and deactivated separately. As default up to five separate routes can be added. If you have more, or they have names (specified in group="name") other than the standard ones, you need to add the  parameter to the mapframe:   (the template adds the standard routes and markers).

If you want your lines colour coded, add that property into the, e.g. as   for a green line. The 00FF00 are the RGB values in hexadecimal: here 00 for red, FF for green and 00 for blue. If you're unsure which colour to use, simply google up "hex color picker" and where you'll then be able to choose a colour. Note that sometimes typing up the Commonwealth spelling of "hex colour picker" may not always provide results.

Duplicate routes
Like branching routes, you'll also need more than one line if you need to duplicate your route (e.g. if the route goes on a freeway or a divided highway). Whilst there may not be much of a difference at first, it's very noticeable when you zoom in. See User:SHB2000/Getting a line on an itinerary/1 for an example of how a duplicated route would look like.

Q: I'm getting a red box that says the following
.

For this to work, the other markers should be mentioned along city,route1,... Easier to use the default, without the show parameter. Mostly it will be enough with without anything.

Q: Does this work on toggleable maps?
A: It should. However, toggleable maps mean that you don't have the option to add any more values apart from route1,route2 etc. Since that's the case, then use  for all the maplines that you add. If you do wish to categorise it, use invisible text

Q: It just doesn't work
A: If any more help is needed then just bring up the issue on the pub and someone will eventually find the issue. Try to explain clearly what you are trying to do and what specifically doesn't work.