全站通知:

高度图

阅读

    

2023-11-30更新

    

最新编辑:Lu_23333

阅读:

  

更新日期:2023-11-30

  

最新编辑:Lu_23333

来自城市:天际线WIKI_BWIKI_哔哩哔哩
(重定向自高度图
跳到导航 跳到搜索
页面贡献者 :
Lu_23333
xl123071
施工中:欢迎协助编辑本页,请参考帮助:编辑帮助帮助:编辑规范。请从以下方面协助编辑:
  • 需要翻译此页面

Heightmaps represent elevation as a grid raster (in this case, a PNG image), with each cell in the grid containing an elevation at that point. C:S uses heightmaps that are 1081×1081 pixels to represent an area 18km×18km, for a maximum useful resolution of 16.65m per pixel. The US Geological Survey freely offers 30m elevation models of almost the entire populated world without cost or condition, while many governments will offer elevation models at or beyond 16m/pixel within their own jurisdiction.

The game can read 8- or 16-bit greyscale PNG images, and scales them from 0–1024m, with default sea level at 40m.

How to Get a Heightmap Into the Map Editor

Easy

terrain.party lets you move a box around the Earth and quickly extract a heightmap, ready for import, from some pretty-good data sources. (there was problems with generating heighmaps recently [1] [2])

cs.heightmap.skydark.pl | Online heightmap generator - alternative to terrain party. Original by JBerg60, currently maintained by sysoppl. You can export RAW and PNG files, and move a box around Earth. Some options are configurable.

Difficult: Get Your Own DEM and Convert

Why?

  • Better coastline: terrain.party only has elevation data above the ground. This means that you'll have perfectly realistic elevation up to the water's edge, and then a 40m vertical cliff at the shore. In the US, NOAA has combined above/below sea level elevation models available in many coastal areas. With some work, you can take advantage of the game's water physics and get real, gently-sloping beaches from the start.
  • terrain.party may not be best quality for your region: according to its documentation, terrain.party only has elevation data better than 16m/px for the US and Denmark. For most of the world, it has 30m/px, or about half of the useful maximum. There are terrain data for many other regions which are better, but you'll have to locate and download these on your own. Check with national mapping agencies first.

Tools

  • GIMP 2.9+ As of early 2016, only the development version of GIMP has the necessary support for 16-bit images.
  • QGIS

Sources

Steps

WIP. In the meantime, Google unfamiliar steps and add "qgis" to find more help.

In QGIS
Method 1

These steps are simpler, but leave you with more cleanup to do in the C:S map editor.

When dealing with one file:

  1. Open QGIS
  2. Open raster file (usually a Geotiff or htg file)
  3. If you are happy with the way it looks, click- the "Project" Tab in the top right, click the "Import/Export" Tab, then click "Export map as Image",
  4. Save it and put the image file you get in Appdata/Local/Colossal Order/Cities_Skylines/Addons/MapEditor/Heightmaps.

When dealing with multiple files:

  1. Open the raster files, you can open multiple by pressing the Layer menu, then Add layer/Add Raster Layer
  2. Where it has the next to raster dataset, press Ctrl while clicking all the files that you wish to include in your map, then open.
  3. Because each layer looks different, you must find a way to merge it to give realistic elevation. Go to the Raster menu, then press Miscellaneous, then Merge
  4. In parameters, where it says Input layers, check all the layers that you wish to merge.
  5. It will tell you how many layers you checked. Keep everything default and press Run in Background
  6. The resulting raster will look much more clean than the original one. If you are happy with the way it looks, click the Project menu in the top right, click Import/Export, then click Export map as Image

Note that pure grayscales will require smoothing in map editor.

Method 2

These steps are more complex, but save some cleanup in the C:S map editor.

If using only one file:

  1. Open your file (Layer > Add Layer > Add Raster Layer...)
  2. Export (Select layer in the contents panel, then Layer> Save as...): Save as UInt16 PNG (this gives a smoother result in the map editor). For a coastal map, use the flag -scale -40 984 0 65536. The first number is the real-world elevation in source data which will be equivalent to 0 in the heightmap we are making. Since 40m is considered sea level, we want 40 meters below sea level to be 0 in the heightmap. The second number is the maximum elevation in the source file. If your maximum elevation is greater than 984m, adjust the first two numbers so that they encompass your minimum and maximum elevation.

If using more than one file:

  1. Be sure they have consistent projection, unit of measure, vertical datum, and spatial resolution. This shouldn't be a problem if all your files came from the same source.
  2. Create a Virtual Raster: load all DEMs which cover your target area into QGIS. Go to Processing > Toolbox. In the panel that appears, search for the Build Virtual Raster tool. Select all of your DEMs in the Input Layers box, and choose a save location and name in the Virtual box. Leave everything else default.
    1. If your DEMs overlap, the tool will use the last layer selected for the overlapping region.
  3. Clip: Reduces file size, only necessary if your merged DEM is significantly larger than your target area. Search for Clip raster by extent in the Processing panel. Select the output file from the last step. For Clipping extent, click the ... to the right of the box, then click Select extent on canvas. If you move the dialog out of the way, you can click and drag in the main window to select the area to use for your city. Don't worry about being too precise, and leave a little extra around the edges. We're just trying to save disk space and processing power here, and we'll cut it down again later in GIMP. Remember that without mods, only the middle 5/9 of each dimension will be buildable.
  4. Reproject to the local UTM projection. Find Warp in the toolbox. Again, make sure the first field has the raster from the last step, not any other. For Destination SRS, click the ... and search for the UTM zone. You will probably get more than one option for each zone number; pick the one starting with "WGS 84". If you don't know which UTM zone number you should use, Google "<location> UTM zone".
  5. Export (Layer> Save as...): Save as UInt16 PNG. For a coastal map, use the flag -scale -40 984 0 65536. If your maximum elevation is greater than 984m, adjust the first two numbers so that they encompass your minimum and maximum elevation.
In GIMP
  1. Crop: Be sure to set a 1:1 aspect ratio in the tool options, and turn on the rule of fifths guide. This is where we select the final area for the map. Remember when cropping that without mods you can only build on the middle 5/9 of the width. 5/9 is a little less than 3/5, so with the rule of fifths crop guide enabled, roughly the central 3x3 area will be buildable.
  2. Rescale to 1081×1081
  3. Export to the C:S Heightmap directory
说明

请帮助检查更新本页。最后检查:版本1.9

本页内容最初译自官方Wiki:Heightmap,经双方编辑后内容可能与来源不同。