Display dimensions

View inWPFWinUIForms
View on GitHub

Display dimension features from a mobile map package.

Image showing the Display Dimensions sample

Use case

Dimensions show specific lengths or distances on a map. A dimension may indicate the length of a side of a building or land parcel, or the distance between two features, such as a fire hydrant and the corner of a building.

How to use the sample

When the sample loads, it will automatically display the map containing dimension features from the mobile map package. The name of the dimension layer containing the dimension features is displayed in the controls box. Control the visibility of the dimension layer with the "Dimension Layer visibility" check box, and apply a definition expression to show dimensions of greater than or equal to 450m in length using the "Definition Expression" checkbox.

How it works

  1. Load a MobileMapPackage that contains DimensionLayer
  2. After it successfully loads, get the map from the mmpk and add it to the map view: mobileMapPackage.Maps.First().
  3. Get the DimensionLayer from the map view and set the name of the layer to the UI with dimensionLayer.Name.
  4. Control the dimension layer's visibility with dimensionLayer.IsVisible and set a definition expression with dimensionLayer.DefinitionExpression.

Relevant API

  • DimensionLayer
  • MobileMapPackage

About the data

This sample shows a subset of the Edinburgh, Scotland network of pylons, substations, and powerlines within an Edinburgh Pylon Dimensions mobile map package, digitized from satellite imagery. Note the data is intended as illustrative of the network only.

Additional information

Dimension layers can be taken offline from a feature service hosted on ArcGIS Enterprise 10.9 or later, using the GeodatabaseSyncTask. Dimension layers are also supported in mobile map packages or mobile geodatabases created in ArcGIS Pro 2.9 or later.

Tags

dimension, layer, mmpk, mobile map package, utility

Sample Code

DisplayDimensions.xamlDisplayDimensions.xamlDisplayDimensions.xaml.cs
Use dark colors for code blocksCopy
                                                         
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
57
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.DisplayDimensions.DisplayDimensions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border MaxWidth="240" Style="{StaticResource BorderStyle}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="PylonLabel"
                           Grid.Row="0"
                           Grid.ColumnSpan="2"
                           Margin="0,0,0,5"
                           HorizontalAlignment="Center"
                           FontWeight="SemiBold" />
                <CheckBox x:Name="DimensionLayerCheckBox"
                          Grid.Row="1"
                          Grid.Column="0"
                          VerticalAlignment="Center"
                          VerticalContentAlignment="Center"
                          Checked="DimensionLayerCheckBoxChanged"
                          IsChecked="True"
                          IsEnabled="False"
                          Unchecked="DimensionLayerCheckBoxChanged">
                    <TextBlock x:Name="DimensionLayerLabel"
                               Grid.Row="1"
                               Grid.Column="1"
                               Padding="0,0,0,5"
                               Text="Dimension Layer visibility" />
                </CheckBox>
                <CheckBox x:Name="DefinitionExpressionCheckBox"
                          Grid.Row="2"
                          Grid.Column="0"
                          VerticalAlignment="Center"
                          VerticalContentAlignment="Center"
                          Checked="DefinitionExpressionCheckBoxChanged"
                          IsChecked="False"
                          IsEnabled="False"
                          Unchecked="DefinitionExpressionCheckBoxChanged">
                    <TextBlock x:Name="DefinitionExpressionLabel"
                               Grid.Row="2"
                               Grid.Column="1"
                               VerticalAlignment="Center"
                               Text="Definition Expression: &#x0a;Dimensions &gt;= 450m" />
                </CheckBox>
            </Grid>
        </Border>
    </Grid>
</UserControl>

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