Qt World Summit: Submit your Presentation

Best Way to Access Google Maps API on QML

  • Hi everyone,
    I'm trying to display a Map using the Google Maps API (GOOGLE MAPS API).
    There I see that the Javascript API using HTML is quite easy.

    With this simple HTML file you could get the Google Maps Map:

    <!DOCTYPE html>
        <title>Simple Map</title>
        <meta name="viewport" content="initial-scale=1.0">
        <meta charset="utf-8">
          html, body {
            height: 100%;
            margin: 0;
            padding: 0;
          #map {
            height: 100%;
        <div id="map"></div>
    var map;
    function initMap() {
      map = new google.maps.Map(document.getElementById('map'), {
        center: {lat: -34.397, lng: 150.644},
        zoom: 8
        <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
            async defer></script>

    So, if I want to use this API in QML, which is the best way?
    Using a WebView to load this HTML file?
    Is there a more native way to get that?

    Thank you very much!

  • Moderators

    There's a contributed plugin (somewhere in the Showcase forum) that implements a plugin for the QtLocation module.

  • Is there a reason you want to specifically use Google Maps? There are a multitude of providers already with Qt Location, including Esri, Here, and Mapbox. In addition, Esri provides a full mapping/location SDK that goes far beyond Qt Location capabilities - https://developers.arcgis.com/qt/

Log in to reply