YOU CAN EDIT THIS PAGE! Just click any blue "Edit" link and start writing!

Difference between revisions of "Wikitravel talk:How to create a map"

From Wikitravel
Jump to: navigation, search
(WTP-Maps app)
(WTP-Maps app)
Line 221: Line 221:
: Check with [[User:Mark]], it's his code and server. [[User:Jpatokal|Jpatokal]] 08:47, 14 September 2009 (EDT)
: Check with [[User:Mark]], it's his code and server. [[User:Jpatokal|Jpatokal]] 08:47, 14 September 2009 (EDT)
:In fact it's the original Wikitravel server, however the code is now on Gitorious as per the article. -- [[User:Mark|Mark]] 00:52, 29 September 2009 (EDT)

Revision as of 04:56, 29 September 2009


Can one of you buy a Mac and write up a how to for those of us with real computers?  ;) – cacahuate talk 00:21, 17 June 2008 (EDT)

Wish I could! Macs are not big in South Africa, they became popular in the USA during the time South Africa was sanctioned and was never distributed here. One can buy them now, but they are horribly expensive and support if something goes wrong is few and far between. That's probably somethings I need to include somewhere in the South African article: If you decide to carry your Mac around while traveling South Africa, take good care of it and make sure you don't drop it; if you do, you will find it very difficult to get repaired. --Nick 01:59, 17 June 2008 (EDT)
Darcs, Osmarender and the rest should work without too much tweaking on OS X as well...? Is there any part of the instructions that you're having trouble with? Jpatokal 05:59, 12 July 2008 (EDT)
I do all of this stuff on a MacBook, as well as on my Kubuntu linux laptop. -- Mark 15:07, 12 July 2008 (EDT)
Damn you both. I'll try again – cacahuate talk 01:24, 13 July 2008 (EDT)
Maybe I'm missing something, but I can't even figure out how to install xml starlet... I don't see instructions on their website, and when I download the files it launches in Real Player, and then freezes the program – cacahuate talk 22:42, 20 September 2008 (EDT)

Custom layers on OpenStreetMap

Greetings from State of the Map 2008 in Limerick. It turns out that adding your own layers as overlays on OSM data is surprisingly easy, allowing you to create stuff like this:

Note that the icons are even clickable. I'll try to roll out a demo with Wikitravel data once I get back home... Jpatokal 05:22, 12 July 2008 (EDT)

What if i dont use Ubuntu?

Would there happen to be a windows or dos version of xmlstarlet which someone has found to work? I might install Ubuntu, once i figure out how to swap back and forth easily (with virtual box) ... unfortunately i haven't :( --Acrosscanadatrails 02:36, 19 November 2008 (EST)

I think it should build under Cygwin too. -- Mark 09:49, 28 February 2009 (EST)

Map distances

Hi, I just basically wanted to point out that a map is helpful, but without a distances bar, not so much. It would be cool if there was an option to have a small

- - - - - - - - - - - - -

0m         500m

or whatever in one of the corners, so people know what to expect. Some maps may seem like they are walking maps, but may be on such a scale that you would need hours instead of minutes to walk from one place to the next. This would be really helpful in my opinion FreakRob 08:07, 20 November 2008 (EST)

Problem with and the make command


I'm trying to create a map for the first time and am running into problems. I've downloaded all the software. I've edited, changing the destination to Kilkenny, my home town. I've downloaded the data.osm. When I run make, it works, but I get a map of Paris.

I've tried to change the other settings in (BORDER, IS_IN) as some refer to Paris, but I keep getting errors:

:~/Kilkenny$ make
wget -q -O article.xml
xmlstarlet sel -N mw= -t -v "/mw:mediawiki/mw:page/mw:revision/mw:text"
article.xml | xmlstarlet unesc >
echo '<listings>' > listings.xml
sed 's/&/\&/g' < >> listings.xml
echo '</listings>' >> listings.xml
wget -q -O rels.xml ""
xmlstarlet sel -t -m "/osm" -v "relation[tag/@k = 'Is_In' and tag/@v = 'County Kilkenny']/@id" rels.xml > relid
wget -q -O relation.xml "`cat relid`/full"
make: *** [relation.xml] Error 1
make: *** Deleting file `relation.xml'

Can anyone help me?

Thanks, Aine

Pinkfluffybrick 00:14, 25 February 2009 (EST)

Hi Aine,
I'll try to help you with this. The first thing you need to do to get this to work is to create a border "relation" around Kilkenny in OSM. You can do this by adding ways to a relation, and then naming it a border. It's probably also a good idea to give the relation an "Is_In" tag, which will help identify it.
The next step is to edit so that the wget commands in the make process find the Relation you've just made.
Now, if you like I could set all of this up for you. Would you rather I do that, or would you like for me to help you figure it out? -- Mark 08:34, 27 February 2009 (EST)
I think there's a problem in my trigonometry in the XSL. I've drawn a border around Kilkenny, but for some reason the computation comes out just to the west, so we wind up with the airfield instead of the town. I'll see if I can debug it. -- Mark 02:25, 28 February 2009 (EST)
It was a simple matter of declaring a couple of sorts to be numeric rather than text. I'm about to upload a new patch to the repository, which should get you all fixed up. Here's the that I'm using:

################### SETTINGS ######################

# The name of the article in Wikitravel
ARTICLE = Kilkenny

# The name of the border way in OSM
# this is specified in OSM with a name tag
BORDER = Kilkenny

# The parent place in OSM
# this is specifed in OSM with an Is_In tag
IS_IN = "County_Kilkenny"

# ORIENTATION can be either "landscape" or "portrait"
ORIENTATION = landscape

# SIZE can be "one-page" or "two-page"
SIZE = two-page

# Do you want a bell to ring when everything is done? (yes or no)
BELL = yes

# How should the listings boxes be placed (manual or auto )

# If using auto listings placement should expand the map to fit them?
# ( yes or no )
I forgot to mention, to get the new patches all you have to do is:
darcs pull -a
In the directory with your repository. -- Mark 05:15, 1 March 2009 (EST)

Creating maps without relations

It would be nice if map creation worked without relations... but it doesn't at the moment, so I'm snipping this out. Jpatokal 10:29, 17 March 2009 (EDT)

OSM Export screen
  • Once you are satisfied that everything is in place, click the [Export] tab and move the view so you can see the desired map area. Note that you will not see the changes you just made, but don't worry: they have been saved, it just takes a view (up to a day) until the OSM website gets around to rendering them.
  • Select "Format to export" as "OpenStreetMap XML Data" and download the resulting file. Name it data.osm and move it to your working directory.
    • The exporting can take several minutes if you're downloading a large chunk of a big city, so be patient. If your browser times out, try downloading the URL ( with the command line tool wget.

Maps for users without Linux access

  1. Go to and find the area you want to map.
  2. Hit the Export tab, and select the relevant area, you can draw a box manually, or just adjust the view to fit your requirements.
  3. Select Mapnik Image, set the format to SVG , and set the Scale to your demands (exported files tend to be quite large), and hit Export to get your SVG file.
  4. Open the image in Inkscape, now you need to change to colours to fit wikitravel standards, so hit CTRL+F and insert the colour value of the item you need to change - you can check that by selecting an item with the Edit paths by node tool, hitting SHIFT+CTRL+X and check the rgb value in the style attribute, or just use the table below. Insert the value in the Style box in the CTRL+F (Find) dialog and hit search, and inkscape will now select all items in the svg of that colour, change it to the correct colour (SHIT+CTRL+F), can either be stroke colour or fill colour depending on the item. Repeat the process until you've changed all the colours to wikitravel style.
Style attribute To colour Type Notes
rgb(99.607843%,84.313725%,64.705882%) FFFFFFF stroke colour Roads
rgb(100%,100%,70.196078%) FFFFFFF stroke colour Roads
rgb(92.54902%,59.607843%,60.392157%) FFFFFF stroke colour Roads
rgb(66.27451%,85.882353%,66.27451%) FFFFFF stroke colour Motorways, you can also choose red.
rgb(80%,60%,60%) bdb580ff fill colour) Buildings
rgb(71.372549%,99.215686%,71.372549%) 89c736ff fill colour Parks
rgb(54.117647%,82.745098%,68.627451%) 89c736ff fill colour Parks
rgb(78.431373%,69.019608%,51.764706%) 89c736ff fill colour Parks
rgb(94.901961%,93.72549%,91.372549%) d0d0d0ff fill colour Gray background
rgb(70.980392%,81.568627%,81.568627%) 9ccec9ff fill colour Water
rgb(20%,80%,60%) 89c736ff fill colour Parks
stroke-dasharray Delete Path Overlay
stroke-opacity: 0.4 d0cb75ff stroke colour) Paths
an example of a map created with this method

There are probably some items missed on that table, select them with the Edit paths by nodes tool and change to colour either by the same method as above, or just directly will the fill/stoke colour toolbox.

Text Unfortunantly the text in these SVG maps are imported as paths, nothing to do about this, but let's clean it up a bit, hit CTRL+F again and seach for use in the ID box, and delete the items selected - this will remove all the text, but don't worry. hit CTRL+F again and seach for stroke-miterlimit: 10 in the style box. set the stroke colour to no colour, and set fill to black. Now we probably need to increase the text size a bit, so hit CTRL+SHIFT+M, select the Scale tab, and increase the size by 120%-150% (depending dense text is on your map).

The results leave alot to be desired in terms of readability of street names etc, but is largely preferred over the no maps, or colour schemes. But please do use the Linux method if at all possible, as it's a much better solution. But now you have a WT style map, go ahead and populate it with listings from the map template, and upload it for all the world to see :). Also note, that while this method seems very complicated and time consuming at first, I'm down to under 5 minutes from import to a WT colour scheme map ready for listings.

Any questions, please feel free to contact me on my talk page --Stefan (sertmann) Talk 12:30, 17 March 2009 (EDT)

I thought we'd switched to a slightly different color scheme -- particularly a darker green for parks. LtPowers 15:42, 17 March 2009 (EDT)
OK, I've used the colours from a copy of Wikitravel-map-template-PD.svg that I have lying around on my harddrive, has that been updated? --Stefan (sertmann) Talk 16:42, 17 March 2009 (EDT)
That's awesome, Stefan. Thanks! I knew if I procrastinated long enough on city maps it would eventually get easier. :-) The updated colour scheme is at Wikitravel talk:How to draw a map#Increasing color contrast for better printing. -- Shaund 21:18, 17 March 2009 (EDT)
Oh yes, I didn't mean to imply dissatisfaction by my minor criticism. =) I can't wait to try this out and see how it works. LtPowers 22:37, 17 March 2009 (EDT)
Thank you for posting this! After a bit of trial and error, I got a map made using this method. One question though - is there any possible way to trim to filesize of the svg image? Because it is massive, and that's after I tried getting rid of anything unnecessary in the file. PerryPlanet Talk 21:59, 27 March 2009 (EDT)
Do the paths have a ton of vertices in them? If so, you might want to try (in Inkscape) a Ctrl+L (simplify) operation. Simplifying a path once or twice can often make the path much cleaner without affecting the appearance much. LtPowers 11:22, 28 March 2009 (EDT)
At work now, but i'll try that out later - though, I don't think that's the problem, maybe merging similar paths can help on the situation. If we are more people trying this out, we may device a much better solution - so please try stuff out. --Stefan (sertmann) Talk 12:09, 28 March 2009 (EDT)
Lt - That did help a little, but only a little. The filesize probably dropped down maybe .2 or .3 MB, but considering we're talking 4MB files, it's not very much. PerryPlanet Talk 12:26, 28 March 2009 (EDT)
The trick for working on oversized svgs is to separate content into layers and only work on one at a time--with all other separated layers turned off. Simplifying the road paths (which loses little quality on the OSM exports) also helps. And vacuum defs after any major change, which will keep that file size down. This + deleting extraneous information (which is not always immediately visible) can bring down your file size quickly—my initial 5.5MB file is now around 1.5MB.
Big thanks to Stefan on this! I was wondering what you were up to. The tips on using the find section are invaluable. Lastly, I recommend thinning out the street paths (using the %size change under stroke style) to clear more space for icons, and to de-clutter maps of larger areas. --Peter Talk 12:40, 29 March 2009 (EDT)
Wow. Vacuuming the defs really did the trick! My 4.3MB file dropped to a measly 1.7MB! Thanks! PerryPlanet Talk 14:34, 29 March 2009 (EDT)
Excellent! Can someone do a write up of this, and include instructions on how to deal with the defs? Perhaps then we can proceed to move this out of talk space? It's not that I don't want to do it, but I think my English abilities limits me, in making something this complex, clear to casual mappers and inkscape users. --Stefan (sertmann) Talk 14:40, 29 March 2009 (EDT)
I'll be happy to—I'll try to do that today. --Peter Talk 14:43, 29 March 2009 (EDT)
I have now added the how to section. It probably could stand to be edited for clarity, and to reduce the influence of any idiosyncratic practices I am using (I tend to be more anal about maps than most). I also uploaded a very simplified (albeit oddly large in file size) template containing the PD symbols and high contrast colors/patterns, and linked it from the how to guide. --Peter Talk 19:20, 29 March 2009 (EDT)

Does anyone know what font OSM uses as its default? --Peter Talk 20:09, 29 March 2009 (EDT)

If you want to know about the default osmarender rendering, look here [1]. If you want to know about detault mapnik rendering look here [2]. Of course, there are more OSM renderers than I've had hot dinners. --Inas 21:20, 29 March 2009 (EDT)
Um, if editing the hex colours of a few xml stylesheets is all it takes, wouldn't it be perfectly feasible to construct a OSM renderer to fit our style, using mapnik and it's SVG capabilities as a template? not that I know anything about this, but juuuust a thought --Stefan (sertmann) Talk 21:56, 29 March 2009 (EDT)
osmarender is a (reasonbly simple) xslt script to map the OSM XML format to SVG. It then uses inkscape to render the resulting SVG, and build the OSM tiles. To hang osmarender to extract a few features for a svg that are the right colours and fonts would be easy. osmarender generated maps almost always need some tweaking to look like high quality maps, but it could save some work if we wanted to adopt a set of standards. All that really needs to be defined is the bounding box for the extract. --Inas 22:37, 29 March 2009 (EDT)
Yeah, but aren't we then back to something that requires Linux - where we already have a nearly automated process? --Stefan (sertmann) Talk 22:45, 29 March 2009 (EDT)
Not at all. I run the entire process on windows no problem. xmlstar runs the xslt process. inkscape command line works fine. just needs memory, lots of cpu cycles, and a stable version of inkscape. --Inas 22:53, 29 March 2009 (EDT)
Sorry - inkscape commend line is only required to generate the tile. All you need to do generate the svg is xmlstar and the xslt (osmarender), once you have extracted the right bounding box, using osmosis, or similar. --Inas 23:01, 29 March 2009 (EDT)

Wikimedia and OSM hooking up

The Wikimedia Foundation is working on adding OSM support to MediaWiki, which means that scrollable/zoomable slippy maps can embedded on Wiki pages:

This would be great functionality for Wikitravel as well. Jpatokal 21:58, 4 April 2009 (EDT)

WTP-Maps app

Since a hard disk crash have robbed me of all the svg source files for the Copenhagen maps, I was trying to take the Linux approach, but the wikievent repository is dead, what gives? any alternative sources for wtp-maps? --Stefan (sertmann) Talk 05:49, 14 September 2009 (EDT)

Check with User:Mark, it's his code and server. Jpatokal 08:47, 14 September 2009 (EDT)
In fact it's the original Wikitravel server, however the code is now on Gitorious as per the article. -- Mark 00:52, 29 September 2009 (EDT)