중요

Translation is a community effort you can join. This page is currently translated at 32.97%.

5.3. Lesson: 서식

디지타이즈 작업으로 새 데이터를 추가할 때, 피처에 대한 속성을 입력할 수 있는 대화 창이 나타납니다. 그러나 이 기본 대화 창은 한 눈에 파악하기 어렵습니다. 특히 여러분이 대용량 데이터셋을 생성하거나, 다른 사람들에게 디지타이즈 작업을 부탁했는데 기본 서식을 이해하기 어려워 할 경우 유용성 문제가 제기될 수 있습니다.

QGIS를 사용하면, 다행히도 레이어에 대한 사용자 지정 대화 창을 생성할 수 있습니다. 이 강의에서 그 방법을 배워보겠습니다.

이 강의의 목표: 레이어에 대한 서식을 생성하기.

5.3.1. basic Follow Along: QGIS 서식 디자인 기능 이용

  1. Select the roads layer in the Layers panel

  2. Enter Edit Mode as before

  3. Open the roads layer’s attribute table

  4. Right-click on any cell in the table. A short menu will appear, that includes the Open form entry.

  5. Click on it to see the form that QGIS generates for this layer

물론 항상 Attribute Table 에서 특정 거리를 찾아봐야 하는 것보다 맵을 보면서 이 작업을 할 수 있다면 좋겠죠.

  1. Select the roads layer in the Layers panel

  2. Using the identify Identify Features tool, click on any street in the map.

  3. The Identify Results panel opens and shows a tree view of the fields values and other general information about the clicked feature.

  4. At the top of the panel, check the Auto open form for single feature results checkbox in the options Identify Settings menu.

  5. Now, click again on any street in the map. Along the previous Identify Results dialog, you’ll see the now-familiar form:

    ../../../_images/roads_form.png
  6. Each time you click on a single feature with the Identify tool, its form pops up as long as the Auto open form is checked.

5.3.2. basic Try Yourself 서식을 이용해서 값 편집

편집 모드에 들어온 상태라면, 이 서식을 사용해서 피처의 속성을 편집할 수 있습니다.

  1. (편집 모드가 아니라면) 편집 모드를 활성화하십시오.

  2. Using the identify Identify Features tool, click on the main street running through Swellendam:

    ../../../_images/main_street_selected.png
  3. Edit its highway value to be secondary

  4. Exit edit mode and save your edits

  5. Open the Attribute Table and note that the value has been updated in the attributes table and therefore in the source data

5.3.3. moderate Follow Along: 서식 항목 유형 설정

서식을 사용해서 편집하는 것도 좋지만, 모든 것을 직접 입력해야 하기도 합니다. 다행스럽게도, 서식에는 서로 다른 다양한 방법으로 데이터를 편집할 수 있도록 해주는, 소위 말하는 *위젯*이 여러 종류 있습니다.

  1. Open the roads layer’s Properties…

  2. Fields 탭을 선택하십시오. 다음과 같은 창을 볼 수 있습니다.

    ../../../_images/fields_panel.png
  3. Switch to the Attributes Form tab. You’ll see this:

    ../../../_images/attributes_form.png
  4. Click on the oneway row and choose Checkbox as Widget Type in the list of options:

    ../../../_images/checkbox_selected.png
  5. OK 를 클릭합니다.

  6. Enter edit mode (if the roads layer is not already in edit mode)

  7. Click on the identify Identify Features tool

  8. Click on the same main road you chose earlier

You will now see that the oneway attribute has a checkbox next to it denoting True (checked) or False (unchecked).

5.3.4. hard Try Yourself

highway 항목에 더 적합한 위젯을 설정해보십시오.

5.3.5. hard Try Yourself 테스트 데이터 생성

완전히 새로운 여러분만의 사용자 지정 서식을 디자인할 수도 있습니다.

  1. Create a simple point layer named test-data with two attributes:

    • name (text)

    • age (integer)

    ../../../_images/new_point_layer.png
  2. 이 새 레이어에 디지타이즈 작업 도구로 포인트 몇 개를 찍어 간단한 데이터를 준비하십시오. 새 포인트를 만들 때마다 QGIS의 기본 속성 부여 서식이 나타날 것입니다.

    참고

    이전 단계에서 맞추기 옵션을 활성화시킨 채라면 비활성화시켜야 할 수도 있습니다.

    ../../../_images/new_point_entry.png

5.3.6. hard Follow Along: 새 서식 생성

Now we want to create our own custom form for the attribute data capture phase. To do this, you need to have QT Designer installed (only needed for the person who creates the forms).

  1. Start QT Designer.

  2. 새 대화 창을 생성할 수 있는 다음 대화 창이 나타납니다.

    ../../../_images/qt_new_dialog.png
  3. 창의 (기본적으로) 왼쪽에 있는 Widget Box 를 찾아보십시오. Line Edit 라는 항목을 담고 있습니다.

  4. 이 항목을 여러분의 서식으로 클릭 & 드래그합니다. 서식에 새로운 Line Edit 이 생성될 것입니다.

  5. 이 새로운 라인 편집 요소를 선택하면 (기본적으로 창의 오른쪽에 있는) 요소의 속성 창을 볼 수 있습니다.

    ../../../_images/qt_line_edit.png
  6. Set its name to name.

  7. Using the same approach, create a new Spin Box and set its name to age.

  8. Add a Label with the text Add a New Person in a bold font (look in the object properties to find out how to set this). Alternatively, you may want to set the title of the dialog itself (rather than adding a label).

  9. Add a Label for your Line Edit and your Spin Box.

  10. Arrange the elements to your own desire.

  11. 사용자의 대화 창 아무 곳이나 클릭하십시오.

  12. Find the Lay Out in a Form Layout button (in a toolbar along the top edge of the screen, by default). This lays out your dialog automatically.

  13. Set the dialog’s maximum size (in its properties) to 200 (width) by 150 (height).

  14. Your form should now look similar to this:

    ../../../_images/qt_example_form.png
  15. Save your new form as exercise_data/forms/add_people.ui

  16. When it’s done saving, you can close Qt Designer

5.3.7. hard Follow Along: 서식과 사용자 레이어의 연계

  1. Go back to QGIS

  2. 레이어 목록의 test-data 레이어를 더블클릭해서 속성 테이블을 엽니다.

  3. Click on the Attributes Form tab in the Layer Properties dialog

  4. Attribute editor layout 드롭다운 메뉴에서 Provide ui-file 을 선택합니다.

  5. Click the ellipsis button and choose the add_people.ui file you just created:

    ../../../_images/provide_ui_file.png
  6. Click OK on the Layer Properties dialog

  7. Enter edit mode and capture a new point

  8. 이제 (QGIS가 보통 생성하는 기본 대화 창 대신) 사용자 지정 대화창이 나타날 것입니다.

  9. If you click on one of your points using the identify Identify Features tool, you can now bring up the form by right clicking in the identify results window and choosing View Feature Form from the context menu.

  10. If you are in edit mode for this layer, that context menu will show Edit Feature Form instead, and you can then adjust the attributes in the new form even after initial capture.

5.3.8. In Conclusion

데이터 편집이나 생성 시 서식을 이용하면 훨씬 편하게 작업할 수 있습니다. 위젯 유형을 편집하거나 완전히 새로운 서식을 생성해서 해당 레이어를 위해 새 데이터를 디지타이즈하는 사람의 경험을 향상시켜 오해 및 불필요한 오류를 최소화할 수 있습니다.

5.3.9. Further Reading

If you completed the advanced section above and have knowledge of Python, you may want to check out this blog entry about creating custom feature forms with Python logic, which allows advanced functions including data validation, autocompletion, etc.

5.3.10. What’s Next?

QGIS의 표준 액션 가운데 하나가 피처를 식별하는 작업과 동시에 서식을 여는 것입니다. 그러나 사용자가 정의한 사용자 지정 액션을 실행하도록 할 수 있습니다. 이것이 다음 강의의 내용입니다.