Click or drag to resize

Viewpoint Constructor (MapPoint, Double)

Initializes a new instance of the Viewpoint class with center point and scale.

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
public Viewpoint(
	MapPoint center,
	double scale


Type: Esri.ArcGISRuntime.GeometryMapPoint
The center of the visible area.
Type: SystemDouble
Map Scale, Ratio between the distance on the map and the corresponding distance on the ground.
ArgumentExceptionscale cannot be NaN.
ArgumentOutOfRangeExceptionscale must be greater than 0.
The spatial reference of the center point cannot be null.


Example Name: FeatureLayerDefinitionExpression

Limit the features displayed on a map with a definition expression.

Code example screen shot.

// 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:
// 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.

using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using System;

namespace ArcGISRuntime.WPF.Samples.FeatureLayerDefinitionExpression
        name: "Feature layer definition expression",
        category: "Layers",
        description: "Limit the features displayed on a map with a definition expression.",
        instructions: "Press the 'Apply Expression' button to limit the features requested from the feature layer to those specified by the SQL query definition expression. Click the 'Reset Expression' button to remove the definition expression on the feature layer, which returns all the records.",
        tags: new[] { "SQL", "definition expression", "filter", "limit data", "query", "restrict data", "where clause" })]
    public partial class FeatureLayerDefinitionExpression
        // Create and hold reference to the feature layer
        private FeatureLayer _featureLayer;

        public FeatureLayerDefinitionExpression()

            // Setup the control references and execute initialization 

        private void Initialize()
            // Create new Map with basemap
            Map myMap = new Map(BasemapStyle.ArcGISTopographic);

            // Create a MapPoint the map should zoom to
            MapPoint mapPoint = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri(

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            // Add the feature layer to the map


        private void OnApplyExpressionClicked(object sender, EventArgs e)
            // Adding definition expression to show specific features only
            _featureLayer.DefinitionExpression = "req_Type = 'Tree Maintenance or Damage'";

        private void OnResetButtonClicked(object sender, EventArgs e)
            // Reset the definition expression to see all features again
            _featureLayer.DefinitionExpression = "";
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                <Button Content="Apply expression"
                        Click="OnApplyExpressionClicked" />
                <Button Content="Reset expression"
                        Click="OnResetButtonClicked" />
See Also
Additional Examples
Hyperlink to ExampleDescription
DisplayKmlNetworkLinksDisplay a file with a KML network link, including displaying any network link control messages at launch.
DisplayLayerViewStateDetermine if a layer is currently being viewed.
DisplayUtilityAssociationsCreate graphics for utility associations in a utility network.
FeatureLayerDefinitionExpressionLimit the features displayed on a map with a definition expression.
FeatureLayerDictionaryRendererConvert features into graphics to show them with mil2525d symbols.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerUrlShow features from an online feature service.
FindPlaceFind places of interest near a location or within a specific area.
IdentifyLayersIdentify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.
LineOfSightGeoElementShow a line of sight between two moving objects.
ListTransformationsGet a list of suitable transformations for projecting a geometry between two spatial references with different horizontal datums.
MapImageSublayerQueryFind features in a sublayer based on attributes and location.
PerformValveIsolationTraceRun a filtered trace to locate operable features that will isolate an area from the flow of network resources.
RenderSimpleMarkersShow a simple marker symbol on a map.
ServiceFeatureTableManualCacheDisplay a feature layer from a service using the **manual cache** feature request mode.
SetMinMaxScaleRestrict zooming between specific scale ranges.
ShowLabelsOnLayerDisplay custom labels on a feature layer.
SymbolizeShapefileDisplay a shapefile with custom symbology.