Read shapefile metadata

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Read a shapefile and display its metadata.

Image of read shapefile metadata

Use case

You can display information about the shapefile your user is viewing, like tags, credits, and summary.

How to use the sample

The shapefile's metadata will be displayed when you open the sample.

How it works

  1. Call ShapefileFeatureTable.OpenAsync("path_to_shapefile") to create the ShapefileFeatureTable.
  2. Get the ShapefileInfo from the feature table's Info property.
  3. Get the image from fileInfo.Thumbnail and display it.
  4. Display the Summary, Credits, and Tags properties from the shapefile info.

Relevant API

  • ShapefileFeatureTable
  • ShapefileFeatureTable.Info
  • ShapefileFeatureTable.OpenAsync
  • ShapefileInfo
  • ShapefileInfo.Credits
  • ShapefileInfo.Summary
  • ShapefileInfo.Tags
  • ShapefileInfo.Thumbnail

Offline data

Aurora Colorado Shapefiles is available as an item hosted on ArcGIS Online].

About the data

This sample uses a shapefile showing bike trails in Aurora, CO. The Aurora Colorado Shapefiles are available as an item on ArcGIS Online.

Tags

credits, description, metadata, package, shape file, shapefile, summary, symbology, tags, visualization

Sample Code

ReadShapefileMetadata.xamlReadShapefileMetadata.xamlReadShapefileMetadata.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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntime.Samples.ReadShapefileMetadata.ReadShapefileMetadata"
             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">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <esriUI:MapView x:Name="MyMapView" />
        <Frame x:Name="MetadataFrame"
               Margin="30"
               BackgroundColor="LightGray"
               BorderColor="DarkGray"
               HorizontalOptions="Center"
               IsVisible="False"
               VerticalOptions="Start"
               WidthRequest="300">
            <ScrollView>
                <StackLayout x:Name="InfoPanel"
                             Margin="5"
                             Orientation="Vertical">
                    <Label Margin="5"
                           FontAttributes="Bold"
                           FontSize="Small"
                           Text="{Binding Path=Credits}"
                           TextColor="DarkBlue" />
                    <Label FontSize="Micro"
                           LineBreakMode="WordWrap"
                           Text="{Binding Summary}"
                           TextColor="Black" />
                    <Image x:Name="ShapefileThumbnailImage" Margin="10" />
                    <StackLayout Orientation="Horizontal">
                        <Label Margin="0,3"
                               FontAttributes="Bold"
                               FontSize="Micro"
                               Text="Tags:"
                               TextColor="Black" />
                        <ListView HeightRequest="120"
                                  ItemsSource="{Binding Tags}"
                                  RowHeight="25"
                                  WidthRequest="160" />
                    </StackLayout>
                </StackLayout>
            </ScrollView>
        </Frame>
        <Button Grid.Row="1"
                Clicked="ShowMetadataClicked"
                HorizontalOptions="FillAndExpand"
                Text="Show Metadata"
                VerticalOptions="FillAndExpand" />
    </Grid>
</ContentPage>

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