GeoJsonData QML Type

A model to represent, load and save GeoJSON documents. More...

Import Statement: import QtLocation 6.8
Since: QtLocation 6.7

Properties

Methods

Detailed Description

The GeoJsonData element reads and writes GeoJson documents (see the Wikipedia page, RFC) from the sourceUrl. The respective data can be accessed as QVariant via the model property. The QVariant representation can be used with delegates to visualize the data or to make small modifications, e.g. adding new items with the addItem function.

New data can be stored with the save and saveAs functions.

See also QGeoJson.

Property Documentation

model : QVariant [since 6.7]

A QVariant representation of the GeoJSON document that can be used to display the contents with delegates.

This property was introduced in Qt 6.7.


sourceUrl : QUrl [since 6.7]

The URL from which the GeoJSON document is read. Setting this property will change the model to represent the respective document.

This property was introduced in Qt 6.7.


Method Documentation

bool addItem(Item item)

Add the item to the model of the GeoJsonData.

Returns true if the file was read successfully, false otherwise.


void clear()

Delete all items in the model of the GeoJsonData.


bool open()

Reload the content of the file at sourceUrl.

Returns true if the file was read successfully, false otherwise.


bool openUrl(Url url)

Open the GeoJson file at url and load its content. The property sourceUrl will be set to url if the file is read successfully.

Returns true if the file was read successfully, false otherwise.


bool save()

The current model of the GeoJsonData object is saved under sourceUrl.

Returns true if the file was saved successfully, false otherwise.


bool saveAs(Url url)

The current model of the GeoJsonData object is saved under url. The sourceUrl property will be set to url.

Returns true if the file was saved successfully, false otherwise.


void setModelToMapContents(MapView mapItemView)

All mapItems of mapItemView are added to the model of the GeoJsonData object. Previously stored mapItems are deleted from the model.

Returns true if mapItemView is set successfully, false otherwise.

See also addItem.


© 2024 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.