벡터 레이어의 레이어 속성 대화창은 맵에서 레이어의 피처가 어떻게 보이는지(심볼, 라벨, 도표) 및 마우스와의 상호 작용(액션, 맵 도움말, 양식 디자인)을 관리하는 일반 설정을 제공합니다. 또 레이어에 대한 정보를 제공하기도 합니다.
레이어 속성 대화창을 열려면, 범례에서 레이어명을 더블 클릭하거나, 레이어명을 오른쪽 클릭한 다음 컨텍스트 메뉴에서 속성 을 선택하십시오.
참고
서로 다른 레이어 스타일로 재빨리 바꾸기
레이어 속성 대화창 하단에 있는 스타일 ‣ 추가 콤보 상자를 이용하면, 레이어 속성 설정 조합(심볼, 라벨, 도표, 항목 양식, 액션 등등)을 원하는 대로 얼마든지 저장할 수 있습니다. 그리고 나서, 레이어 패널 에 있는 레이어의 컨텍스트 메뉴에서 스타일을 바꾸기만 하면, 사용자 데이터의 모습이 자동적으로 변경될 겁니다.
벡터 레이어에 대한 일반 설정에 이 메뉴를 이용하십시오. 다음과 같은 옵션들을 사용할 수 있습니다:
displayed as 에서 레이어 표시 명칭을 변경합니다.
벡터 레이어의 Layer source 를 정의합니다.
제공자 특화 옵션을 정의해서 파일을 읽을 수 있도록 Data source encoding 을 정의합니다.
좌표계를 Specify 합니다. 이 옵션으로 지정한 벡터 레이어의 투영체를 살펴보거나 변경할 수 있습니다.
Spatial Index 를 (OGR 지원 유형에 대해서만) 생성합니다.
레이어의 범위 정보를 Update Extents 합니다.
지정한 벡터 레이어의 투영체를 살펴보거나 변경하려면, Specify ... 를 클릭하세요.
Maximum (inclusive) 및 Minimum (exclusive) 축척을 설정해서 피처가 보이게 될 축척 범위를 정의할 수 있습니다. 이 범위를 벗어나면, 피처를 숨깁니다. Set to current canvas scale 버튼을 클릭하면 가시성 범위의 한계값으로 현재 맵 캔버스의 축척을 쓸 수 있습니다.
Figure Vector General 1:
벡터 레이어 속성 대화창의 일반 메뉴
Provider Feature Filter 프레임 아래 있는 쿼리 생성기 버튼으로 SQL 방식의 WHERE 절을 이용, 레이어에 있는 피처의 하위 집합을 정의해서 그 결과를 메인 창에 표출할 수 있습니다. 쿼리를 취소하지 않는 한, 프로젝트에서 쿼리 결과에 상응하는 피처만 사용할 수 있습니다. 쿼리 결과를 새 벡터 레이어로 저장할 수도 있습니다.
레이어 속성 대화창의 General 메뉴의 하단에 있는 원조 버튼을 통해 쿼리 생성기 에 접근할 수 있습니다. Feature subset 아래 있는 [Query Builder] 버튼을 클릭해서 쿼리 생성기 를 여십시오. 예를 들어, TYPE_2 항목을 가진 regions 레이어가 있을 경우 쿼리 생성기의 Provider specific filter expression 란에서 borough 지역만 선택할 수 있습니다. 다음 그림 은 QGIS 예시 데이터의 regions.shp 레이어에 대한 쿼리 생성기 예시입니다. 필드, 값 및 연산자 부분을 이용해서 SQL 방식의 쿼리를 작성할 수 있습니다.
Figure Vector General 2:
쿼리 생성기
필드 목록 은 검색할 속성 테이블의 모든 속성 열을 포함합니다. SQL WHERE 절 란에 속성 열을 추가하려면, 필드 목록에 있는 열 명칭을 더블 클릭하십시오. 일반적으로 쿼리를 작성하는 데 여러 필드, 값 및 연산자를 이용하거나, SQL 란에 직접 입력할 수 있습니다.
값 목록 은 속성 테이블의 값을 표시합니다. 속성의 모든 가능한 값들을 표시하려면, 필드 목록에서 속성을 선택한 다음 [all] 버튼을 클릭하십시오. 속성 열의 처음 유일한 값 25개만 표시하려면, 필드 목록에서 속성을 선택한 다음 [Sample] 버튼을 클릭하십시오. SQL WHERE 절 란에 값을 추가하려면, 값 목록에 있는 값을 더블 클릭하십시오.
연산자 부분 은 사용할 수 있는 모든 연산자를 담고 있습니다. SQL WHERE 절 란에 연산자를 추가하려면, 적절한 버튼을 클릭하십시오. 관계 연산자(=, > 등등), 문자열 비교 연산자(LIKE), 그리고 논리 연산자(AND, OR 등등)를 사용할 수 있습니다.
[테스트] 버튼은 현재 쿼리를 만족하는 피처 개수를 보여주는 메시지 상자를 엽니다. 이 기능은 쿼리 작성 과정에 유용합니다. [클리어] 버튼은 SQL WHERE 절 텍스트 란에 있는 모든 텍스트를 지웁니다. [확인] 버튼을 클릭하면 창을 닫고 쿼리를 만족하는 피처들을 선택합니다. [취소] 버튼은 현재 선택 상태를 변경하지 않고 창을 닫습니다.
QGIS는 쿼리로 선택된 하위 집합을 마치 완전한 레이어인 것처럼 취급합니다. 예를 들면, 사용자가 앞의 그림처럼 ‘Borough’에 대해 필터를 적용한 경우, Anchorage를 표시하거나 쿼리하거나 저장하거나 편집할 수 없습니다. Anchorage는 ‘Municipality’이기 때문에 하위 집합의 일부가 아니기 때문입니다.
유일한 예외라고 하면 사용자 레이어가 데이터베이스의 일부가 아닌 경우, 하위 집합을 쿼리하면 레이어를 편집할 수 없다는 정도일까요.
스타일 메뉴는 사용자 벡터 데이터를 렌더링하고 심볼 작업을 하기 위한 종합 도구를 제공합니다. 모든 벡터 데이터에 공통적으로 쓰이는 도구는 물론 서로 다른 벡터 데이터 유형에 맞춰 설계된 특별한 심볼 작업 도구도 이용할 수 있습니다. 하지만 모든 데이터 유형이 다음 대화창 구조를 공유하고 있습니다. 상단에는 범주화 및 피처에 적용할 심볼을 준비하는 데 쓰이는 위젯이 있고, 하단에는 레이어 렌더링 위젯이 있습니다.
참고
벡터 심볼 내보내기
QGIS 벡터 심볼을 구글 *.kml, *.dxf 그리고 MapInfo *.tab 파일로 내보낼 수 있는 옵션이 존재합니다. 레이어를 오른쪽 클릭해서 컨텍스트 메뉴를 열어, Save As... 를 선택하고 산출물 파일명 및 유형을 지정하면 됩니다. 대화창에서는, Symbology export 메뉴에서 Feature symbology ‣ 또는 Symbol layer symbology ‣ 을 통해 심볼을 저장하십시오. 심볼 레이어를 사용해본 경험이 있다면, 두 번째 방법을 이용하는 편이 좋습니다.
렌더링 작업자가 정확한 심볼과 함께 피처를 그리는 일을 책임집니다. 레이어 도형 유형에 상관없이, 렌더링 작업자에는 단일 심볼, 범주, 등급 및 규칙 기반 4개의 공통 유형이 있습니다. 포인트 레이어의 경우, 포인트 변위(displacement)와 열지도 렌더링 작업자를 이용할 수 있는 반면 폴리곤 레이어의 경우 그 외에도 역(inverted) 렌더링 작업자를 통해 렌더링할 수도 있습니다.
연속 색상 렌더링 작업자라는 건 없습니다. 연속 색상 렌더링 작업자란 사실 등급 렌더링 작업자의 특수한 경우일 뿐이기 때문입니다. 심볼 및 색상표를 지정하면 심볼에 대한 색상을 적절하게 설정하는 범주 및 등급 렌더링 작업자를 생성할 수 있습니다. 각 데이터 유형(포인트, 라인 및 폴리곤)마다, 해당 벡터 심볼 레이어 유형이 존재합니다. 어떤 렌더링 작업자를 선택하느냐에 따라, 대화창에 서로 다른 위젯이 추가될 것입니다.
주석
벡터 레이어의 스타일을 설정할 때 렌더링 작업자 유형을 변경해도, 심볼에 대한 사용자 설정은 유지될 것입니다. 다만 단 한 번 변경하는 경우에만 유지된다는 점을 기억해주십시오. 렌더링 작업자 유형을 계속 변경하다보면 심볼 설정이 사라지게 됩니다.
단일 심볼 렌더링 작업자는 사용자가 지정한 단일 심볼을 이용해서 레이어의 모든 피처를 렌더링합니다. 심볼 표현에 대한 자세한 정보는 심볼 선택자 를 참조하세요.
Figure Symbology 1:
단일 심볼 라인 속성
범주 렌더링 작업자 는 선택한 피처의 속성값을 반영하는 사용자 지정 심볼을 이용해서 레이어의 모든 피처를 렌더링합니다. Categorized 메뉴에서 다음 옵션들을 지정할 수 있습니다:
속성 (열 목록 상자 또는 Set column expression 기능을 이용합니다. Expressions 을 참조하세요.)
각 범주에 기본값으로 쓰이게 될 심볼 (심볼 선택자 대화창을 이용합니다.)
심볼에 적용되는 색상을 선택할 색상 범위 (색상표 목록 상자를 이용합니다.)
그리고 범주화 버튼을 클릭해서 속성 열의 특정 값으로부터 범주들을 생성하십시오. 범주명 왼쪽에 있는 체크박스를 해제하면 각 범주를 비활성화시킬 수 있습니다.
심볼, 값 그리고/또는 범주를 변경하려면, 그냥 사용자가 원하는 항목을 더블클릭하면 됩니다.
오른쪽 클릭하면 나오는 컨텍스트 메뉴에는 복사/붙여넣기, 색상 변경, 투명도 변경, 산출물 단위 변경, 심볼 너비 변경 등이 있습니다.
그림 figure_symbology_2 은 QGIS 예시 데이터셋의 rivers 레이어에 대한 범주 렌더링 작업자 대화창을 보여주고 있습니다.
Figure Symbology 2:
범주 심볼 작업 옵션들
참고
여러 심볼 선택 및 변경
여러 개의 심볼을 한꺼번에 선택한 다음 오른쪽 클릭하면 선택한 항목들의 색상, 투명도, 크기 또는 너비를 한번에 변경할 수 있습니다.
참고
심볼 명칭과 범주를 일치시키기
[고급] 메뉴에서 classes 를 선택하면, 다음 두 가지 방법 가운데 하나를 통해 사용자 범주화에서 심볼 명칭과 범주 명칭을 일치시킬 수 있습니다. Matched to saved symbols 는 사용자의 스타일 관리자 에 있는 심볼 명칭에 범주 명칭을 일치시킵니다. Match to symbols from file 은 외부 파일에 있는 심볼 명칭에 범주 명칭을 일치시킵니다.
등급 렌더링 작업자 는 선택한 피처의 속성이 어떤 범주에 할당되는지를 반영하는 사용자 지정 심볼의 색상 또는 크기를 이용해서 레이어의 모든 피처를 렌더링합니다.
범주 렌더링 작업자처럼, 등급 렌더링 작업자는 지정한 열의 심볼의 기울기 및 크기 축척을 설정할 수 있습니다.
또한 범주 렌더링 작업자처럼, 다음 옵션들을 지정할 수 있습니다:
심볼 (심볼 선택자 대화창을 이용합니다.)
범례 양식 및 정밀도
심볼 변경 방법: 색상 또는 크기
색상 방법을 선택했을 경우 색상 (색상표 목록 상자를 이용합니다.)
크기 (크기 범위 및 해당 단위를 이용합니다.)
그 다음 할당된 필드 또는 표현식에서 나온 값의 대화형 히스토그램을 표시하는 히스토그램 탭을 이용할 수 있습니다. 히스토그램 위젯을 통해 범주 단계를 변경하거나 추가할 수 있습니다.
주석
통계 요약 패널을 통해 사용자 벡터 레이어에 대한 정보를 더 많이 얻을 수 있습니다. 통계 요약 패널 을 참조하세요.
범주 탭으로 돌아가면, 범주의 개수는 물론 각 범주에 있는 범주화 피처를 위한 모드도 (모드 목록을 이용해서) 설정할 수 있습니다. 다음 모드들을 선택할 수 있습니다:
동일 간격(Equal Interval): 각 범주가 동일한 크기입니다. (예를 들어 0에서 16까지의 값을 범주 4개로 설정하면, 각 범주의 크기는 4가 됩니다.)
분위(Quantile): 각 범주가 동일한 개수의 요소를 가지게 됩니다. (상자 수염 그림 개념입니다.)
Natural Breaks (Jenks): 각 범주 내부의 분산량은 최소인 반면 범주 간의 분산량은 최대로 잡는 모드입니다.
표준 편차: 값들의 표준 편차에 따라 범주를 생성합니다.
Pretty Breaks: x 값의 범위를 커버하면서 동일한 간격으로 보기 좋게 분포된 n+1 개의 일련의 값들을 계산합니다. 10의 거듭제곱을 1, 2 또는 5로 곱한 수를 값으로 선택합니다. (R 통계 환경의 pretty 에 기반한 모드입니다.)
Style 메뉴의 중심부에 있는 목록 상자는 범주의 렌더링될 범위, 라벨, 심볼을 포함하는 범주 목록을 담고 있습니다.
범주화 버튼을 클릭해서 선택한 모드를 이용하는 범주를 생성하십시오. 범주명 왼쪽에 있는 체크박스를 해제하면 각 범주를 비활성화시킬 수 있습니다.
심볼, 값 그리고/또는 범주를 변경하려면, 그냥 사용자가 원하는 항목을 더블클릭하면 됩니다.
오른쪽 클릭하면 나오는 컨텍스트 메뉴에는 복사/붙여넣기, 색상 변경, 투명도 변경, 산출물 단위 변경, 심볼 너비 변경 등이 있습니다.
그림 figure_symbology_3 은 QGIS 예시 데이터셋의 rivers 레이어에 대한 등급 렌더링 작업자 대화창을 보여주고 있습니다.
Figure Symbology 3:
등급 심볼 작업 옵션들
비례 심볼 및 다변량 분석은 스타일 렌더링 작업 드롭다운 목록에서 선택할 수 있는 렌더링 유형이 아닙니다. 하지만 앞에서 소개한 모든 렌더링 옵션에서 쓸 수 있는 Size Assistant 옵션을 통해, QGIS는 사용자의 포인트 및 라인 데이터를 해당 표현으로 표출할 수 있습니다.
비례 심볼 생성하기
먼저 레이어를 단일 심볼 렌더링 작업자 에 적용하면 비례 렌더링을 할 수 있습니다. 일단 심볼을 설정하고 나면, 심볼 트리의 상단에 있는 (각각 포인트 또는 라인 레이어에 대한) Size 또는 Width 버튼 옆에 레이어에 비례 심볼을 생성하는 도구를 제공하는 Data-defined override 버튼이 활성화됩니다. 사용자가 크기 표현식을 정의할 수 있는
메뉴를 통해서도 도우미 옵션에 접근할 수 있습니다.
Figure Symbology 4:
다양한 크기 도우미
도우미를 통해 다음 속성을 정의할 수 있습니다:
표현할 속성 (열 목록 상자 또는 Set column expression 기능을 이용합니다. Expressions 을 참조하세요.)
‘Flannery’, ‘Surface’ 또는 ‘Radius’ 가운데 표현의 축척 방식을 선택
심볼의 최소 및 최대 크기
표현할 값의 범위: 아래쪽 화살표를 클릭하면 선택한 속성 또는 사용자 데이터에 적용된 표현식이 반환하는 최소(또는 0) 및 최대값으로 이 항목을 자동적으로 채울 수 있습니다.
NULL 값을 표현하는 유일한 크기
대화창 우측에 있는 실시간으로 업데이트되는 위젯에서 피처 표현을 미리 볼 수 있습니다. 이 표현은 레이어 범례에 있는 레이어 트리에 추가되며, 인쇄 작성자 범례 항목에 있는 레이어 표현을 형성하는 데에도 쓰입니다.
앞에 나온 다양한 크기 도우미에 표현된 값들이 다음 표현식을 통해 ‘Data-defined override’ 크기를 설정할 것입니다:
coalesce(scale_exp(Importance, 1, 20, 2, 10, 0.57), 1)
다변량 분석 생성하기
다변량 분석 렌더링은 두 개 이상의 변수들 사이의 관계를 평가할 수 있습니다. 예를 들면 변수 하나를 크기로 표현하고, 다른 변수를 색상표로 표현할 수 있습니다.
QGIS에서 다변량 분석을 생성하는 가장 간단한 방법은 먼저 레이어 상의 모든 범주에 동일한 심볼 유형을 이용하는 범주 또는 등급 렌더링을 적용하는 것입니다. 그 다음 범주화 프레임 상단에 있는 심볼 [변경] 버튼을 클릭하면 심볼 선택자 대화창이 열리는데, 앞에서 설명한 대로 (포인트 레이어의 경우) 크기 또는 (라인 레이어의 경우) 너비에 대한 크기 도우미 옵션을 활성화해서 설정할 수 있습니다.
비례 심볼과 마찬가지로, 레이어 트리에 있는 범주 또는 등급 범주 심볼 위에 크기에 관련된 심볼이 추가됩니다. 이 두 표현 모두 인쇄 작성자 범례 항목에서도 쓸 수 있습니다.
규칙 기반 렌더링 작업자 는 선택한 피처의 속성이 어떤 범주에 할당되는지를 반영하는 규칙 기반 심볼을 이용해서 레이어의 모든 피처를 렌더링합니다. 이 규칙은 SQL 선언문을 기반으로 합니다. 대화창에서 필터 또는 축척으로 규칙을 그룹화할 수 있으며, 사용자가 심볼 수준을 활성화할지 또는 가장 먼저 일치한(first-matched) 규칙만 이용할지 결정할 수 있습니다.
규칙을 생성하려면, 기존 행을 더블클릭해서 활성화시키거나, ‘+’를 클릭한 다음 새 규칙을 추가하십시오. Rule properties 대화창에서 규칙에 대한 라벨을 정의할 수 있습니다. 버튼을 눌러 표현식 문자열 작성자를 여십시오. Function List 에서 Fields and Values 을 클릭, 검색할 속성 테이블의 모든 속성을 살펴보십시오. 어떤 속성을 필드 계산기의 표현식 란에 추가하려면, Fields and Values 목록에서 해당 명칭을 더블클릭하십시오. 일반적으로 계산 표현식을 작성하는 데 여러 필드, 값, 함수를 이용할 수 있습니다. 또는 표현식 란에 직접 입력해도 됩니다. (Expressions 참조) 오른쪽 클릭을 통해 기존 규칙을 복사하고 붙여넣어 새 규칙을 생성할 수도 있습니다. 또 해당 수준에서 일치하는 규칙이 없을 경우 실행될 ‘ELSE’ 규칙을 쓸 수도 있습니다. QGIS 2.8 버전부터, 맵 범례의 트리 계층에 규칙을 표시합니다. 맵 범례에서 규칙을 더블클릭하면, 트리에 있는 심볼의 배경에 있는 규칙을 보여주는 스타일 메뉴의 레이어 속성 창이 뜹니다.
그림 figure_symbology_5 은 QGIS 예시 데이터셋의 rivers 레이어에 대한 규칙 기반 렌더링 작업자 대화창을 보여주고 있습니다.
Figure Symbology 5:
규칙 기반 심볼 작업 옵션들
Point Displacement 렌더링 작업자는 포인트 레이어의 모든 피처를, 모든 피처가 동일한 위치에 있다 하더라도, 시각화합니다. 이를 위해 포인트의 심볼을 중심 심볼 1개 주위 또는 동심원 몇 개 상에 있는 변위 원(displacement circle) 위에 그립니다.
Figure Symbology 6:
포인트 변위 대화창
주석
Renderer 드롭다운 목록에서 단일 심볼, 등급, 범주 또는 규칙 기반 같은 다른 렌더링 작업자를 선택한 다음 Renderer Settings... 버튼을 클릭해도 피처를 렌더링할 수 있습니다.
Inverted Polygon 렌더링 작업자는 레이어에 있는 폴리곤의 바깥을 채울 심볼을 지정할 수 있습니다. 앞에서와 마찬가지로 단일 심볼, 등급, 범주, 규칙 기반 또는 2.5D 같은 하위 렌더링 작업자를 선택할 수 있습니다.
Figure Symbology 7:
반전 폴리곤 대화창
Heatmap 렌더링 작업자는 [멀티]포인트 레이어에 대해 실시간 동적 열지도를 생성할 수 있습니다. 사용자가 열지도 반경을 픽셀, 밀리미터 또는 맵 단위로 지정할 수 있고, 열지도 스타일을 위한 색상표를 선택하고 편집할 수 있으며, 렌더링 속도와 질 사이의 균형을 선택하기 위한 슬라이드 바를 이용할 수도 있습니다. 또 필드 또는 표현식을 통해 최대 값 제한을 정의하고 포인트에 가중치를 줄 수도 있습니다. 피처를 추가 또는 제거하면 열지도 렌더링 작업자가 열지도 스타일을 자동적으로 업데이트합니다.
Figure Symbology 8:
열지도 대화창
2.5 D 렌더링 작업자를 이용하면 사용자 레이어의 피처에 2.5D 효과를 줄 수 있습니다. 먼저 Height 값(맵 단위)을 설정하십시오. 고정값, 사용자 레이어의 필드 가운데 하나, 또는 표현식으로 설정할 수 있습니다. 또 Angle (도 단위)을 설정해서 시각의 방향을 (0° 는 서향으로, 값이 올라갈수록 반시계 방향으로 회전합니다) 재현해야 합니다. Roof Color 및 Wall Color 을 설정하려면 고급 환경 설정 옵션을 사용하십시오. 만약 피처의 벽에 태양광 효과를 주고 싶다면,
Shade walls based on aspect 옵션을 체크하도록 하십시오. Color 및 Size 값(맵 단위)을 설정하면 그림자 효과를 줄 수도 있습니다.
Figure Symbology 9:
2.5D 대화창
참고
다른 렌더링 작업자에서 2.5D 효과 이용하기
2.5D 렌더링 작업자에서 기본 스타일 설정을 마치고 나면, 다른 (단일 심볼, 범주, 등급) 렌더링 작업자로 변환시킬 수 있습니다. 2.5D 효과가 지속되는 동시에 다른 렌더링 작업자의 모든 특정 옵션도 쓸 수 있어 2.5D 효과를 정밀하게 조정할 수 있습니다. (예를 들어 멋진 2.5D 표현으로 범주 심볼을 그리거나 2.5D 심볼에 몇몇 추가 스타일 작업을 추가할 수도 있습니다.) 그림자 및 “건물” 자체가 주변의 다른 피처를 가리지 않도록 하려면, 심볼 수준(Advanced ‣ Symbol levels...)을 활성화해야 할 수도 있습니다. 2.5D 높이 및 각도 값은 레이어의 변수에 저장되기 때문에, 이후 레이어 속성 대화창의 변수 탭에서 편집할 수 있습니다.
스타일 탭에서 레이어의 모든 피처에 대해 일괄적으로 적용되는 몇몇 옵션들을 설정할 수도 있습니다:
Layer transparency : 이 도구를 통해 맵 캔버스에서 아래에 있는 레이어를 가시화할 수 있습니다. 슬라이드 바를 통해 사용자 벡터 레이어의 가시성을 필요에 따라 조정하십시오. 슬라이드 바 옆에 있는 메뉴에서 가시성을 정확한 백분율로 설정할 수도 있습니다.
Layer blending mode 및 Feature blending mode: 이 도구들을 통해 사용자가 그래픽 프로그램에서만 가능하다고 알고 있던 특별한 렌더링 효과를 줄 수 있습니다. 위 그리고 아래에 있는 레이어의 픽셀을 혼합 모드 에서 설명한 설정으로 혼합합니다.
Draw Effects 버튼: 레이어의 모든 피처에 대해 paint effects 를 줍니다.
Control feature rendering order: 피처 속성을 이용해서 피처를 어떤 순서로 렌더링해야 하는지에 대한 Z-order를 정의할 수 있습니다. 체크박스를 체크한 다음 옆에 있는 |browseButton| 버튼을 클릭하십시오. Define Order 대화창이 열리는데, 다음 작업들을 할 수 있습니다:
레이어 피처에 적용시킬 필드를 선택하거나 표현식을 작성합니다.
불러온 피처들을 어떤 순서로 배열할지 설정합니다. 예를 들어 오름차순 을 선택했다면, 높은 값을 가진 피처 아래에 낮은 값을 가진 피처를 렌더링합니다.
NULL 값을 반환하는 피처를 언제, 즉 맨 처음 또는 마지막으로 렌더링할지 정의합니다.
사용자가 몇몇 순서 규칙(rules of ordering)을 추가할 수 있습니다. 첫 번째 규칙은 레이어에 있는 모든 피처에 적용돼, 반환 값에 따라 피처들을 Z-order 순서로 배열합니다. 그 다음 규칙은 동일한 (NULL 값 포함) 값을 가진, 즉 동일한 Z 수준의 각 피처 그룹에 적용돼 각 그룹에 있는 항목들을 배열합니다. 그 다음 규칙은 다시...
Define Order 대화창의 설정을 적용하고 나면, Control feature rendering order 옵션 옆에 있는 텍스트 상자에 레이어 렌더링을 조정하는 데 쓰인 표현식(들)을 요약합니다.
Figure Layer Rendering 1:
레이어 렌더링 옵션들
적층(積層) 심볼 레이어를 지원하는 (열지도 제외) 렌더링 작업자의 경우 각 심볼 수준의 렌더링 순서를 조정하는 옵션이 존재합니다.
대부분의 렌더링 작업자의 경우, 저장된 심볼 목록 하단에 있는 [고급] 버튼을 클릭한 다음 Symbol levels 를 선택하면 심볼 수준 옵션에 접근할 수 있습니다. 규칙 기반 렌더링 작업자 의 경우 [Symbols levels] 버튼으로 직접 옵션에 접근할 수 있는 반면, 포인트 변위 렌더링 작업자의 경우 동일한 버튼이 Rendering settings 대화창에 있습니다.
심볼 수준을 활성화하려면, Enable symbol levels 를 체크하십시오. 복합 심볼, 라벨, 그리고 열로 나누어진 개별 심볼 레이어가 번호와 함께 각 행에 표시됩니다. 이 번호들이 심볼 레이어를 그릴 렌더링 순서 수준을 나타냅니다. 번호 숫자가 낮을수록 먼저 그려져 아래에 남고, 높을수록 나중에 그려져 다른 레이어 위에 있게 됩니다.
Figure Symbols levels 1:
심볼 수준 대화창
주석
심볼 수준을 비활성화하면, 심볼 각각의 피처 순서에 따라 완전한 심볼을 그립니다. 위에 있는 심볼은 아래 있는 심볼을 혼란스럽게 만들 뿐입니다. 게다가, 비슷한 심볼들이 서로 “합쳐”지지 않을 것입니다.
Figure Symbols levels 2:
심볼 수준 (A) 활성화 (B) 비활성화 비교
In order to improve layer rendering and avoid (or at least reduce)
the resort to other software for final rendering of maps, QGIS provides another
powerful functionality: the Draw Effects options,
which adds paint effects for customizing the visualization of vector layers.
The option is available in the Layer Properties –> Style dialog, under the Layer rendering group (applying to the whole layer) or in symbol layer properties (applying to corresponding features). You can combine both usage.
Paint effects can be activated by checking the Draw effects option
and clicking the
Customize effects button, that will open
the Effect Properties Dialog (see figure_effects_1). The following
effect types, with custom options are available:
Source: Draws the feature’s original style according to the configuration of the layer’s properties. The transparency of its style can be adjusted.
Figure Effects 1:
Draw Effects: Source dialog
Blur: Adds a blur effect on the vector layer. The options that someone can change are the Blur type (Stack or Gaussian blur), the strength and transparency of the blur effect.
Figure Effects 2:
Draw Effects: Blur dialog
Colorize: This effect can be used to make a version of the style using one
single hue. The base will always be a grayscale version of the symbol and you
can use the Grayscale to select how to create it
(options are: ‘lightness’, ‘luminosity’ and ‘average’). If
Colorise is selected, it will be possible to mix another color
and choose how strong it should be. You can also control the
Brightness, contrast and
saturation levels of the resulting symbol.
Figure Effects 3:
Draw Effects: Colorize dialog
Drop Shadow: Using this effect adds a shadow on the feature, which looks like adding an extra dimension. This effect can be customized by changing the offset degrees and radius, determining where the shadow shifts towards to and the proximity to the source object. Drop Shadow also has the option to change the blur radius, the transparency and the color of the effect.
Figure Effects 4:
Draw Effects: Drop Shadow dialog
Inner Shadow: This effect is similar to the Drop Shadow effect, but it adds the shadow effect on the inside of the edges of the feature. The available options for customization are the same as the Drop Shadow effect.
Figure Effects 5:
Draw Effects: Inner Shadow dialog
Inner Glow: Adds a glow effect inside the feature. This effect can be customized by adjusting the spread (width) of the glow, or the Blur radius. The latter specifies the proximity from the edge of the feature where you want any blurring to happen. Additionally, there are options to customize the color of the glow, with a single color or a color ramp.
Figure Effects 6:
Draw Effects: Inner Glow dialog
Outer Glow: This effect is similar to the Inner Glow effect, but it adds the glow effect on the outside of the edges of the feature. The available options for customization are the same as the Inner Glow effect.
Figure Effects 7:
Draw Effects: Outer Glow dialog
Transform: Adds the possibility of transforming the shape of the symbol. The first options available for customization are the Reflect horizontal and Reflect vertical, which actually create a reflection on the horizontal and/or vertical axes. The 4 other options are:
Figure Effects 8:
Draw Effects: Transform dialog
There are some common options available for all draw effect types. Transparency and Blend mode options work similar to the ones described in 레이어 렌더링 and can be used in all draw effects except for the transform one.
One or more draw effects can used at the same time. You activate/deactivate an effect
using its checkbox in the effects list. You can change the selected effect type by
using the Effect type option. You can reorder the effects
using
Move up and
Move down
buttons, and also add/remove effects using the
Add effect
and
Remove effect buttons.
There is also a Draw mode option available for
every draw effect, and you can choose whether to render and/or to modify the
symbol. Effects render from top to bottom.’Render only’ mode means that the
effect will be visible while the ‘Modify only’ mode means that the effect will
not be visible but the changes that it applies will be passed to the next effect
(the one immediately below). The ‘Render and Modify’ mode will make the
effect visible and pass any changes to the next effect. If the effect is in the
top of the effects list or if the immediately above effect is not in modify
mode, then it will use the original source symbol from the layers properties
(similar to source).
The Labels core application provides smart
labeling for vector point, line and polygon layers, and only requires a
few parameters. This application also supports on-the-fly transformed layers.
The following menus are used to configure the labeling of vector layers:
To label a layer start QGIS and load a vector layer. Activate the layer
in the legend and click on the Layer Labeling Options
icon in the QGIS toolbar menu or activate the Labels tab in the
layer properties dialog.
The first step is to choose the labeling method from the drop-down list. There are four options available:
Select the Show labels for this layer option and then select an attribute
column to use for labeling from the Label with drop-down list. Click
if you want to define labels based on
expressions - See Define labels based on expressions.
The following steps describe simple labeling without using the Data defined override functions, which are situated next to the drop-down menus - see Using data-defined override for labeling for an use-case.
You can define the text style in the Text menu (see Figure_labels_1). Use the Type case option to influence the text rendering. You have the possibility to render the text ‘All uppercase’, ‘All lowercase’ or ‘Capitalize first letter’. Use the 혼합 모드 to create effects known from graphics programs.
Figure Labels 1:
Smart labeling of vector point layers
In the Formatting menu, you can define a character for a line break in the labels with the ‘Wrap on character’ function. You can format the Line Height and the alignment. For the latter typical values are available plus Follow label placement. When set to this mode, text alignment for labels will be dependent on the final placement of the label relative to the point. E.g., if the label is placed to the left of the point then the label will be right aligned, and if it is placed to the right of the point then the label will be left aligned.
For line vector layers you can include line directions symbols. There are options specifying the type of symbol and the symbol placement.
Use the Formatted numbers option to format the numbers in
an attribute table. Here, decimal places may be inserted.
If you enable this option, three decimal places are initially set by default.
To create a buffer, just activate the Draw text buffer
checkbox in the Buffer menu.
The buffer color is variable. Here, you can also use blend modes.
If the
color buffer’s fill checkbox is activated, it will
interact with partially transparent text and give mixed color transparency
results. Turning off the buffer fill fixes that issue (except where the interior
aspect of the buffer’s stroke intersects with the text’s fill) and also allows
you to make outlined text.
In the Background menu, you can define with Size X and Size Y the shape of your background. Use Size type to insert an additional ‘Buffer’ into your background. The buffer size is set by default here. The background then consists of the buffer plus the background in Size X and Size Y. You can set a Rotation where you can choose between ‘Sync with label’, ‘Offset of label’ and ‘Fixed’. Using ‘Offset of label’ and ‘Fixed’, you can rotate the background. Define an Offset X,Y with X and Y values, and the background will be shifted. When applying Radius X,Y, the background gets rounded corners. Again, it is possible to mix the background with the underlying layers in the map canvas using the Blend mode (see 혼합 모드).
Use the Shadow menu for a user-defined Drop shadow.
The drawing of the background is very variable.
Choose between ‘Lowest label component’, ‘Text’, ‘Buffer’ and ‘Background’.
The Offset angle depends on the orientation
of the label. If you choose the Use global shadow checkbox,
then the zero point of the angle is
always oriented to the north and doesn’t depend on the orientation of the label.
You can influence the appearance of the shadow with the Blur radius.
The higher the number, the softer the shadows. The appearance of the drop shadow
can also be altered by choosing a blend mode.
Choose the Placement menu for configuring label placement and labeling priority. Note that the placement options differ according to the type of vector layer, namely point, line or polygon.
With the Cartographic placement mode,
point labels are generated with best visual relationship with the point feature,
following ideal cartographic placement rules. Labels can be placed
at a set Distance either from the point feature itself
or from the bounds of the symbol used to represent the feature.
The latter option is especially useful when the symbol size isn’t fixed,
e.g. if it’s set by a data defined size or when using different symbols
in a categorized renderer.
By default, placements are prioritised in the following order:
Placement priority can however be customized or set for an individual feature using a data defined list of prioritised positions. This also allows only certain placements to be used, so e.g. for coastal features you can prevent labels being placed over the land.
The Around point setting places the label in an equal
radius (set in Distance) circle around the feature. The placement of
the label can even be constrained using the Quadrant option.
In the Offset from point placement, labels are placed
at a fixed offset from the point feature.
You can select the Quadrant in which to place your label. You are also
able to set the X and Y offset distances between the points and their labels
and can alter the angle of the label placement with the Rotation setting.
Thus, placement in a selected quadrant with a defined rotation is possible.
Label options for line layers include Parallel,
Curved or
Horizontal.
For the
Parallel and
Curved options, you can set the position to
Above line,
On line and
Below line. It’s possible to select several options at once.
In that case, QGIS will look for the optimal label position. For Parallel and
curved placement you can also use the line orientation for the position of the label.
Additionally, you can define a Maximum angle between curved characters when
selecting the
Curved option (see Figure_labels_2 ).
For all three placement options you can set up a minimum distance for repeating labels. The distance can be in mm or in map units.
Figure Labels 2:
Smart labeling of vector line layers
You can choose one of the following options for placing labels in polygons:
Offset from centroid,
Horizontal
(slow),
Around centroid,
Free and
Using perimeter.
In the Offset from centroid settings you can specify
if the centroid is of the
visible polygon or
whole polygon. That means that either the centroid
is used for the polygon you can see on the map or the centroid is determined for
the whole polygon, no matter if you can see the whole feature on the map.
You can place your label within a specific quadrant, and define offset and rotation.
The
Around centroid setting places the label at a
specified distance around the centroid. Again, you can define
visible polygon
or
whole polygon for the centroid.
With the Using perimeter settings, you can define a
position and a distance for the label. For the position,
Above line,
On line,
Below line and
Line orientation
dependent position are possible. You can specify the distance between the label
and the polygon outline, as well as the repeat interval for the label.
Figure Labels 3:
Smart labeling of vector polygon layers
In the priority section you can define the priority with which labels are rendered for all three vector layer types (point, line, polygon). This placement option interact with labels of the other vector layers in the map canvas. If there are labels from different layers in the same location, the label with the higher priority will be displayed and the others will be left out.
In the Rendering menu, you can tune when the labels can be rendered and their interaction with other labels and features.
Under Label options, you find the scale-based and the Pixel size-based visibility settings.
The Label z-index determines the order in which labels are rendered, as well in relation with other feature labels in the layer (using data-defined override expression), as with labels from other layers. Labels with a higher z-index are rendered on top of labels (from any layer) with lower z-index.
Additionally, the logic has been tweaked so that if 2 labels have matching z-indexes, then:
Note that this setting doesn’t make labels to be drawn below the features from other layers, it just controls the order in which labels are drawn on top of all the layer’s features.
While rendering labels and in order to display readable labels,
QGIS automatically evaluates the position of the labels and can hide some of them
in case of collision. You can however choose to Show all
labels for this layer (including colliding labels) in order to manually fix their placement.
With data-defined expressions in Show label and Always Show you can fine tune which labels should be rendered.
Under Feature options, you can choose to label every part of a multi-part feature and limit the number of features to be labeled. Both line and polygon layers offer the option to set a minimum size for the features to be labeled, using Suppress labeling of features smaller than. For polygon features, you can also filter the labels to show according to whether they completely fit within the feature or not. For line features, you can choose to Merge connected lines to avoid duplicate labels, rendering a quite airy map in conjunction with the Distance or Repeat options in Placement tab.
From the Obstacles frame, you can manage the covering relation between
labels and features. Activate the Discourage labels from
covering features option to decide whether features of the layer should act as
obstacles for any label (including labels from other features in the same layer).
An obstacle is a feature QGIS tries as far as possible to not place labels over.
Instead of the whole layer, you can define a subset of features to use as obstacles,
using the
data-defined override control next to the option.
The priority control slider for obstacles allows you to make labels
prefer to overlap features from certain layers rather than others.
A Low weight obstacle priority means that features of the layer are less
considered as obstacles and thus more likely to be covered by labels.
This priority can also be data-defined, so that within the same layer,
certain features are more likely to be covered than others.
For polygon layers, you can choose the type of obstacle features could be by minimising the labels placement:
QGIS allows to use expressions to label features. Just click the
icon in the
Labels
menu of the properties dialog. In figure_labels_4 you see a sample expression
to label the alaska regions with name and area size, based on the field ‘NAME_2’,
some descriptive text and the function $area in combination with
format_number() to make it look nicer.
Figure Labels 4:
Expression based labeling is easy to work with. All you have to take care of is that:
Let’s have a look at some examples:
# label based on two fields 'name' and 'place' with a comma as separator
"name" || ', ' || "place"
-> John Smith, Paris
# label based on two fields 'name' and 'place' with other texts
'My name is ' + "name" + 'and I live in ' + "place"
'My name is ' || "name" || 'and I live in ' || "place"
concat('My name is ', name, ' and I live in ', "place")
-> My name is John Smith and I live in Paris
# label based on two fields 'name' and 'place' with other texts
# combining different concatenation functions
concat('My name is ', name, ' and I live in ' || place)
-> My name is John Smith and I live in Paris
-> My name is John Smith # if the field 'place' is NULL
# multi-line label based on two fields 'name' and 'place' with a descriptive text
concat('My name is ', "name", '\n' , 'I live in ' , "place")
-> My name is John Smith
I live in Paris
# label based on a field and the $area function
# to show the place name and its rounded area size in a converted unit.
'The area of ' || "place" || ' has a size of ' || round($area/10000) || ' ha'
-> The area of Paris has a size of 10500 ha
# create a CASE ELSE condition. If the population value in field
# population is <= 50000 it is a town, otherwise a city.
concat('This place is a ', CASE WHEN "population <= 50000" THEN 'town' ELSE 'city' END)
-> This place is a town
As you can see in the expression builder, you have hundreds of functions available to create simple and very complex expressions to label your data in QGIS. See Expressions chapter for more information and examples on expressions.
With the data-defined override functions, the settings for the labeling
are overridden by entries in the attribute table.
You can activate and deactivate the function with the right-mouse button.
Hover over the symbol and you see the information about the data-defined override,
including the current definition field.
We now describe an example using the data-defined override function for the
Move label function (see figure_labels_5 ).
Figure Labels 5:
Labeling of vector polygon layers with data-defined override
Figure Labels 6:
Move labels
With Rule-based labeling multiple label configurations can be defined and applied selectively on the base of expression filters, as in Rule-based rendering.
Rules can be set selecting the corresponding option at the top of the Labels panel (see figure_labels_7 ).
Figure Labels 7:
Rule based labeling panel
To create a rule, activate an existing row by double-clicking on it, or click on ‘+’ and click on the new rule. Within the panel you can set the filter expression and the related label configurations.
Figure Labels 8:
Rule settings
Within the Fields menu, the field attributes of the
selected dataset can be manipulated. The buttons
New Column and
Delete Column
can be used when the dataset is in
Editing mode.
Edit Widget
Figure Fields 1:
Dialog to select an edit widget for an attribute column
Within the Fields menu, you also find an edit widget column. This column can be used to define values or a range of values that are allowed to be added to the specific attribute table column. If you click on the [edit widget] button, a dialog opens, where you can define different widgets. These widgets are:
주석
QGIS has an advanced ‘hidden’ option to define your own field widget using python and add it to this impressive list of widgets. It is tricky but it is very well explained in following excellent blog that explains how to create a real time validation widget that can be used like described widgets. See http://blog.vitu.ch/10142013-1847/write-your-own-qgis-form-elements
참고
Relative Path in widgets
If the path which is selected with the file browser is located in the same directory as the .qgs project file or below, paths are converted to relative paths. This increases portability of a qgs project with multimedia information attached. This is enabled only for File Name, Photo and Web View at this moment.
With the Attribute editor layout, you can now define built-in forms (see figure_fields_2). This is useful for data entry jobs or to identify objects using the option auto open form when you have objects with many attributes. You can create an editor with several tabs and named groups to present the attribute fields.
Choose ‘Drag and drop designer’ and an attribute column. Use the
icon to create a category to insert a tab or a named group (see figure_fields_3).
When creating a new category, QGIS will insert a new tab or named group for the
category in the built-in form.
The next step will be to assign the relevant fields to a selected category
with the
icon. You can create more categories and use the
same fields again.
Other options in the dialog are ‘Autogenerate’ and ‘Provide ui-file’.
QGIS dialogs can have a Python function that is called when the dialog is opened. Use this function to add extra logic to your dialogs. The form code can be specified in three different ways:
In all cases you must enter the name of the function that will be called (open in the example below).
An example is (in module MyForms.py):
def open(dialog,layer,feature):
geom = feature.geometry()
control = dialog.findChild(QWidged,"My line edit")
Reference in Python Init Function like so: open
Figure Fields 2:
Dialog to create categories with the Attribute editor layout
Figure Fields 3:
Resulting built-in form with tabs and named groups
The Joins menu allows you to join a loaded attribute
table to a loaded vector layer. After clicking
, the
Add vector join dialog appears. As key columns, you have to define a
join layer you want to connect with the target vector layer.
Then, you have to specify the join field that is common to both the join layer
and the target layer. Now you can also specify a subset of fields from the joined
layer based on the checkbox
Choose which fields are joined.
As a result of the join, all information from the join layer and the target layer
are displayed in the attribute table of the target layer as joined information.
If you specified a subset of fields only these fields are displayed in the attribute
table of the target layer.
QGIS currently has support for joining non-spatial table formats supported by OGR (e.g., CSV, DBF and Excel), delimited text and the PostgreSQL provider (see figure_joins_1).
Figure Joins 1:
Join an attribute table to an existing vector layer
Additionally, the add vector join dialog allows you to:
The Diagrams menu allows you to add a graphic overlay to
a vector layer (see figure_diagrams_1).
The current core implementation of diagrams provides support for:
For each type of diagram, the menu is divided into five tabs:
Attributes defines which variables to display in the diagram.
Use add item button to select the desired fields into
the ‘Assigned Attributes’ panel. Generated attributes with Expressions
can also be used.
You can move up and down any row with click and drag, sorting how atributes are displayed. You can also change the label in the ‘Legend’ column or the attibute color by double-clicking the item.
This label is the default text displayed in the legend of the print composer or of the layer tree.
Figure Diagrams 1:
Vector properties dialog with diagram menu
Appearance defines how the diagram looks like. It provides general settings that do not interfere with the statistic values such as:
In this menu, you can also manage the diagram visibility:
Size is the main tab to set how the selected statistics are represented. The diagram size units can be ‘Map Units’ or ‘Millimeters’. You can use :
Figure Diagrams 2:
Vector properties dialog with diagram menu, Size tab
Placement helps to define diagram position. According to the layer geometry type, it offers different options for the placement:
The diagram can also be placed using feature data by filling the X and Y fields with an attribute of the feature.
The placement of the diagrams can interact with the labeling, so you can detect and solve position conflicts between diagrams and labels by setting the Priority slider or the z-index value.
The Options tab has settings only in case of histogram. You can choose whether the bar orientation should be ‘Up’, ‘Down’, ‘Right’ and ‘Left’.
참고
Switch quickly between diagrams
Given that almost all the settings above are common to the different types of diagram, when designing your diagram, you can easily change the diagram type and check which one is more appropriate to your data without any loss.
We will demonstrate an example and overlay on the Alaska boundary layer a text diagram showing temperature data from a climate vector layer. Both vector layers are part of the QGIS sample dataset (see section 예시 데이터).
Figure Diagrams 3:
Remember that in the Position tab, a Data
defined position of the diagrams is possible. Here, you can use attributes
to define the position of the diagram.
You can also set a scale-dependent visibility in the Appearance tab.
The size and the attributes can also be an expression.
Use the button to add an expression.
See Expressions chapter for more information and example.
QGIS provides the ability to perform an action based on the attributes
of a feature. This can be used to perform any number of actions, for example,
running a program with arguments built from the attributes of a feature or
passing parameters to a web reporting tool.
Figure Actions 1:
Overview action dialog with some sample actions
Actions are useful when you frequently want to run an external application or view a web page based on one or more values in your vector layer. They are divided into six types and can be used like this:
There are several examples included in the dialog. You can load them by clicking on [Add default actions]. One example is performing a search based on an attribute value. This concept is used in the following discussion.
Attribute actions are defined from the vector Layer Properties dialog. To define an action, open the vector Layer Properties dialog and click on the Actions menu. Go to the Action properties. Select ‘Generic’ as type and provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked, any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see using_actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.
If you have field names that are substrings of other field names (e.g., col1 and col10), you should indicate that by surrounding the field name (and the % character) with square brackets (e.g., [%col10]). This will prevent the %col10 field name from being mistaken for the %col1 field name with a 0 on the end. The brackets will be removed by QGIS when it substitutes in the value of the field. If you want the substituted field to be surrounded by square brackets, use a second set like this: [[%col10]].
Using the Identify Features tool, you can open the Identify Results dialog. It includes a (Derived) item that contains information relevant to the layer type. The values in this item can be accessed in a similar way to the other fields by proceeding the derived field name with (Derived).. For example, a point layer has an X and Y field, and the values of these fields can be used in the action with %(Derived).X and %(Derived).Y. The derived attributes are only available from the Identify Results dialog box, not the Attribute Table dialog box.
Two example actions are shown below:
In the first example, the web browser konqueror is invoked and passed a URL to open. The URL performs a Google search on the value of the nam field from our vector layer. Note that the application or script called by the action must be in the path, or you must provide the full path. To be certain, we could rewrite the first example as: /opt/kde3/bin/konqueror http://www.google.com/search?q=%nam. This will ensure that the konqueror application will be executed when the action is invoked.
The second example uses the %% notation, which does not rely on a particular field for its value. When the action is invoked, the %% will be replaced by the value of the selected field in the identify results or attribute table.
Actions can be invoked from either the Identify Results dialog,
an Attribute Table dialog or from Run Feature Action
(recall that these dialogs can be opened by clicking
Identify Features or
Open Attribute Table or
Run Feature Action). To invoke an action, right
click on the record and choose the action from the pop-up menu. Actions are
listed in the popup menu by the name you assigned when defining the action.
Click on the action you wish to invoke.
If you are invoking an action that uses the %% notation, right-click on the field value in the Identify Results dialog or the Attribute Table dialog that you wish to pass to the application or script.
Here is another example that pulls data out of a vector layer and inserts
it into a file using bash and the echo command (so it will only work on
or perhaps
). The layer in question has fields for a species name
taxon_name, latitude lat and longitude long. We would like to be
able to make a spatial selection of localities and export these field values
to a text file for the selected record (shown in yellow in the QGIS map area).
Here is the action to achieve this:
bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"
After selecting a few localities and running the action on each one, opening the output file will show something like this:
Acacia mearnsii -34.0800000000 150.0800000000
Acacia mearnsii -34.9000000000 150.1200000000
Acacia mearnsii -35.2200000000 149.9300000000
Acacia mearnsii -32.2700000000 150.4100000000
As an exercise, we can create an action that does a Google search on the lakes layer. First, we need to determine the URL required to perform a search on a keyword. This is easily done by just going to Google and doing a simple search, then grabbing the URL from the address bar in your browser. From this little effort, we see that the format is http://google.com/search?q=qgis, where QGIS is the search term. Armed with this information, we can proceed:
Make sure the lakes layer is loaded.
Open the Layer Properties dialog by double-clicking on the layer in the legend, or right-click and choose Properties from the pop-up menu.
Click on the Actions menu.
Enter a name for the action, for example Google Search.
For the action, we need to provide the name of the external program to run. In this case, we can use Firefox. If the program is not in your path, you need to provide the full path.
Following the name of the external application, add the URL used for doing a Google search, up to but not including the search term: http://google.com/search?q=
The text in the Action field should now look like this: firefox http://google.com/search?q=
Click on the drop-down box containing the field names for the lakes layer. It’s located just to the left of the [Insert Field] button.
From the drop-down box, select ‘NAMES’ and click [Insert Field].
Your action text now looks like this:
firefox http://google.com/search?q=%NAMES
To finalize the action, click the [Add to action list] button.
This completes the action, and it is ready to use. The final text of the action should look like this:
firefox http://google.com/search?q=%NAMES
We can now use the action. Close the Layer Properties dialog and zoom in to an area of interest. Make sure the lakes layer is active and identify a lake. In the result box you’ll now see that our action is visible:
Figure Actions 2:
Select feature and choose action
When we click on the action, it brings up Firefox and navigates to the URL http://www.google.com/search?q=Tustumena. It is also possible to add further attribute fields to the action. Therefore, you can add a + to the end of the action text, select another field and click on [Insert Field]. In this example, there is just no other field available that would make sense to search for.
You can define multiple actions for a layer, and each will show up in the Identify Results dialog.
You can also invoke actions from the attribute table by selecting a row and right-clicking, then choosing the action from the pop-up menu.
There are all kinds of uses for actions. For example, if you have a point layer containing locations of images or photos along with a file name, you could create an action to launch a viewer to display the image. You could also use actions to launch web-based reports for an attribute field or combination of fields, specifying them in the same way we did in our Google search example.
We can also make more complex examples, for instance, using Python actions.
Usually, when we create an action to open a file with an external application, we can use absolute paths, or eventually relative paths. In the second case, the path is relative to the location of the external program executable file. But what about if we need to use relative paths, relative to the selected layer (a file-based one, like a shapefile or SpatiaLite)? The following code will do the trick:
command = "firefox"
imagerelpath = "images_test/test_image.jpg"
layer = qgis.utils.iface.activeLayer()
import os.path
layerpath = layer.source() if layer.providerType() == 'ogr'
else (qgis.core.QgsDataSourceURI(layer.source()).database()
if layer.providerType() == 'spatialite' else None)
path = os.path.dirname(str(layerpath))
image = os.path.join(path,imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )
We just have to remember that the action is one of type Python and the command and imagerelpath variables must be changed to fit our needs.
But what about if the relative path needs to be relative to the (saved) project file? The code of the Python action would be:
command="firefox"
imagerelpath="images/test_image.jpg"
projectpath=qgis.core.QgsProject.instance().fileName()
import os.path
path=os.path.dirname(str(projectpath)) if projectpath != '' else None
image=os.path.join(path, imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )
Another Python action example is the one that allows us to add new layers to the project. For instance, the following examples will add to the project respectively a vector and a raster. The names of the files to be added to the project and the names to be given to the layers are data driven (filename and layername are column names of the table of attributes of the vector where the action was created):
qgis.utils.iface.addVectorLayer('/yourpath/[% "filename" %].shp',
'[% "layername" %]', 'ogr')
To add a raster (a TIF image in this example), it becomes:
qgis.utils.iface.addRasterLayer('/yourpath/[% "filename" %].tif',
'[% "layername" %]')
This menu is specifically created for Map Tips.
It includes a nice feature: Map Tip display text in HTML.
While you can still choose a
Field to be displayed
when hovering over a feature on the map, it is also possible to insert HTML code
that creates a complex display when hovering over a feature.
To activate Map Tips, select the menu option View ‣ Map Tips.
Figure Display 1 and 2 show an example of HTML code and how it behaves in map canvas.
Figure Display 1:
HTML code for map tip
Figure Display 2:
Map tip made with HTML code
QGIS offers support for on-the-fly feature generalisation. This can
improve rendering times when drawing many complex features at small scales.
This feature can be enabled or disabled in the layer settings using the
Simplify geometry option. There is also a global
setting that enables generalisation by default for newly added layers (see
section 옵션).
Figure Rendering 1:
Layer Geometry Simplification dialog
주석
Feature generalisation may introduce artefacts into your rendered output in some cases. These may include slivers between polygons and inaccurate rendering when using offset-based symbol layers.
While rendering extremely detailed layers (e.g. polygon layers with a huge number of nodes), this can cause composer exports in PDF/SVG format to be huge as all nodes are included in the exported file. This can also make the resultant file very slow to work with/open in other programs.
Checking Force layer to render as raster forces these
layers to be rasterised so that the exported files won’t have to include all
the nodes contained in these layers and the rendering is therefore sped up.
You can also do this by forcing the composer to export as a raster, but that is an all-or-nothing solution, given that the rasterisation is applied to all layers.
The Metadata menu consists of Description,
Attribution, MetadataURL, LegendUrl
and Properties sections.
In the Properties section, you get general information about the layer, including specifics about the type and location, number of features, feature type, and editing capabilities. The Extents table provides you with information on the layer extent and the Layer Spatial Reference System, which is information about the CRS of the layer. This can provide a quick way to get useful information about the layer.
Additionally, you can add or edit a title and abstract for the layer in the Description section. It’s also possible to define a Keyword list here. These keyword lists can be used in a metadata catalogue. If you want to use a title from an XML metadata file, you have to fill in a link in the DataUrl field.
Use Attribution to get attribute data from an XML metadata catalogue.
In MetadataUrl, you can define the general path to the XML metadata catalogue. This information will be saved in the QGIS project file for subsequent sessions and will be used for QGIS server.
In the LegendUrl section, you can provide the url of a legend image in the url field. You can use the Format drop-down option to apply the appropriate format of the image. Currently png, jpg and jpeg image formats are supported.
Figure Metadata 1:
Metadata menu in vector layers properties dialog
When a layer is added to map canvas, QGIS uses by default a random symbol/color to render its features. You can however set a default symbol in Project ‣ Properties ‣ Default styles that will be applied to each newly added layer according to its geometry type.
But, most of the time, you’d prefer to have a custom and more complex style that can be applied automatically or manually (with less efforts) to the layers. You can achieve this goal using the Style combobox at the bottom of the Layer Properties dialog. This combobox provides you with functions to create, load and manage styles.
A style stores any information set in the layer properties dialog to render or interact with the features (including symbology, labeling, action, diagram... settings).
Figure Vector Properties 10:
Style combobox options
By default, the style applied to a loaded layer is named default.
Once you have got the ideal and appropriate rendering for your layer,
you can save it by clicking the Style combobox and choose:
At the bottom of the Style drop-down list, you see the styles set for the layer and the active one is checked. Once you have more than one style defined for a layer, a Remove Current option can help you delete those you no longer want.
Note that each time you validate the layer properties dialog, the active style is updated with the changes you’ve done.
You can create as many styles as you wish for a layer but only one can be active at a time. Combined to layer visibility preset, this offers a quick and powerful way to manage complex projects with few layers (no need to duplicate any layer in the map legend).
참고
Manage styles from layer context menu
Right-click on the layer in Layers Panel to add, rename or remove layer style. You can also edit feature symbols.
While these styles are saved inside the project and can be copied and pasted from
layer to layer in the project, it’s also possible to save them outside the project
so that they can be loaded in another project.
Clicking the Style ‣ Save Style
saves the symbol as a QGIS layer style file (.qml) or SLD file (.sld).
SLDs can be exported from any type of renderer – single symbol,
categorized, graduated or rule-based – but when importing an SLD, either a
single symbol or rule-based renderer is created.
That means that categorized or graduated styles are converted to rule-based.
If you want to preserve those renderers, you have to stick to the QML format.
On the other hand, it can be very handy sometimes to have this easy way of
converting styles to rule-based.
If the datasource of the layer is a database (PostGIS or Spatialite for example), you can also save your layer style inside a table of the database. Just click on Save Style combobox and choose Save in database item then fill in the dialog to define a style name, add a description, an ui file if applicable and check if the style is the default style. You can add several style in the database. However each table can have only one default style.
When loading a layer in QGIS, if a default style already exists for this layer, QGIS will load the layer and its style. After you modified the layer style, you can Save as Default, creating a new style that becomes the default one or Restore Default style if you’re not satisfied.
Figure Vector Properties 2:
Save Style in database Dialog
참고
Quickly share a layer style within the project
You can also share layer style within a project without importing a file or database style: right-click on the layer in the Layers Panel and, from the Styles combobox , copy the style of a layer and paste it to a group or a selection of layers: the style is applied to all the layers that are of the same type (vector vs raster) as the original layer and, in case of vector, have the same geometry type (point, line or polygon).