Feature layer (dictionary renderer)

View inQMLC++
View on GitHub
Sample viewer app

Convert features into graphics to show them with mil2525d symbols.

screenshot

Use case

A dictionary renderer uses a style file along with a rule engine to display advanced symbology. This is useful for displaying features using precise military symbology.

How to use the sample

Pan and zoom around the map. Observe the displayed military symbology on the map.

How it works

  1. Create a Geodatabase using Geodatabase(geodatabasePath).
  2. Load the geodatabase asynchronously using Geodatabase::load().
  3. Instantiate a DictionarySymbolStyle using DictionarySymbolStyle::createFromFile(stylePath).
  4. Wait for geodatabase to completely load by connecting to Geodatabase::loadStatusChanged signal.
  5. Cycle through each GeodatabaseFeatureTable from the geodatabase using Geodatabase::geodatabaseFeatureTables().
  6. Create a FeatureLayer from each table within the geodatabase using FeatureLayer(GeodatabaseFeatureTable).
  7. Load the feature layer asynchronously with FeatureLayer::load().
  8. Wait for each layer to load using FeatureLayer::loadStatusChanged.
  9. After the last layer has loaded, then create a new Envelope from a union of the extents of all layers.

    • Set the envelope to be the Viewpoint of the map view using MapView::setViewpoint(Envelope).
  10. Add the feature layer to map using Map::operationalLayers()::append(FeatureLayer).
  11. Create DictionaryRenderer(DictionarySymbolStyle) and attach to the feature layer using FeatureLayer::setRenderer(DictionaryRenderer).

Relevant API

  • DictionaryRenderer
  • DictionarySymbolStyle

Offline Data

Read more about how to set up the sample's offline data here.

Link Local Location
Mil2525d Stylx File <userhome>/ArcGIS/Runtime/Data/styles/arcade_style/mil2525d.stylx
Military Overlay geodatabase <userhome>/ArcGIS/Runtime/Data/geodatabase/militaryoverlay.geodatabase

Tags

military, symbol

Sample Code

FeatureLayerDictionaryRenderer.qmlFeatureLayerDictionaryRenderer.cppFeatureLayerDictionaryRenderer.h
                                             
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
// [WriteFile Name=FeatureLayerDictionaryRenderer, Category=Features]
// [Legal]
// Copyright 2016 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.Samples 1.0

FeatureLayerDictionaryRendererSample {
    id: featureLayerDictionaryRendererSample
    width: 800
    height: 600

    // Create MapView here, and create its Map in C++ code
    MapView {
        objectName: "mapView"
        anchors.fill: parent
    }

    ProgressBar {
        id: progressBar_loading
        anchors {
            horizontalCenter: parent.horizontalCenter
            bottom: parent.bottom
            margins: 5
        }
        indeterminate: true
    }

    onAllLayersLoaded: {
        progressBar_loading.visible = false;
    }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.