import QtQuick 2.12 import QtQuick.Controls 2.5 import QtLocation 5.15 import QtPositioning 5.5 ApplicationWindow { width: 640 height: 480 visible: true title: qsTr("Pick a location") id: root signal selected() PositionSource { id: positionSource } function getSelectedLocation(){ return marker.coordinate.latitude + "|" + marker.coordinate.longitude } function setMapPosition(lat, lon){ marker.coordinate = QtPositioning.coordinate(parseFloat(lat), parseFloat(lon)); map.center = QtPositioning.coordinate(parseFloat(lat), parseFloat(lon)); } Plugin { id: mapPlugin name: "osm" // "mapboxgl", "esri", ... // specify plugin parameters if necessary // that's for mapbox: // PluginParameter { // name: "access_token" // value: "pk.eyJ1Ijoia3ViYS1vcmxpayIsImEiOiJja2plYzc3bjYyaW8yMnhydXNsY2FxdTFhIn0.Qi8QihmbMcxfvoOXaQ7PxQ" // } PluginParameter{ name: "osm.mapping.custom.host" value: "https://tile.openstreetmap.org/" } } Map { anchors.fill: parent plugin: mapPlugin id: map center: QtPositioning.coordinate(52.397445910207296, 16.90215638925963) // PoznaƄ zoomLevel: 16 maximumZoomLevel: 19 activeMapType: supportedMapTypes[supportedMapTypes.length - 1] // MapParameter { // type: "layer" // property var name: "3d-buildings" // property var source: "composite" // property var sourceLayer: "building" // property var layerType: "fill-extrusion" // property var minzoom: 15.0 // } // MapParameter { // type: "filter" // property var layer: "3d-buildings" // property var filter: [ "==", "extrude", "true" ] // } // MapParameter { // type: "paint" // property var layer: "3d-buildings" // property var fillExtrusionColor: "#aaaaaa" // property var fillExtrusionOpacity: .6 // property var fillExtrusionHeight: { return { type: "identity", property: "height" } } // property var fillExtrusionBase: { return { type: "identity", property: "min_height" } } // } MapQuickItem { id:marker sourceItem: Image{ id: image source: "pin64.png" width: 32 height: 32 } coordinate: map.center anchorPoint.x: image.width / 2 anchorPoint.y: image.height } MouseArea { anchors.fill: parent onClicked: { marker.coordinate = map.toCoordinate(Qt.point(mouse.x,mouse.y)) } onDoubleClicked: { marker.coordinate = map.toCoordinate(Qt.point(mouse.x,mouse.y)) root.selected() } } } }