為空照圖進行空間對位 (QGIS3)

In the tutorial 為紙本地圖進行空間對位 (QGIS3) we covered the basic process of georeferencing in QGIS. That method involved reading the coordinates from your scanned map and entering them manually as control points. Many times though you may not have the coordinates printed on your map, or you are trying to georeference an image. In that case, you can use another georeferenced data-source as your input. In this tutorial, you will learn how to use existing open data sources in your georeferencing process.

內容說明

我們要使用高解析度的氣球影像(Balloon-imagery),以 OpenStreetMap 的參考座標進行空間對位。

你還會學到這些

  • 下載超高解析度的公領域影像資料

  • Using XYZ Tile Layers as basemap.
  • Using the OSM Place Search plugin in QGIS.
  • 為某圖層自訂「無資料值」(No-data Value)

取得資料

In this tutorial, we will be using kite and balloon imagery collected by The Public Laboratory. They make the georeferenced versions of the images also available, but we will download a non-georeferenced JPG image and go through the process of georeferencing it in QGIS.

下載紐約市 Washington Square Park 的 JPG 影像。你可以直接在 JPG 的按鈕上按右鍵然後選 Save link as...

為了方便起見,你也可以直接用下面的連結下載:

newyorkcity-washingtonsquarepark.jpg

操作流程

  1. We will use a basemap from OpenStreetMap to capture the coordinates for georeferencing. QGIS3 comes with built-in support for tile layers. These are commonly known as ‘XYZ’ layers since they are made using individual map tiles for each zoom level (z) on a x,y coordinate grid. You can find the OpenStreetMap layer under XYZ Tiles in the Browser Panel. Drag the layer to the main canvas. Once loaded, note the Coordinate Reference System (CRS) for this layer in the bottom-right corder. It is set as EPSG 3857 Pseudo Mercator. This is important because the coordinates we infer from this layer during georeferencing will be in this CRS.
../../_images/1.png

註解

See this page for more details on XYZ layers and how to add other basemaps in QGIS.

  1. The image we are georeferencing is for Washington Square Park, New York. You can zoom/pan try to locate this park in the map. But that is cumbersome and may not be practical. An easier way is to use the OpenStreetMap (OSM) Place Search plugin to search for the exact location. Install the OSM Place Search plugin from Plugins ‣ Manage and install plugins ‣ All. If you do not see this plugin in the search results, make sure you have checked Also show experimental plugins under Settings. See 使用附加元件 for more information on using plugins in QGIS.
../../_images/2.png
  1. Once the plugin is installed, you will see a new panel called OSM Place Search.... Search for Washington Square Park in the Name contains.. box and click ->. You will see the matching place names appear in the results panel. Select the correct result and click the Zoom button.
../../_images/3.png
  1. You will see the map that is familiar and contains the landmarks that we can identify from the image. You may close the OSM Place Search panel now. If you need it again, you can open it from View ‣ Panels ‣ OSM Place Search.
../../_images/4.png
  1. Now it is time to start georeferencing. Launch the Georeferencer from Raster ‣ Georeferencer ‣ Georeferencer. If you do not see that menu item, you will need to enable the Georeferencer GDAL plugin from Plugins ‣ Manage and install Plugins ‣ Installed.
../../_images/5.png
  1. 空間對位 視窗中選擇 檔案 ‣ Open Raster,選擇剛下載的 JPG 檔,然後按 開啟

../../_images/6.png
  1. In the next screen, you will asked to choose the raster’s coordinate reference system (CRS). Our source image is a plain JPEG file and doesn’t have any coordinate reference system atached to it, so you can click Cancel.
../../_images/7.png
  1. Before we start adding Ground Control Points (GCP), we need to define the Transformation Settings. Go to Settings ‣ Transformation settings.
../../_images/8.png
  1. In the Transformation settings dialog, choose the Transformation type as Polynomial 2. See QGIS Documentation to learn about different transofrmation types and their uses. As noted earlier, our basemap is in EPSG 3857 Pseudo Mercator CRS, so set that as the Target CRS. You can leave the Output raster name to the default and choose LZW as the Compression. Check the Use 0 for transparency when needed. Make sure the Load in QGIS when done option is checked. CLick OK.
../../_images/9.png
  1. 接下來按下在工具列上的 Add Point 鈕,然後選擇幾個比較容易定位的特徵點,例如轉角、十字路口、雕像等等,這些點稍後要拿來當作控制點。

../../_images/10.png
  1. 當你在圖上按下點位時,會有個視窗跳出來要求輸入地圖坐標。選擇 從地圖畫面取得坐標

../../_images/11.png
  1. Find the same location in the reference layer and click at the precise point. The coordinates are auto-populated from your click on the map canvas. Click Ok. Similarly, choose at least 6 points on the image and add their coordinates from the reference layer.
../../_images/12.png

註解

Tip: When selecting a GCP on a building, always choose the bottom of the building. Many aerial and satellite imagery have leaning buildings, so choosing a point on the rooftop will introduce errors.

  1. Once you have added the minimum number of points required for the transform, you will notice that the GCPs now have a non-zero dX, dY and Residual error values. If a particular GCP has unusually high error values, that usually means a human-error in entering the coordinate values. So you can delete that GCP and capture it again.
../../_images/13.png
  1. Once you are satisfied with the GCPs, go to File ‣ Start georeferencing. This will start the process of warping the image using the GCPs and creating the target raster.
../../_images/14.png
  1. Once the process finishes, you will see the georeferenced layer loaded in QGIS. If all went well, you will see it nicely overlay the basemap.
../../_images/15.png
  1. To make the output look nicer, let’s remove the white border. Right-click on the image layer and choose Properties.
../../_images/16.png
  1. Switch to the Transparency tab. Add 255 as the Additional no data value and click OK. :Percent transparent. Click OK.
../../_images/17.png

註解

8-bit images have pixel values in the range 0-255. 0 is black and 255 is white.

  1. 現在,影像看起來就很漂亮的疊在地圖上了。

../../_images/18.png
comments powered by Disqus

This work is licensed under a Creative Commons Attribution 4.0 International License