20. 예제 데이터 준비
참고
강의 담당자나 숙련된 QGIS 사용자가 강의에 로컬 샘플 데이터를 이용하고자 할 경우 이 준비 과정이 필요합니다. 교육 교재와 함께 기본 데이터셋이 제공되지만, 기본 데이터셋을 로컬 데이터로 대체하고자 한다면 다음 지침을 따라야 합니다.
교육 교재와 함께 제공되는 샘플 데이터 는 Swellendam 마을 및 그 주변에 대한 자료입니다. Swellendam 은 남아프리카 공화국의 웨스턴케이프에 있는 케이프타운에서 동쪽으로 2시간 거리에 있습니다. 이 데이터셋의 피처명은 영어와 아프리칸스어 두 가지로 되어 있습니다.
누구나 이 데이터셋을 어려움없이 이용할 수 있습니다. 그러나 사용자 자국 또는 고향의 데이터를 이용하고자 할 경우, 모듈 3에서 모듈 7.2까지의 모든 강의에 사용자의 데이터를 쓸 수 있습니다. 이후 강의에는 좀더 복잡한 데이터 소스를 사용하게 되는데, 사용자의 지역에 따라 이런 데이터가 존재하지 않을 수도 있습니다.
참고
이 지침은 사용자가 QGIS를 잘 알고 있다고 가정하며, 강의 교재로 쓰이도록 작성된 것은 아닙니다.
20.1. Try Yourself Create OSM based vector Files
사용자의 강의에 기본 데이터셋 대신 로컬 데이터를 사용하고자 할 경우 QGIS에 내장된 도구로 간단히 데이터를 준비할 수 있습니다. 이때 사용자가 선택한 지역은 도심과 교외가 균형 있게 분포하며, 서로 다른 종류의 도로와 (자연보호구역 또는 농장 같은) 지역 경계, 그리고 하천 같은 지표수를 포함해야 합니다.
새 QGIS 프로젝트 열기
Select Data Source Manager dialog
to open theIn the Browser tab, expand the XYZ Tiles drop-down menu and double-click the OpenStreetMap item.
A map of the world is now visible on the map canvas.
Close the Data Source Manager dialog
Move to the area you’d like to use as study area
Now that we have the area we’ll extract the data from, let’s enable the extraction tools.
Go to
In the All tab, type
QuickOSM
in the search boxSelect the QuickOSM plugin, press Install Plugin and then Close the dialog.
Execute the new plugin from
menuIn the Quick query tab, select
building
in the Key drop-down menuLeave the Value field empty, meaning that you are querying all buildings.
Select Canvas Extent in the next drop-down menu
Expand the Advanced group below and uncheck all geometry types on the right except Multipolygons.
Press Run query
A new
building
layer is added to the Layers panel, showing buildings in the selected extent.Proceed as above to extract other data:
Key = landuse
andMultipolygons
geometry type.Key = boundary
,Value = protected_area
andMultipolygons
geometry type.Key = natural
,Value = water
andMultipolygons
geometry type.Key = highway
and checkLines
andMultilines
geometry types.Key = waterway
,Value = river
and checkLines
andMultilines
geometry types.Key = place
andPoints
geometry type.
This process adds the layers as temporary files (indicated by the icon next to their name).
You can sample the data your region contains in order to see what kind of results your region will yield.
We now need to save the resulting data to use during your course. We’ll be using ESRI Shapefile, GeoPackage and SpatiaLite formats depending on the data.
To convert the place temporary layer to another format:
Click the icon next to the place layer to open the Save Scratch Layer dialog.
참고
If you need to change any of the temporary layer’s properties (CRS, extent, fields…), use the Add saved file to map option is checked. This adds a new layer.
contextual menu instead, and ensure theSelect the ESRI Shapefile format
Use the … button to browse to the
exercise_data/shapefile/
folder and save the file asplaces.shp
.OK 를 클릭하십시오.
In the Layers panel, the temporary place layer is replaced with the saved places shapefile layer and the temporary icon next to it removed.
Double-click the layer to open its Layer name property to match the file name.
tab and update theRepeat the process for other layers, renaming them as follows:
natural_water
intowater
waterway_river
intorivers
boundary_protected_area
intoprotected_areas
Each resulting data set should be saved in the
exercise_data/shapefile/
directory.
The next step is to create a GeoPackage file from the building layer to use during the course:
Select the GeoPackage format
Save the file as
training_data.gpkg
under theexercise_data/
folderBy default, the Layer name is filled as the file name. Replace it with
buildings
.OK 를 클릭하십시오.
Rename the layer in its properties dialog
Repeat the process with the highway layer, saving it as
roads
in the same GeoPackage database.
The last step is to save the remaining temporary file as a SpatiaLite file.
Select the SpatiaLite format
Save the file as
landuse.sqlite
under theexercise_data/
folder. By default, the Layer name is filled as the file name. Do not change it.OK 를 클릭하십시오.
You should now have a map which looks something like this (the symbology will certainly be very different, because QGIS randomly assigns colors when layers are added to the map):
The important thing is that you have 7 vector layers matching those shown above and that all those layers have some data.
20.2. Try Yourself SRTM DEM tiff 파일 생성
For modules Module: 벡터 데이터 생성 and Module: 래스터, you’ll also need raster images (SRTM DEM) which cover the region you have selected for your course.
The CGIAR-CGI provides some SRTM DEM you can download from https://srtm.csi.cgiar.org/srtmdata/.
You’ll need images which cover the entire region you have chosen to use.
To find the extent coordinates, in QGIS , zoom to the extent of
the largest layer and pick the values in the Extents
box of the status bar.
Keep the GeoTiff
format. Once the form is filled, click on the
Click here to Begin Search >> button and download the file(s).
Once you have downloaded the required file(s), they should be saved in the
exercise_data
directory, under raster/SRTM
subfolders.
20.3. Try Yourself Create imagery tiff Files
In Module Module: 벡터 데이터 생성, Follow Along: 데이터소스 lesson shows close-up images of three school sports fields which students are asked to digitize. You’ll therefore need to reproduce these images using your new SRTM DEM tiff file(s). There is no obligation to use school sports fields: any three school land-use types can be used (e.g. different school buildings, playgrounds or car parks).
For reference, the image in the example data is:
20.4. Try Yourself 표식 교체
Having created your localised dataset, the final step is to replace the tokens
in the substitutions.txt
file so that the appropriate names will appear
in your localised version of the Training Manual.
교체해야 할 표식들은 다음과 같습니다.
majorUrbanName
: this defaults to “Swellendam”. Replace with the name of the major town in your region.schoolAreaType1
: this defaults to “athletics field”. Replace with the name of the largest school area type in your region.largeLandUseArea
: this defaults to “Bontebok National Park”. Replace with the name of a large landuse polygon in your region.srtmFileName
: this defaults tosrtm_41_19.tif
. Replace this with the filename of your SRTM DEM file.localCRS
: this defaults toWGS 84 / UTM 34S
. You should replace this with the correct CRS for your region.