|
Hi, in this tutorial I'll show you how to create your own maps using OpenStreetMap. These are the requirements needed to repeat the examples given below:
JOSM, stands for Java OpenStreetMap editor, is a tool to download and edit maps created by the OpenStreetMap community. In this section I'm going to show you how to install and run the JOSM editor.
First you need to go to the JOSM download site (http://josm.openstreetmap.de/) and get the latest version. At the bottom of the page you'll find the 'download' link. Save the 'josm-latest.jar' file on your desktop for now.
To install the software you need to open a terminal window (hint: cmd-space + type 'terminal').

From now on we will type commands in this terminal window. Create a new directory by typing the command:
mkdir openstreetmap

Change your working directory to this new directory with the command:
cd openstreetmap
Install the JOSM into this directory with the command:
cp ~/Desktop/josm-latest.jar .[which stands for: copy the josm-lastest.jar file from your Desktop to the current directory]
Let's check if everything worked fine by running the JOSM editor with this command:
java -jar josm-latest.jar

If everything is okay, you should have the JOSM editor application now running.

Question:What steps do you need to follow to start the installed JOSM editor the next time?
Answer: Open a terminal window (cmd-space + 'terminal'). Type: 'cd openstreetmap'. Type: 'java -jar josm-latest.jar'.
Congratulations, you've installed JOSM now it's time to download some data by fetching map. To do this go to the OpenStreemMap website (http://www.openstreetmap.org/). Search for your favorite city e.g. 'Copenhagen'. Click first on a search result and then on the 'view' tab on the top of the webpage. You need to click 'view' to see the exact URL or HTTP address in you browser location bar.

Do you see the URL http://www.openstreetmap.org/?lat=55.68&lon=12.569&zoom=10&layers=B00FTF in the location bar? This URL you will use to download data into the JOSM application.
Now, copy this URL with cmd-c and go to your JOSM application. Open 'File->Download from OSM...':




Question:What steps do you need to follow to download a new map?
Answer: Go with your web browser to http://www.openstreetmap.org, search a city, click on a search result, click on the 'View' tab, copy the web address in the location bar with cmd-v, go to JOSM, File->Download from OSM, paste the address with ctrl-v, press ok, save the map as 'data.osm' in the 'openstreetmap' directory.
To transform the vectorial view of the map into something more artistic is called rendering. We need to process the data.osm file with some tools and calculate all colors, images, streets, waterways we need to put on the map. This is a very resource intensive process, your computer can become quite slow and can require several minutes (or in some case 1/2 to 1 hour) of processing time.
The tool we are going to use is called 'osmarender' and can be downloaded from the Internet. You need to download two files and save them into the 'openstreetmap' directory:
The first file is a features file which tells the osmarender what you want to put on the map. The second file is a stylesheet that directs the actual rendering work. This means, you may need to edit the first file to add or delete features, but you don't touch the second file.For now we don't touch anything. Let's try to render our 'data.osm' file. Open a terminal (hint: cmd-space + 'terminal'). And go to the 'openstreetmap' directory (hint: 'cd openstreetmap'). Now, run the following command:
xsltproc osm-map-features-z17.xml > copenhagen.svg(which means: start some rendering process with help of the feature map and save the results in the file copenhagen.svg). You will get a lot of messages on the screen and after a while (on my laptop about 5-6 minutes) the render process should be finished.

To view the map programs like 'Inkscape' can be used. Be aware that the resulting maps are quite large. It takes therefor quite some processing power to open the resulting copenhagen.svg file in Inkscape. On my laptop it takes about 1-2 minutes and results into quite slow response times. This you have to live with, these maps are very big, you need quite a bit of RAM to handle them.

To export these files to programs like Adobe Illustrator, EPS files need to be created. This can be done using the Inkscape graphical interface (File->Save As->copenhagen.eps), but at the time of writing this couldn't be done on very large maps due to a bug in one of the underlying system tools. What you need is the Inkscape command line tools. They require less RAM and gives you a better ability to process very large files. To create an EPS file from a SVG file use this command in your terminal window:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape -E copenhagen.eps copenhagen.svgHere copenhagen.svg is the result of the render process above, and copenhagen.eps is the file you want to create. On my laptop it takes about 2-3 minutes to do the conversion. When rendering and converting files you need to close as many applications as possible, because you'll need all the system resources you can get.

Question: What steps do you need to render a EPS map?
Answer: open a terminal, go into the 'openstreetmap' directory, run the command 'xsltproc osm-map-features-z17.xml > copenhagen.svg', when finished, run the command '/Applications/Inkscape.app/Contents/Resources/bin/inkscape -E copenhagen.eps copenhagen.svg'.
The end result of the render and conversion process may not be what you really want. You may want the map to look a bit different from the results you get. In this section I'm going to explain some of the rendering features you can change quite easily. This subject is very extensive, this section given only an introduction.
To change the features of a rendered map you need to edit the ...features file, indeed. For this we'll use the TextMate editor. Go to you terminal window and type:
mate osm-map-features-z17.xmlYou'll see the following XML file:

xmlwf osm-map-features-z17.xmlIf you don't see any error messages, them everything is fine. With the new feature file you can rerender and convert the map. If you don't remember the steps, then look at the quiz of the previous section.
Deleting features is also possible. E.g. you don't like the parking icons on the map and want them removed. Open again the feture file with 'mate osm-map-features-z17.xml', and search for 'parking' in the file (hint: cmd-f + 'parking' enter). You will see a rule like:

Using the technique above you can delete many features. You have to remember you need always to delete features from <rule> untill </rule>.