Skip to content
guillaume charbonnier edited this page Mar 29, 2019 · 7 revisions

Map

topicmap
😅 (difficulty) ⌛ (time-Box) 🔗 (related to)
3️⃣ / 5️⃣ 60 - 90 mn Location, Positioning

Get to know all about maps in QML :

  • control the map : type, center position, zoom
  • add all type of marker elements to the map
  • query the map services about specific element
  • ..

✔️ primary objectives

:suspect: Piece of cake

  • Select a location services provider
  • Add a map

:rage1: Easy

  • Set the map to the device current position
  • control the map properties : tilt, rotation, zoom level
  • change the map type
  • position a filled cercle at a given location : try to set a fixed "world" size (i.e 100m) or a fixed screen size.

:rage3: Normal

  • when clicking on the map, an image item should be set related to the position corresponding to the mouse clik (for instance 250m to the east)
  • Dynamical creation of marker (as a rectangle, an image or anything else you want) : each time one click on the map a marker is created, when clicking on an existing marker it gets deleted

💰 useful ressources

👶 Newbies area

Warning : Spoilers !!!
QML types Module Useful for...
Plugin Location service provider : "osm", "here","esri"...
Map Location Display a map using a given plugin
PositionSource Positioning give your position
MapCircle Location A circle marker to position on your map
MapQuickItem Location A map container to position any item on your map
MapItemView Location A view to position items on your map
GeocodeModel Location will give you the coordinate of an address
PlaceSearchModel Location A geo queryable model providing items matching your searchTerm in the given searchArea
RouteQuery RouteModel Location create a navigation query

ℹ️ useful information and hints

  • use QtPositioning.coordinate to create a coordinate object from a given position
  • use atDistanceAndAzimuth to create a coordinate relative to another
  • use supportedMapTypes property to get the list of map type supported and activeMapType to select : activeMapType = supportedMapTypes[0]
  • XmlListModel is very handy to display the content of a georss.
    XmlListModel {
        namespaceDeclarations: "declare namespace geo='http://www.w3.org/2003/01/geo/wgs84_pos#';"
        source: "http://whc.unesco.org/en/list/georss/"
        query: "/rss/channel/item"
        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "description"; query: "description/string()" }
        XmlRole { name: "lat"; query: "geo:lat/string()" }
        XmlRole { name: "long"; query: "geo:long/string()" }
    }

⚠️ cautions and warnings

  • check services provider limitations about free plan / features

secondary objectives (only for the braves 🏆 )

:rage4: very difficult

  • place a picture for every restaurants around us within 2km
  • Geocode/reverse geocode each time a marker is clicked, display its address and position

:goberserk: Nightmare

  • display the navigation from your current position to a selected POI

:godmode: God mode

  • Show the unesco world heritage on a map, for every entry display the picture and the description

Clone this wiki locally