座標参照系 (CRSs) について再度話しましょう。前にも簡潔に触れましたが、それは実質的に何を意味するのか議論していませんでした。
このレッスンの目標: ベクタデータセットの再投影と変形をする。
マップ自身だけでなくすべてのデータのCRSはWGS84と呼ばれています。これはデータを表現するのに一般的な空間参照系(GCS)です。しかし、我々が見るように、問題があります。
現在のマップを保存します。
exercise_data/world/world.qgs で確認できる世界地図を開きます。
スケール フィールドに着目したままマップ周辺をパンニングします。
Notice the scale changing? That’s because you’re moving away from the one point that you zoomed into at 1:5000000, which was at the center of your screen. All around that point, the scale is different.
To understand why, think about a globe of the Earth. It has lines running along it from North to South. These longitude lines are far apart at the equator, but they meet at the poles.
In a GCS, you’re working on this sphere, but your screen is flat. When you try to represent the sphere on a flat surface, distortion occurs, similar to what would happen if you cut open a tennis ball and tried to flatten it out. What this means on a map is that the longitude lines stay equally far apart from each other, even at the poles (where they are supposed to meet). This means that, as you travel away from the equator on your map, the scale of the objects that you see gets larger and larger. What this means for us, practically, is that there is no constant scale on our map!
To solve this, let’s use a Projected Coordinate System (PCS) instead. A PCS “projects” or converts the data in a way that makes allowance for the scale change and corrects it. Therefore, to keep the scale constant, we should reproject our data to use a PCS.
QGIS allows you to reproject data “on the fly”. What this means is that even if the data itself is in another CRS, QGIS can project it as if it were in a CRS of your choice.
NSIDC EASE-Grid Global をクリックしてそれを選択します。それから OK をクリックします。
南アフリカの形状が変化するのに注意してください。すべて投影法の変更によって地球の見た目としての形状が変わります。
前のように、再度 1:5000000 のスケールにズームします。
マップをパンニングします。
スケールは同じであることに注意します!
“オンザフライ”再投影は異なるCRSのデータセットを組み合わせて使う際にも用いられます。
“オンザフライ”再投影を再び無効にする:
CRS ステータス ボタンを再度クリックします。
‘オンザフライ’ CRS 変換を有効にする のチェックを解除します。
何に気づくのですか?
レイヤは表示されません!しかし、修正するのは簡単ですよね?
レイヤの領域にズーム を選択します。
そう、今は南アフリカが見えます・・・しかし世界の残りはどこですか?
It turns out that we can zoom between these two layers, but we can’t ever see them at the same time. That’s because their Coordinate Reference Systems are so different. The continents dataset is in degrees, but the RSA dataset is in meters. So, let’s say that a given point in Cape Town in the RSA dataset is about 4 100 000 meters away from the equator. But in the continents dataset, that same point is about 33.9 degrees away from the equator.
This is the same distance - but QGIS doesn’t know that. You haven’t told it to reproject the data. So as far as it’s concerned, the version of South Africa that we see in the RSA dataset has Cape Town at the correct distance of 4 100 000 meters from the equator. But in the continents dataset, Cape Town is only 33.9 meters away from the equator! You can see why this is a problem.
QGIS doesn’t know where Cape Town is supposed to be - that’s what the data should be telling it. If the data tells QGIS that Cape Town is 34 meters away from the equator and that South Africa is only about 12 meters from north to south, then that is what QGIS will draw.
これを正すには:
Now, because they’re made to project in the same CRS, the two datasets fit perfectly:
When combining data from different sources, it’s important to remember that they might not be in the same CRS. “On the fly” reprojection helps you to display them together.
Before you go on, you probably want to have the ‘on the fly’ reprojection to be automatically activated whenever you open datasets having different CRS:
再度 設定 ‣ オプション... を実行し、 CRS を選択します。
もしレイヤが異なる座標系を持つ場合,自動で ‘オンザフライ’ リプロジェクションを有効にする をチェックします。
Remember when you calculated areas for the buildings in the Classification lesson? You did it so that you could classify the buildings according to area.
あなたの通常のマップ( Swellendam データを含む)を開きます。
:kbd:`AREA`フィールドが見えるまで右側にスクロールします。
Notice how the areas are all very small; probably zero. This is because these areas are given in degrees - the data isn’t in a Projected Coordinate System. In order to calculate the area for the farms in square meters, the data has to be in square meters as well. So, we’ll need to reproject it.
But it won’t help to just use ‘on the fly’ reprojection. ‘On the fly’ does what it says - it doesn’t change the data, it just reprojects the layers as they appear on the map. To truly reproject the data itself, you need to export it to a new file using a new projection.
エンコーディング はそのままにしておきます。
ドロップダウン下の ブラウズ ボタンをクリックします。
CRS セレクタ ダイアログが表示されるでしょう。
リストから :guilabel:`WGS 84 / UTM zone 34S`を選択します。
The Save vector layer as... dialog now looks like this:
Refer back to the lesson on Classification to remember how you calculated areas.
This will add an AREA field with the size of each building in square meters
Look at the new values in your attribute table. This is much more useful, as people actually quote building size in meters, not in degrees. This is why it’s a good idea to reproject your data, if necessary, before calculating areas, distances, and other values that are dependent on the spatial properties of the layer.
There are many more projections than just those included in QGIS by default. You can also create your own projections.
マップを新規に開始します。
An interesting projection to use is called Van der Grinten I.
名称 フィールドでその名称を入力します。
This projection represents the Earth on a circular field instead of a rectangular one, as most other projections do.
そのパラメータとして、次の文字列を使います:
+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs
“オンザフライ”再投影を有効にします。
この投影法を適用するため、したがってマップは再投影されるでしょう:
Different projections are useful for different purposes. By choosing the correct projection, you can ensure that the features on your map are being represented accurately.
Materials for the Advanced section of this lesson were taken from this article.
Further information on Coordinate Reference Systems is available here.
次のレッスンでは、QGISの様々なベクタ分析ツールを使ってベクタデータの分析をする方法について学習します。