Table of Contents
This project is a fork of gitorious/osmatravel and intends to automate map-generation for Wikitravel articles.
It is an updated and slightly different process which tries to generate maps without much intervention. Thus it should allow the quick generation of maps even for smaller articles without much work effort.
The installation is straightforward, but requires a unix system, preferably Linux/Ubuntu:
Also make sure, you have xmlstarlet, inkscape and gimp installed.
The key requirements are:
- Select the destination area bbox url.
- Synchronize listing-entries in the article and name-tags in OSM.
- Add the image to the article:
See Variables for further customization.
- Install osmatravel and run:
echo ARTICLE=Town > Config.mk; make
- Upload the image (either by hand or use make upload-svg && make upload-png)
- Most steps are still the same as in the original article
- The old argument styles do not work anymore, see Variables.
- The selected bbox area has a certain width and height, however this area is then adjust so that the map fill the actual specified width and height (size argument). This creates space either at the left or the bottom, where the listing boxes are then placed.
- If further modifications / adjustments are needed it would be a good idea to adjust the code instead of individual maps / svg-files. Introduce another param, send a patch :)
The following variables can be usid in the image-Tag:
- size: e.g. a4-landscape (default), a3-portrait... etc., 150x200 (width*height in mm)
- zoom: the openstreetmap zoom-factor (1..17, default: 17)
- is_in: used to create the Maps of Town category in the description
- placement: the listing-box placement specification, e.g. bottom-left (default), top-right ...
This also adjusts the map-extension creating free space to fit the size specification at the specified side.
- osm_url: i.e. http://api.openstreetmap.org/api/0.6/map?bbox=...
- border: the name of an relation (instead of relid/osm_url)
- relid: the id of an relation (instead of border/osm_url)
- I do this by starting josm on the commandline, select the download button and select the area that definitely must be in the map. When hitting ok, josm will print the bbox url on the commandline, which can be copied to the article.
- Another way would be to go to http://www.informationfreeway.org/ which shows Lat and Lon. Note down the Koordinates for the bottom-left and the top-right corner of your area. The url is then constructed as follows: http://www.openstreetmap.org/api/0.6/map?bbox=$bottomLeftLongitude,$bottomLeftLatitude,$topRightLongitude,$topRightLatitude
Add <listing name="..." /> for things that shall be on the map and make sure these nodes / ways are available in openstreetmap as well (also check to see that the other name="..." tags in the listings match the name or name:en tag in OSM. Only elements using the <listing> or <sleep> or <eat> etc. tags will be considered.
1. Install pywikipedia (see Installation)
2. Configure pywikipedia. Create the file pywikipedia/user_config.py:
# -*- coding: utf-8 -*- family = 'wikitravel_shared' mylang = '' usernames['wikitravel_shared']['wikitravel_shared'] = u'YOUR_USERNAME' password_file = 'wikitravel-password'
3. Store your wikitravel-shared password:
echo "('YOUR_USERNAME', 'YOUR_PASSWORD')" > pywikipedia/wikitravel-password chmod 600 pywikipedia/wikitravel-password
4. Upload your generated maps:
make upload-svg make upload-png
You can use multiple maps per article. Each image must be name Town_$part_map_with_listings.png. You must then supply a MAP=$part argument whenever invoking a make command, e.g.:
make MAP=center make MAP=center upload-png make MAP=overview make MAP=overview upload-png
An additional feature is, that you can limit listings to show up only in certain maps. This is controlled by the map attribute. Any listing without the attribute shows up in all maps (unless it's not in its bbox). Example:
<listing name="Train station">shows up in all maps</listing> <sleep name="Hotel Central" map="center">shows only in center map</sleep>
You can specify multiple maps comma-separated.
Overlays are useful to indicate further information and especially required for overview maps. They are also very easy to produce:
Now edit using inkscape, select the Overlay layer and draw whatever needs to go on the map as well. When finished, delete all other layers, save the file as Town_overlay.svg (or Town_$part_overlay.svg if using multiple maps) and upload it to wikitravel:
python pywikipedia/upload.py -keep -noverify Town_overlay.svg rm overlay_page.html
Now recreate the map:
- Place listings that are not in OSM, but have lat and lon attributes on the map. If a listing is present in OSM but has lat/lon attributes, these should override the OSM location. This allows better placement for visual clearity.
- create a webservice (similar to the Navit one) that allows bbox selection and automatically suggests paper-sizes for the selected zoom-level
- create a webservice that generates the maps (svg-files)