~rick-rickspencer3/+junk/MapExample

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import QtQuick 2.0
import Ubuntu.Components 0.1
import "components"
import QtPositioning 5.2
import QtLocation 5.0
import QtQuick.XmlListModel 2.0

MainView {
    objectName: "mainView"

    applicationName: "com.ubuntu.developer.rick-rickspencer3.MapExample"

    width: units.gu(40)
    height: units.gu(60)

    Page
    {
        title: i18n.tr("")
        Map
        {
           anchors.fill: parent
           center: QtPositioning.coordinate(38.87, -77.045)
           zoomLevel: 13
           plugin:  Plugin { name: "osm"}
           MapItemView
           {
               model: bikeStationModel

               delegate: MapQuickItem
               {
                  id: poiItem
                  coordinate: QtPositioning.coordinate(lat,lng)
                  anchorPoint.x: poiImage.width * 0.5
                  anchorPoint.y: poiImage.height

                  sourceItem: Image
                  {
                      id: poiImage
                      width: units.gu(2)
                      height: units.gu(2)
                      source: "bike_poi.png"
                  }
               }
           }

        }
     }
    XmlListModel
    {
        id: bikeStationModel
        source: "https://www.capitalbikeshare.com/data/stations/bikeStations.xml"
        query: "/stations/station"
        XmlRole { name: "lat"; query: "lat/string()"; isKey: true }
        XmlRole { name: "lng"; query: "long/string()"; isKey: true }
    }
}