ubuntu自动对齐网格_半自动创建自己的网格图的方法

本文介绍了如何使用半自动方法创建泰国的网格地图,以克服地理地图在 choropleth 可视化中的局限性。通过为每个省份创建中心对齐的矩形,使用力导向布局检测和消除重叠,然后将矩形对齐到矩形网格,最终在 Excel 或 Google Sheets 中进行手动调整,以创建出占用空间更小但保持泰国地理形状的地图。
摘要由CSDN通过智能技术生成

ubuntu自动对齐网格

by Krist Wongsuphasawat

克里斯特·旺苏帕萨瓦(Krist Wongsuphasawat)

半自动创建自己的网格图的方法 (A semi-automatic way to create your own grid map)

In the past year, the grid map style visualization has gained a lot of popularity in the US [2,4]. It has a quite a few nice properties, which inspired me to create one for Thailand.

在过去的一年中,grid map样式可视化在美国获得了很大的普及[2,4]。 它有很多不错的属性,这启发了我为泰国创建一个。

The rest of this article will explain grid maps, and how I created the grid map for Thailand map you see above.

本文的其余部分将说明栅格地图,以及如何为您在上面看到的泰国地图创建栅格地图。

But if you are interested in using the map already without reading the details of how to create one yourself, jump straight to my gridmap-layout-thailand github repository.

但是,如果您已经对使用地图感兴趣,而无需阅读如何自己创建地图的详细信息,请直接跳到我的gridmap-layout-thailand github存储库

什么是网格图,其属性是什么? (What is a Grid Map, and what are its properties?)

In a grid map, each region is represented as a tile of the equal shape and size. The tiles are placed to fit within a grid at positions that approximate real geographic position. If the tile is a square, the grid is rectangular. If the tile is a hexagon, then the grid is like a honeycomb. See the US maps below:

在网格图中,每个区域都表示为形状和大小相同的图块。 将图块放置为适合网格内近似真实地理位置的位置。 如果图块是正方形,则网格是矩形。 如果瓷砖是六边形,则网格就像蜂窝一样。 请参阅下面的美国地图:

Most of grid map visualizations are choropleth maps that use colors to encode values, such as amount of rainfall, average population age, or political alignment. Creating choropleth maps from geographic maps has some disadvantages, because the different sizes of each region introduce biases while interpreting the results. Also, many small regions are often too small to be notice on a map.

大部分的栅格地图可视化都是choropleth地图 ,它们使用颜色来编码值,例如降雨量,平均人口年龄或政治路线。 从地理地图创建choropleth地图有一些缺点,因为每个区域的不同大小在解释结果时会产生偏差。 同样,许多小区域通常太小而无法在地图上注意到。

Pros: grid maps do not introduce biases due to different sizes of the regions, making it an interesting choice when creating a choropleth map. Small regions are now guaranteed to be big enough to be seen. It’s also easier to implement and faster to load than a geographic map.

优点:网格图不会由于区域大小的不同而产生偏差,因此在创建Choropleth贴图时是一个有趣的选择。 现在保证小区域足够大以至于无法看到。 与地理地图相比,它更易于实现且加载速度更快。

Cons: The positions of the regions are only approximations, and could be inaccurate. For example, some adjacent regions may not appear adjacent on the grid map. It also distorts the distance between regions.

缺点:区域的位置仅是近似值,可能不准确。 例如,某些相邻区域可能不会在网格图上显示为相邻。 这也会扭曲区域之间的距离。

为泰国创建网格图 (Creating Grid Map for Thailand)

Here are the requirements:

要求如下:

  • The overall map still looks similar to the geographical shape of Thailand. The neighboring regions should appear adjacent or close by.

    总体地图看起来仍然与泰国的地理形状相似。 相邻区域应显示为相邻或靠近。
  • Use square tiles for ease of curation and application. For example, this map can be drawn in Excel [3] or Google Sheets easily.

    使用方砖可简化管理和应用。 例如,可以轻松地在Excel [3]或Google表格中绘制此地图。
  • The map does not have any holes in the middle to avoid confusion.

    该地图的中间没有任何Kong可以避免混淆。

Of course, the most straightforward approach to create this map is to draw the map manually from scratch. However, I would like to save some energy with a semi-automatic approach:

当然,创建此地图的最直接方法是从头开始手动绘制地图。 但是,我想通过半自动方法节省一些能量:

  1. For each province, create one rectangle centered at its centroid.

    对于每个省,创建一个以其质心为中心的矩形。
  2. Use a force-directed simulation to detect collisions between rectangles and remove overlaps. Each rectangle has its own center of gravity at the centroid of its province (multi-foci force-directed layout). The solid lines in the figure below show displacements of the rectangles from their ideal positions.

    使用力导向的仿真来检测矩形之间的碰撞并消除重叠。 每个矩形在其省份的质心处都有自己的重心( 多焦点受力导向的布局 )。 下图中的实线表示矩形相对于其理想位置的位移。

  3. Snap the rectangles to a rectangular grid.

    将矩形对齐到矩形网格。
  4. Export results from Step 3 as CSV file and manually curate in Google Sheets or Excel. The goal of this step is to remove unnecessary gaps, connect the map into one contiguous piece, and adjust the positions of some provinces.

    将步骤3中的结果导出为CSV文件,然后在Google表格或Excel中手动进行整理。 此步骤的目标是消除不必要的空白,将地图连接成一个连续的块,并调整某些省份的位置。

  5. Done! The new map only requires 40% of the original space.

    做完了! 新地图仅需要原始空间的40%。
用法 (Usage)

The output from this process can be used as JS, CSV or JSON files. Please see gridmap-layout-thailand on GitHub for instructions. The code I used for steps 1–5 above are also in that repo.

该过程的输出可用作JS,CSV或JSON文件。 有关说明,请参见GitHub上的gridmap-layout-thailand 。 我在上面的步骤1-5中使用的代码也在该存储库中。

Lastly, this method still depends a lot on manual curation at the end, which may not produce the best optimization. If you have any suggestions or would like to recommend a better approach, the comment box below is yours. :)

最后,此方法最后仍然很大程度上取决于手动管理,这可能无法产生最佳的优化效果。 如果您有任何建议或想推荐一种更好的方法,请在下面的评论框中找到您的建议。 :)

参考文献 (References)

[1] Mike Bostock. “Multi-Foci Force Layoutbl.ocks.org Published 11 February 2012[2] Danny DeBelius. “Let’s Tesselate: Hexagons For Tile Grid MapsNPR Blog. Published 11 May 2015[3] Caitlin Dempsey Morais. “How to Make a Tile Grid Map Using ExcelGIS Lounge. Published 10 November 2015[4] Nathan Yau. “The Great Grid Map Debate of 2015Flowing Data. Published 12 May 2015

[1] Mike Bostock。 “ 多焦点部队布局bl.ocks.org发布于2012年2月11日[2] Danny DeBelius。 “ 让我们进行镶嵌:六边形用于瓷砖网格图NPR博客。 2015年5月11日发布[3] Caitlin Dempsey Morais。 “ 如何使用Excel制作平铺网格图 ”, GIS Lounge 。 2015年11月10日发布[4]邱胜敏。 “ 2015年大网格地图辩论流动数据。 2015年5月12日发布

翻译自: https://www.freecodecamp.org/news/creating-grid-map-for-thailand-397b53a4ecf/

ubuntu自动对齐网格

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值