Display dimensions

View inFormsWPFWinUIView 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
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.DisplayDimensions.DisplayDimensions"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:resources="clr-namespace:Forms.Resources">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView" Style="{StaticResource MapWithFormStyle}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label x:Name="PylonLabel"
                       Grid.Row="0"
                       Grid.ColumnSpan="2" />
                <Switch x:Name="DimensionLayerSwitch"
                        Grid.Row="1"
                        Grid.Column="0"
                        IsEnabled="False"
                        IsToggled="True"
                        Toggled="DimensionLayerSwitchChanged" />
                <Label x:Name="DimensionLayerLabel"
                       Grid.Row="1"
                       Grid.Column="1"
                       Text="Dimension Layer visibility"
                       VerticalTextAlignment="Center" />
                <Switch x:Name="DefinitionExpressionSwitch"
                        Grid.Row="2"
                        Grid.Column="0"
                        IsEnabled="False"
                        IsToggled="False"
                        Toggled="DefinitionExpressionSwitchChanged" />
                <Label x:Name="DefinitionExpressionLabel"
                       Grid.Row="2"
                       Grid.Column="1"
                       Text="Definition Expression: Dimensions &gt;= 450m"
                       VerticalTextAlignment="Center" />
            </Grid>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>

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