来自维基导游
参见:Wikivoyage:如何使用动态地图


在这个卫星和GPS的时代,你不再需要是一个专业的绘图师就能绘制一幅准确的地图。下面将介绍如何使用Inkscape中绘制一幅标准的维基导游地图。(一款免费的绘图程序,可在大部分系统中使用。)使用其他绘图程序的过程是类似的。

概览[编辑]

维基导游中的地图由SVG格式的文件组成(可缩放矢量图像)。这些文件包含显示为“矢量”的对象——图形可以在任何倍率下都不会出现锯齿。在维基导游中,这些矢量用来代表街道、地域特色等。

Inkscape's logic是基于将矢量、图标和文本等“不同对象”的组建到“不同图层”的结构而生成的SVG文件。

当SVG地图制成以后,需要导出一份PNG(便携式网络图形)格式的位图文件,因为所有网络浏览器都可以显示PNG图像。不过,两个版本的文件都应该上传:一个(SVG)用于将来的编辑,另一个(PNG)则用在维基导游的条目中。

华盛顿特区西区的地图——一个业余用户通过以下指南所创建

工具[编辑]

你可能需要用到一些工具才能创建地图。其中最关键的就是能生成SVG格式文件的基于矢量的绘图程序,最好是使用Inkscape

  • Inkscape[1]是一款开源(自由)的工具,支持Windows、Mac OS X和Linux。请使用最新版本避免出现兼容性问题。

也可以使用其他基于矢量的绘图程序(例如,Adobe Illustrator [2]、CorelDRAW [3]、Sodipodi and Freehand),不过这篇文章介绍的是如何使用Inkscape绘制。

此外,你必须安装了这两个字体

  • 用于维基导游地图的DejaVu SansDejaVu Sans Condensed。你可以在这里找到它们。

地图类型与模板[编辑]

在维基导游中有两种重要的地图类型,所以事先确定你的地图属于哪种类型是很重要的,因为这会影响到要使用哪个模板。

市、区、街道地图[编辑]

此类型地图用来展示一个城区范围。最适合使用在通过小城市条目模板创建的条目中,使用在通过公园条目模板创建的条目中也是可以的。

此类型的地图模板可以在这里下载到。下面是市/区街道地图的范例,也许你能从中找到一些灵感。这两者都是使用同一个地图模板创建的。(点击图片放大)

杜邦环岛(Dupont Circle)地图是一个小城区详细的街道地图。伦敦汉普斯特德的地图覆盖了很大的范围因此细节方面有些不足(但仍然可观)。

国家、地区地图[编辑]

此类型地图用来展示一个国家或地区的范围。适用于使用国家地区大城市条目模板创建的条目。

维基导游中有专门致力于国家/地区地图制作的远征队。如果你计划绘制此类型的地图,那么我们强烈建议你去看看考虑加入该远征。对于调色、符号使用及你关于国家、地区地图的其他的细节信息,请参考地区地图远征队及[[talk:Project:地区地图远征队|讨论页]]。

地区地图模板可以在这里找到。下面是三种不同的地区地图范例,也许能对你自己制作地图有一些帮助。三者都是使用同一个地图模板创建的。(点击图片放大)

泰国国家地图展示了该国的不同地区、主要交通路线和主要目的地。芝加哥地图包括了范围内的城市、交通主干道及主要区划。中国国家地图展示了主要的地区和目的地。

专门地图[编辑]

此外,还有一些专门的地图类型,如潜水点古迹。如果你计划绘制这种性质的专门地图,那么我们建议你去下载一个已存在的SVG地图图像然后去了解并采用此方面的结构和风格。

创建地图[编辑]

在开始创建你自己的地图之前,先在Inkscape里打开几个已存在的地图(SVG格式的)看看其他的维基向导如何处理的,找找感觉。

下面的说明和建议主要针对市、区、街道的地图。一旦你掌握了这种类型的地图,其他类型的地图如国家、地区地图也就没有问题了。

选项[编辑]

以下是地图制作的四点建议:

一、快速地图,简单地从OpenStreetMap.org复制地图,没有具体的旅游信息;

二、手绘地图,根据一个基础图像;

三、从OSM导入SVG,然后在Inkscapeand中处理一下;

四、用ShareMap.org生成地图

当然,你也可以在维基共享资源里面找找看有没有能用在维基导游上面的SVG格式地图,进行修改,以复合维基导游标准格式的美感,最后还要加上旅行图标和注释。

快速地图[编辑]

这三个简单的步骤可以用来创建简单的城市街道地图。

  1. 浏览openstreetmap.org,找到选定的目的地。
  2. 点击导出数据按钮。确保选中了“Mapnik Image”且“图片尺寸”合适(最好介于2000x2000至3000x3000之间)。点击输出按钮下载。
  3. 更改默认的“map.png”为更合适的名称,上传到维基共享资源。完成!

手绘地图[编辑]

手绘地图将潜在著最优雅且最准确的(当在一个高品质的卫星基本图像追踪),以及起初如何在SVG档逐渐熟悉中最好的方式运作,因为您会从一开始就使用这些!

得到一个基本图像[编辑]

为了追踪新的地图,你将需要一个现有的地图或其它图像来追踪它(必须符合我们的非营利版权,无论是在公共领域上,或是在适当的创用CC授权兼容)。以下有多种可能来源:

  • OpenStreetMap.org [4] (简称:OSM)是寻找具有街道级别的细节与现有地图的最佳场所。(有可能从OpenStreetMap使用导出的SVG档,并由此消除了任何追踪的需要。参见#从OSM导入SVG以用于详细说明。)
  • 佩里 - 卡斯塔涅达图书馆所收藏的地图[5]联合国制图科[6],是对现有的国家地图提供良好来源(虽然他们提供的道路网并非总是准确的)。但是在维基导游的地区地图远征队,已经完成了世界上所有国家的最后一哩路,所以两大网站的道路网在维基导游已经变得不那么重要了!
  • 在陆地卫星全球马赛克是由NASA WorldWind[7]所有的卫星图像(除了i-3可视层),Blue Marble和 USGS层为公共领域,因此符合我们的公共版权依据,他们还甚至不要求署名完全兼容。然而不幸的是,通常将不会在可用于美国之外地理位置的公共领域与足够高的分辨率图像。

基本图像应被导入到您自己的地图档(图层,添加图层)来创建一个新的图层。我们建议您对应这一层的基地

定义背景[编辑]

建立一个新图层为背景,并使用贝塞尔笔(左侧工具栏上的笔符号)标记出这图层的范围作为对象,以配合您的地图大小。

根据您的地图上的位置,你需要使用灰色来填充背景图层或使用维基导游水滴图案。这是透过选择物件来实现,从顶部选单中单击物件,然后进行填入描边(键盘捷径:shift+ctrl+f)。 在出现的选单中,以使用中等灰色来进行填入8e908dff到RGBA框里(或选择从模板来使用滴管以填入这个颜色)和使用水滴物件,选择棋盘图形按钮,然后从下拉式框中选pattern8479。请不要使用描边。

现在应该知道有哪些是来掩盖包含基本图像来填满背景底层吧!请再次选入显示基本图像,饱和度于选单框的填满和描边,使用不透明度滑块去色填满背景层。透过使用它来调降到20%左右,您应该能够清楚地看到您的基本图像了。您也可以透过点击图层框眼睛标志关闭所选的图层。

定义前景[编辑]

创建您的主地图图层。我们建议您呼叫一个图层前景。再次使用贝塞尔笔,以布置地图的区域。

完成后,请修改这些属性,以反映您的主地图区域所需浅灰色区域。请使用填入:d0d0d0ff,但不要选择描边。

当然,您不应该看到自己想要的地图区域为完全填满吧!如同以背景图层为例,您所见到这些的基本图像,您将会需要使用不透明度滑块,以去饱和与填满或关闭该层。

创建街道网格[编辑]

令人讨厌的贝塞尔笔

如果您没有任何图形绘制的经验,您可能会发现贝塞尔工具起初有点笨拙。但经历过了一段时间后,您很快就能布置出美丽的精确曲线了;该“编辑路径节点”工具(F2),可用于删除或在曲线调整点。

创建一个新图层,来呼叫街道与提起这图层到顶部(shift+ctrl+home)。

使用贝塞尔笔工具来布置地图的道路网格。道路应该是白色的,所以设置描边颜色为ffffffff,且不填满颜色

设置测量单位为描边宽度到毫米(毫米比像素更容易显现!)。描边宽度应设为正在追踪道路的适当宽度。您几乎肯定会在地图上以不同道路宽度,以及更容易追踪每一个共同宽度。保持组织好街道的一个好方法,就是相同的宽度路径合并成一个路径。这样一做,就很容易地从“路径”选单中选择一个以上的路径,然后选择“合并”(ctrl+k)。

如果您想显示任何其他运输路线,如轻轨、地铁列车和铁路路线等,现在应该绘制出并添加到一个单独的图层。请使用描边颜色且在您的地图上选择最好宽度。

要建立一个黑白虚线的铁路线(获得许多维基导游地图绘制者的青睐),请创建一个纯黑色(或白色)的线,并复制它(ctrl+d),然后设定重复行线填满为白色,从描边样式选择虚线框(ctrl+shift+f)。

有时理想的显示行人、小径、行人道路等,这应该使用虚线来完成,以描边颜色为eeeccbff。

绘制地理[编辑]

Pattern pathologies

Inkscape doesn't handle patterns very well. You will notice that patterned objects often display transparent gridlines, and that you seemingly cannot control the scale of the pattern.

The first problem is easily solved by duplicating the patterned object (ctrl+d), moving the duplicate below the original (PgDn/END) and then using the eyedropper tool to set the fill color to the background (green for parks, blue for water) from the original.

For the second problem, there actually is a way to scale patterns in Inkscape, though it is exceptionally well hidden. Select the patterned object with the node editor (F2). Then scroll to the left (often very far to the left), where you will see a square/circle/x "box". By clicking and dragging the square handle, you can scale the pattern.

Create a new layer called Geography and bring that layer to the top (shift+ctrl+home).

Lay out any green spaces, again using the Bézier pen, this time with the Wikivoyage park pattern as fill (pattern15875), stroke color 406c86ff and a stroke width of 0.05mm. If the green area fills up an entire city block between streets, you can set stroke off, draw the area so it overlaps the streets, and then just push the layer down later.

Follow the same process for any bodies of water but use fill: pattern8479, stroke colour: 406c86ff, stroke width: 0.05mm.

Rivers should ideally be drawn with a stroke colour matching the pattern color for water (9ccec9ff), but if they are not showing up clearly enough, try something like 053bd7ff. The stroke width should match the scale of the river you are tracing.

Once this layer is complete, set it to be the layer below the Streets layer and below other transportation layers. Moving layers up and down is relatively straightforward in Inkscape. You can do this either by selecting layer, then raise layer or lower layer, or by using the shortcuts of shift+ctrl+PgUp and shift+ctrl+PgDn.

主要建筑[编辑]

If (only if) your map contains any major buildings or landmarks which you wish to be defined, create a layer above Main area later called Buildings and draw them there. For these the fill color is 8e908dff, the stroke color is 808080ff and the stroke width is again 0.05mm.

标签[编辑]

Create a new layer called Street names and bring that layer to the top (shift+ctrl+home).

It's generally best to use the DejaVu Sans bold font, which displays more clearly at small resolutions, especially when printed for offline use. Label each of your streets (or as many as is practical/desirable).

At this stage you can also place any other labels required:

  • Lake or pond names: use font colour 006bffff
  • River names: use font colour 053bd7ff
  • Park names: a label over the top of the park pattern normally looks best in white.
  • Neighbourhood names, building names etc.: often look best in dark grey and not black (e.g.: 1a1a1aff) and italicised.

注解地图[编辑]

您的街道地图现已准备就绪且是时候将其转换成一个旅游指南。

虽然这样做值得重述您的档案结构,但目前应该看起来像以前一样。您必须有以下各层介绍:

  • 街道名称
  • 道路
  • 地理
  • 建筑物(也许)
  • 街道
  • 其他交通路线(也许)
  • 主要区域
  • 背景
  • 基地

Now, create two new layers called Travel icons and Key and bring them to the top.

Depending on the scale of your map, you might need to resize the travel icons provided in the template. To resize icons use menu option object, transform, scale and scale them to a size that will work on your map (ctrl+m). (select multiple objects at once by pressing F1 and drawing a selection rectangle around them). You can copy and paste the required icons from the template.

On the template, you will see a white listings box. This should be copied and pasted into the Key layer. It can be re-sized and re-shaped to best fit your map and the volume of listings it is going to contain. Edit the text in the listings box so that it contains all listings from the article (for see/do, buy, eat, drink, sleep, and contact listings) numbered and in alphabetical order.

Take all the entries of the Wikivoyage article and start placing them in the map, editing them as you go to make sure the numbers to align with those in the listings box. Ideally, you would know exactly where everything goes already but an online address locator like Google Maps is very handy for refreshing your memory. You can change the icon numbers by selecting the text tool, clicking on top of the icon, and then editing the number. Make sure not to change the font of the text in travel icons—it is formatted for maximum readability (especially when printed) at minimum size.

You should now also copy from the template and paste into this layer the inset title box (scale (ctrl-m or ctrl or alt+< or >) and edit as necessary), the scale (adjust as necessary) and the north arrow (scale as necessary). Please remember to take the extra time to add an accurate scale—it's extremely important for travelers determining just how far they'll be walking. An easy way to do this is to just match your scale to the one on your base image.

Note: It is critical to follow the above instructions insofar as you maintain separate layers for any text that could conceivably need translation into other languages, as this will make the process far, far more easy.

精细加工[编辑]

You should now have all the elements of your map completed and the following steps should ensure that it is finished off nicely:

  • Change the properties of any desaturated layers back to 100% using the opacity slider.
  • Create a final layer called Frame in which you mark out the exact area of the map you wish to be exported to the PNG file (and thereby the exact area of the map to be included in the article). This layer should always be the top layer, contain no fill and no stroke width. You can select it even without a fill or stroke by navigating to the Frame layer and pressing ctrl-a to select everything within that layer (do not create more than one object in the frame layer!).
  • It is a good idea to size your frame so that it can be exported at the exact resolution of 3008x1709 pixels. The thin green box on the template is already set to these proportions, so you only need to resize and/or rotate it to fit your map. For really big maps that are more square than rectangular, double the width of the box to 3008x3418, and it can then be printed as two pages.
  • Select your frame, then go to File and Document Properties. Click on "Resize page to content" and then "Resize page to drawing or selection". By doing this, thumbnails will appear correctly on Wikimedia Commons.

导出成品地图[编辑]

这应该是目前各层最终核对项目:

  • 边框
  • 关联
  • 街道名称
  • 旅行图标
  • 地图模板
  • 建筑物(也许)
  • 其他交通路线(也许)
  • 街道
  • 地理
  • 前景
  • 背景
  • 基地

You should export a copy of your map to PNG by selecting your blank frame and hitting shift+ctrl+e. This allows you to easily control the size and shape of the export.

It is best to use PNG files, as opposed to raw SVGs, because SVGs do not always display well in various browsers, Wikivoyage does not offer support for SVG graphics, and most importantly, this will allow you and other editors much greater flexibility in coordinating, updating, and generally getting more use out of the SVG file (especially with regards to translating).

When exporting the bitmap, enter an appropriate width in pixels — 2,000-3,000 pixels is usually reasonable, as it will give a great result when printed. A smaller thumbnail of the map will go in the article itself, preferably at a resolution that will allow users to read all text within the article. Give the map a suitable name, click export and you are done!

从OSM导入SVG[编辑]

The SVG road maps available from OpenStreetMap are a great base for creating Wikivoyage style maps, potentially saving loads of time otherwise spent tracing by hand!

导入[编辑]

The export feature on OpenStreetMap's main site is effectively broken, so don't bother. Instead, download and install Maperitive [9], an excellent, newbie-friendly program with a handy feature for exporting SVG files from OSM data. BrainCrunch wrote a handy guide [10] to using Maperitive for SVG exports, but the quick version is as follows:

In Maperitive, first navigate to the area you want to export.

  1. Set boundaries using the Map -> Set Bounds menu button, and drag them how you like.
  2. Load the OSM content within those boundaries via Map -> Download OSM Data (Overpass API).
  3. Remove the web map by clicking on "Web map" at the bottom right in the "Map Sources" box, and then click on the red X.
  4. Export to SVG using the command prompt at the bottom of the screen. Enter (without quotes): "export-svg compatibility=inkscape zoom=X"

You can choose any number 1–19 for the zoom, which will decide how much detail is exported (and therefore how big the filesize will be). zoom=15 is the point at which street names are included, but you can preview how much detail you'll get simply by zooming in and out in Maperitive (the keyboard shortcuts are + and -). The current zoom level in Maperitive is always shown in the very bottom taskbar, e.g., "zoom 5.4748".

For exporting a large area, going lower than zoom=7 will usually mean the highways are left off.

处理[编辑]

OSM imports from Maperitive come with a ton of extraneous layers, and editing in them in Inkscape can place pretty big demands on your PC's memory (and Inkscape loves to crash). This section is a quick and dirty guide to keeping things manageable right from the start.

Save (Ctrl+S) between all steps, and vacuum definitions (File → Vacuum defs) after deleting major layers or items.

1) Turn off the most resource intensive layers. Turn off "line artwork," save. Turn off "polygons," save. Turn off "labels," save.

2) Delete "map frame" and "map grid" layers (but keep the map grid layers if you want to display latitude and longitude, for island archipelago maps, for example) and the floating label.

3) You can delete tons of unnecessary items "polygons" by deleting clearly irrelevant layers without even turning them on to look at them (buildings, orchards, commercial areas, etc.), but you may want to keep "water," "national park," "nature reserve," and any other layers you think you'll want. Deleting buildings in particular helps a lot with reducing the filesize.

4) Create rivers layer (if you want to keep them) and move everything from any river and stream (if you want extra stream details) sublayers of "Line artwork" to that new layer. Then turn the new "rivers" layer off and delete the now empty layers. The easiest way to select all the rivers and streams from different layers at once, in order to move them together, is to turn off or lock all non-river/stream layers and then click and drag to select.

5) Do the same for all highway layers—put them in a new highway layer and delete the now empty layers.

6) It's often useful to preserve the coastline in a separate layer in the same fashion.

7) National Park and all "boundary" layers are usually useful, so be careful to keep them when removing layers from "line artwork."

8) You'll notice that a lot of paths are clones. That's not helpful, so select them (one layer at a time) and use "Edit -> Clone -> Unlink clone" (or Shift+Alt+D) to unlink them. Remove any fill that is auto-added to them in the process, then vacuum defs, save, and watch the filesize decrease!

9) Time to get creative. Import the regions map template to a new "template" layer, and adjust colors to match the Wikivoyage scheme. Create the regions layer, perhaps borrowing boundaries from one of the boundary layers in "Line artwork," add city markers and labels, key, etc. You can use the existing scale in the "Map decoration" layer to measure the Wikivoyage-style scale.

Other tips:

As Inkscape is not good at cropping, the fastest (i.e., least memory-intensive) method is to draw an object (like a rectangle) over the area you want to crop, and then use the difference tool by selecting the object on top and the target of the crop, then pressing Ctrl+-.

The small white streets in imports are the single biggest source of vector nodes that eat up your visual memory. Put them all in a "small streets" layer, and turn it off by clicking the eye icon next to the layer in the layers dialogue (this will render that layer invisible until you turn it back on). Now select a single little white street (Ctrl+click), then hit Ctrl+Shift+X to pull up the XML editor. Then copy the info listed under "style." Hit Ctrl+F to bring up the find box, and paste the style info into the style field, then hit enter. That should select all of the small white streets with that same style. Then hit Ctrl+G to group them, which will make it easier for your computer to move them to a different layer. Now Shift+PgUp to move the small street grid to the invisible "small streets" layer. That can take a while, but once it's done, the small streets will remain hidden until you need them, and won't bog down your system resources.

改造[编辑]

First text. Unfortunately the text in the "labels" layer of imported OSM SVGs is not usually that helpful. You will probably wind up deleting those layers and adding your own text. Be sure to use DejaVu Sans Condensed!

It's time to move on to the streets (the larger ones, since you already took care of the small ones in the "Manage" section above). You must select all objects of one type (e.g., red-colored streets), put them into one group (Ctrl+G), and then change the color to match the usual Wikivoyage scheme. To select all paths/objects of one category, use the find operation as described in the above section. Red-colored streets are easy to select, for example, simply enter "stroke:#eb9799" to the style box in the find operation to select all red-colored streets. Combine the streets into a group, then move them to a dedicated big streets layer. Repeat for all types of streets. To find unique attributes for the various street types, select one path, then open the XML editor (Shift+Ctrl+X), examine the style attribute, and find a unique value to enter into the find box. To match Wikivoyage color standards, change the stroke colors to white (although freeways/highways can be colored red or yellow to distinguish them from your average city street).

The colors of other objects, such as parks, buildings, and water areas, should also be changed to conform to Wikivoyage standards. This can be done in the same manner, using the find function to select all objects of a specific type, and then using the fill function to change the color (or pattern). Combining all the like objects into one path (Ctrl+K to combine a selection) will help keep things manageable. You can obtain standard colors and patterns here.

完成[编辑]

The final tasks are much more simple, but are time intensive. What is left is to add travel icons, a key, title, compass, scale, etc. These tasks are identical to those described in the section above for hand drawn maps.

ShareMap.org[编辑]

ShareMap.org is a social mapping service that allows the creation of freely licenced (CC-SA-3) SVG maps. Maps created with ShareMap can afterwards be tweaked in classic SVG editors before uploading.

主要特点[编辑]

  • Ability to import specific type of objects from OpenStreetMap
  • Ability to import user data collected by GPS (using GPX format)
  • Ability to trace old printed map (especially interesting when you map historical features)
  • At the same time, both a static (also known as SVG) and interactive, dynamic map is created

缺点[编辑]

  • Sometimes the visual appearance has to be tweaked in Inkscape before publication
  • For performance reasons, OpenStreetMap backgrounds are embedded rasters
  • With large datasets, classic GIS tools (QGis, Grass GIS) are more stable than web based ShareMap.

上传你的地图[编辑]

当要上传您的地图时,请记得务必上传于维基共享资源,并随时上传位图(.png)和载体(.SVG)之版本。这样将促使其他人可以在之后会添加到地图中。

帮助[编辑]

以下为维基导游的地图厂商,他们都乐意给予具体的帮助和给他人建议。敬请给予留言任何的问题和要求,并留言在他们的用户对话页上,但您千万不要去为难他们就是!

Inkscape中的技巧和窍门[编辑]

Please all map-makers use this section to add useful tips and tricks for using Inkscape.

  • Use the edit path nodes tool (F2) for manipulating streets, since this keeps the stroke width constant.
  • To extend a street, select it with edit path nodes tool and then choose the Bézier tool. Any nodes you add will become a part of the same object.
  • Use ALT-cursor keys to 'nudge' objects into the right place.
  • Objects can be combined into layers, which can be made visible or invisible by clicking on the "eye" icon. The following layer stack makes it easy to 'peel part' various components of a map: background - satellite data - area highlight - street map - area annotations.
  • Locking layers that you are not actively working on can save you a lot of trouble by making it impossible to accidentally move or change objects on the locked layers.
  • Inkscape is not the most stable of programs and is prone to hanging. It has an autosave feature in the latest version, but it's not 100% reliable; remember to save your work regularly.
  • In Inkscape, be warned that grouping items together from different layers will bring them up to the layer of the highest item in the selection.
  • Combining paths (ctrl-k) or grouping (ctrl-g) paths with exactly the same attributes (streets, parks, water) can save a lot of time, as it allows you to change identical paths with a single click. To automatically select paths with the same attributes, hit ctrl-x to bring up the XML editor; highlight and copy (ctrl-c) an item relevant item under style (such as fill:XXXXXXFF); then hit ctrl-f to bring up the find box; and paste (ctrl-v) the item into the it's style field. From there press enter, and you will have selected every path in your SVG with that particular attribute!
  • The union, difference, and intersection tools from the path menu are incredibly useful for precise manipulation of objects. It will take a bit of experimentation to master their use, but this is especially worthwhile for handling complex geography, or creating interlocking color fields to display neighborhoods or regions on your map.
  • Before performing operations, always close the XML editor, which will otherwise display every individual change painfully slowly.