ArcGIS Blog

Esri contributes to the latest version of the Qt Project

By Eric Bader

The Qt Company’s Qt SDK offers a GeoServices location API, the QtLocation API, that helps developers create viable mapping solutions using location services from leading map data providers. Starting with the recent release of Qt 5.8, Esri became a full-fledged GeoServices provider as well, announcing their contribution at last year’s QtCon 2016 in Berlin, Germany. The QtLocation API allows you to display and interact with tiled basemaps, find places and addresses, and perform point to point routing.

The QtLocation functionalities are provided to developers as plugins to the Qt framework.

The Esri GeoServices plugin works for previous versions of Qt as well (5.6 and 5.7). Developers can begin integrating Esri basemaps into their Qt applications today. Esri has already started using the plugin for their own apps, including Survey123. The plugin is independent of the ArcGIS Runtime SDK for Qt and does not require any components of ArcGIS Runtime. It is supported on any platform The Qt Company supports.

The Esri plugin works out-of-the-box in Qt 5.8, using the “esri” provider. To test-drive QtLocation, you don’t need to write any code. Simply start Qt Creator, go to the “Welcome” mode, select “Examples” and enter “map” in the search field. Choose “Map Viewer (QML)”. Start the example application, and in the menu “Provider”, select “Esri”. You can try 12 different esri map styles provided by the plugin.

Working with the plugin

To use Esri geoservice plugin in your QML code, you can create a Plugin item and set the name property to “esri”. To create a map using this plugin, create `Map` item and set `plugin` property.

Plugin {
   id: esriPlugin
   name: "esri"
}

Map {
   id: map
   plugin: esriPlugin
}

Esri’s plugin supports 12 different basemaps. The list of available maps is accessible using supportedMapTypes property from the Map item.

 Map {
    id: map
    plugin: esriPlugin
    onSupportedMapTypesChanged: {
       console.log("Supported MapType:");
       for (var i = 0; i < map.supportedMapTypes.length; i++) {
          console.log(i, supportedMapTypes[i].name);
       }
    }
 }

To select one map type, use activeMapType property. For example, to select the first one:

 Map {
    id: map
    plugin: esriPlugin
    activeMapType: supportedMapTypes[0]
 }

There are some services provided by the Esri plugin that require you to register the application
and use a token (for example, the routing service). See documentation for details. The token must be defined in PluginParameter:

 Plugin {
    id: esriPlugin
    name: "esri"
    PluginParameter { name: "token"; value: "YOUR_TOKEN" }
 }

QtLocation focuses on a Qt-standard, RESTful protocol for using connected-only mapping and location services. It is intended specifically for displaying detailed basemaps and simple search services that provide the geographic context to Qt applications. ArcGIS Runtime SDK for Qt on the other hand goes much deeper in giving developers the full breadth of precise, scientific geographic capabilities for bringing ArcGIS to anyone and everyone, anytime, anywhere. Take a bit of time to check out some of the other great content that you and your users can work with using the full Runtime SDK. If you want to take a closer look at what the SDK can do, take a look at the stand-alone samples viewers which give you full access to the open source app code on github.

Have questions and comments? We invite you to collaborate with us and the community on GeoNet and through the Qt Interest mailing list.

– The ArcGIS Runtime SDK for Qt team

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments