GeoJsonData QML Type
GeoJSON 문서를 표현, 로드 및 저장하는 모델입니다. 더 보기...
Import Statement: | import QtLocation 6.8 |
Since: | QtLocation 6.7 |
- 상속된 멤버를 포함한 모든 멤버 목록
- GeoJsonData는 QML 맵 플러그인의 일부입니다.
속성
방법
- bool addItem(Item item)
- void clear()
- bool open()
- bool openUrl(Url url)
- bool save()
- bool saveAs(Url url)
- void setModelToMapContents(MapView mapItemView)
상세 설명
지오제이슨데이터 유형은 지오제이슨 형식의 문서를 읽고 씁니다. GeoJsonData에는 sourceUrl 속성으로 설정된 URL에서 모델을 열고 저장하는 함수가 있습니다. 로드된 모델은 내부적으로 QVariant 로 표시되며 model 속성에 바인딩됩니다. 델리게이트를 사용하여 뷰의 항목을 시각화합니다.
GeoJSON에 대한 자세한 내용은 GeoJSON 웹 사이트를 참조하십시오.
GeoJSON 개체
지오메트리, 피처 또는 지오메트리 또는 피처의 컬렉션을 나타내는 유효한 JSON 객체입니다.
GeoJSON 개체는 이러한 유형 중 하나여야 합니다:
Point
MultiPoint
LineString
MultiLineString
Polygon
MultiPolygon
GeometryCollection
Feature
FeatureCollection
유형을 설정하려면 type
멤버를 GeoJSON 유형에 바인딩합니다. coordinates
멤버는 GeoJSON 유형에 따라 QGeoShape 또는 목록 유형일 수 있습니다. Feature
유형에는 geometry
및 properties
멤버가 추가로 있습니다.
기하학적 유형과 그에 해당하는 QVariant 표현의 목록입니다:
Point
객체의 경우coordinates
은 QGeoCircle 과 쌍을 이룹니다. 예를 들어{ "type": "Point", "coordinates": [11, 60] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type: "Point" coordinates: QGeoCircle({11.000, 60.000}, -1) }
LineString
개체의 경우coordinates
은 QGeoPath 과 쌍을 이룹니다. 예를 들어{ "type" : "LineString", "coordinates" : [ [13.5, 43], [10.73, 59.92] ] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "LineString" data : QGeoPath([{43.000, 13.500}, {59.920, 10.730}]) }
Polygon
개체의 경우coordinates
멤버는 QGeoPolygon 와 쌍을 이룹니다(구멍이 있을 수 있음). 다각형은 선형 링으로, 최종 좌표가 첫 번째 좌표와 같으므로 링을 열고 닫을 수 있습니다.bbox
멤버는 선택적 멤버로 영역의 범위를 설정하는 데 사용되며 오목한 경계에 유용합니다. 허용되는 다각형 좌표에 대한 자세한 내용은 GeoJson 사양에서 다각형 유형에 대해 읽어보세요. 예를 들어{ "type": "Polygon", "coordinates": [ [ [17.13, 51.11], [30.54, 50.42], [26.70, 58.36], [17.13, 51.11] ] ], "bbox": [50, -50, 10, -10] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "Polygon" coordinates : QGeoPolygon([{51.110, 17.130}, {50.420,30.540}, {58.360, 26.700}, {51.110, 17.130}]) }
MultiPoint
, MultiLineString
, MultiPolygon
유형의 경우 coordinates
은 QVariantList 과 쌍을 이룹니다. 목록 요소는 지오메트리를 포함하는 QVariantMap 입니다.
MultiPoint
객체의 경우coordinates
은 포인트 좌표 목록과 쌍을 이룹니다. 예를 들어{ "type": "MultiPoint", "coordinates": [ [11, 60], [5.5, 60.3], [5.7, 58.90] ] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "MultiPoint" coordinates : [ { type : "Point" coordinates : QGeoCircle({60.000, 11.000}, -1) }, { type : "Point" coordinates : QGeoCircle({60.300, 5.500}, -1) }, { type : "Point" coordinates : QGeoCircle({58.900, 5.700}, -1) } ] }
MultiLineString
개체의 경우coordinates
은 LineString 좌표 목록과 쌍을 이룹니다. 다음 GeoJSON 객체는 평행하지 않은 두 개의 선을 구성합니다:{ "type" : "MultiLineString", "coordinates" : [ [[13.5, 43], [10.73, 59.92]], [[9.15, 45], [-3.15, 58.90]] ] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "MultiLineString" coordinates : [ { type : "LineString" coordinates : QGeoPath([{45.000, 9.150}, {58.900, -3.150}]) }, { type : "LineString" coordinates : QGeoPath([{43.000, 13.500}, {59.920, 10.730}]) } ] }
MultiPolygon
유형의 경우coordinates
은 다각형 좌표 목록과 쌍을 이룹니다. 다각형은 선형 링이며Polygon
유형에는 허용되는 형식에 대한 자세한 정보가 있습니다. 다음 GeoJSON 객체에는 두 개의 삼각형 목록이 포함되어 있습니다:{ "type" : "MultiPolygon", "coordinates" : [ [ [[17.13, 51.11], [30.54, 50.42], [26.74, 58.36], [17.13, 51.11] ]], [ [[19.84, 41.33], [30.45, 49.26], [17.07, 50.10], [19.84, 41.33] ]] ] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "MultiPolygon" coordinates : [ { type : "Polygon" coordinates : QGeoPolygon([{51.110, 17.130}, {50.420,30.540}, {58.360, 26.740}]) }, { type : "Polygon" coordinates : QGeoPolygon([{41.330, 19.840}, {49.260,30.450}, {50.100, 17.070}]) } ] }
GeometryCollection
유형은 다른 지오메트리 유형의 구성입니다. geometries
멤버의 값은 다른 GeometryCollection 유형을 포함하여 다양한 유형의 QVariantMaps를 포함하는 QVariantList 입니다.
예를 들어 다음 GeometryCollection
유형에는 여러 다른 도형이 포함되어 있습니다:
{ "type" : "GeometryCollection", "geometries" : [ { "type" : "MultiPoint", "coordinates" : [ [11,60], [5.5,60.3], [5.7,58.90] ] }, { "type" : "MultiLineString", "coordinates": [ [[13.5, 43], [10.73, 59.92]], [[9.15, 45], [-3.15, 58.90]] ] }, { "type" : "MultiPolygon", "coordinates" : [ [ [ [17.13, 51.11], [30.54, 50.42], [26.74, 58.36], [17.13, 51.11] ] ], [ [ [19.84, 41.33], [30.45, 49.26], [17.07, 50.10], [19.84, 41.33] ] ] ] } ] }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "GeometryCollection" coordinates : [ { type : "MultiPolygon" coordinates : [ { type : "Polygon" coordinates : QGeoPolygon([{41.330, 19.840}, {49.260, 30.450}, {50.100, 17.070}]) }, { type : "Polygon" coordinates : QGeoPolygon([{51.110, 17.130}, {50.420, 30.540}, {58.360, 26.740}]) } ] } { type : "MultiLineString" coordinates : [ { type : "LineString" coordinates : QGeoPath([{45.000, 9.150}, {58.900, -3.150}]) }, { type : "LineString" coordinates : QGeoPath([{43.000, 13.500}, {59.920, 10.730}]) } ] } { type : "MultiPoint" coordinates : [ { type : Point coordinates : QGeoCircle({58.900, 5.700}, -1) }, { type : Point coordinates : QGeoCircle({60.300, 5.500}, -1) }, { type : Point coordinates : QGeoCircle({60.000, 11.000}, -1) } ] } ] }
Feature
유형에는 geometry
및 properties
멤버가 추가로 포함되어 있습니다. Feature 객체를 다른 도형 객체와 구별하는 유일한 방법은 QVariantMap 객체에서 properties
노드가 있는지 확인하는 것입니다.
예를 들어 다음 Feature
에는 지오메트리 및 속성 멤버가 있습니다:
{ "type": "Feature", "id": "Poly", "properties": { "name": "Poly", "text": "This is a Feature with a Polygon", "color": "limegreen" }, "geometry": { "type": "Polygon", "coordinates": [ [ [17.13, 51.11], [30.54, 50.42], [26.70, 58.36], [17.13, 51.11] ], [ [23.46, 54.36], [20.52, 51.91], [28.25, 51.50], [26.80, 54.36], [23.46, 54.36] ] ] } }
이 GeoJSON 객체에는 해당하는 QVariantMap 표현이 있습니다:
{ type : "Polygon" data : QGeoPolygon([{51.110, 17.130}, {50.420,30.540}, {58.360, 26.700}, {51.110, 17.130}]) properties : {text : "This is a Feature with a Polygon"} }
FeatureCollection
은 Feature 객체의 구성입니다. features
멤버는 다른 Feature 객체가 포함된 QVariantList 객체에 바인딩됩니다.
예를 들어 다음 FeatureCollection
에는 여러 피처와 도형이 있습니다:
{ "type" : "FeatureCollection", "properties" : { "color" : "crimson" }, "features" : [ { "type" : "Feature", "id" : "Poly", "properties" : { "text" : "This is a Feature with a Polygon" }, "geometry" : { "type" : "Polygon", "coordinates" : [ [ [17.13, 51.11], [30.54, 50.42], [26.70, 58.36], [17.13, 51.11] ], [ [23.46, 54.36], [20.52, 51.91], [28.25, 51.50], [26.80, 54.36], [23.46, 54.36] ] ] } }, { "type" : "Feature", "id" : "MultiLine", "properties" : { "text" : "This is a Feature with a MultiLineString", "color" : "deepskyblue" }, "geometry" : { "type" : "MultiLineString", "coordinates" : [ [[13.5, 43], [10.73, 59.92]], [[9.15, 45], [-3.15, 58.90]] ] } } ] }
이 GeoJSON 개체에는 해당 QVariantMap 표현이 있습니다:
{ type: "FeatureCollection" data: [{ type: "MultiLineString" data: [{ type: "LineString" data: QGeoPath( [{45.000, 9.150}, {58.900, -3.150}] ) } { type: "LineString" data: QGeoPath( [{43.000, 13.500}, {59.920, 10.730}] ) }] properties: { text: "This is a Feature with a MultiLineString" } }, { type: "Polygon" data: QGeoPolygon( {51.110, 17.130}, {50.420, 30.540}, {58.360, 26.700}, {51.110, 17.130} ) properties: { text: "This is a Feature with a Polygon" } } ] }
GeoJson 예제
GeoJson 뷰어 예제는 맵에서 좌표를 로드하고 시각화하기 위해 GeoJsonData QML 유형을 사용하는 방법을 보여줍니다.
속성 문서
model : QVariant |
GeoJSON 문서의 QVariant 표현입니다. QML 델리게이트는 뷰에 내용을 표시할 수 있습니다.
이 프로퍼티는 Qt 6.7에 도입되었습니다.
sourceUrl : QUrl |
GeoJSON 문서의 URL입니다. 이 속성을 설정하면 문서가 로드되고 개체가 model 멤버에 바인딩됩니다.
이 속성은 Qt 6.7에 도입되었습니다.
메서드 문서
void clear() |
model 에 바인딩된 모든 항목을 삭제합니다.
void setModelToMapContents(MapView mapItemView) |
mapItemView 의 모든 맵 항목을 GeoJsonData 객체의 model 에 추가합니다. model 에서 이전에 저장된 맵 항목을 삭제합니다.
설정에 성공하면 true
을 반환하고, 그렇지 않으면 false
을 반환합니다.
addItem 를참조하세요 .
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.