Click or drag to resize

MapInitialViewpoint Property

Gets or sets the viewpoint where the map should start up at.

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public Viewpoint InitialViewpoint { get; set; }

Property Value

Type: Viewpoint
Remarks

Set this viewpoint prior to loading the map in a MapView. Otherwise, setting initial viewpoint after the map is already loaded will have no effect on the map.

Examples

WPF

Example Name: SetMinMaxScale

Restrict zooming between specific scale ranges.

Code example screen shot.

C#
// 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.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;

namespace ArcGISRuntime.WPF.Samples.SetMinMaxScale
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Set min & max scale",
        category: "Map",
        description: "Restrict zooming between specific scale ranges.",
        instructions: "Zoom in and out of the map. The zoom extents of the map are limited between the given minimum and maximum scales.",
        tags: new[] { "area of interest", "level of detail", "maximum", "minimum", "scale", "viewpoint" })]
    public partial class SetMinMaxScale
    {
        public SetMinMaxScale()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Create new Map with Streets basemap 
            Map myMap = new Map(BasemapStyle.ArcGISStreets)
            {

                // Set the scale at which this layer can be viewed
                // MinScale defines how far 'out' you can zoom where
                // MaxScale defines how far 'in' you can zoom.
                MinScale = 8000,
                MaxScale = 2000
            };

            // Create central point where map is centered
            MapPoint centralPoint = new MapPoint(-355453, 7548720, SpatialReferences.WebMercator);

            // Create starting viewpoint
            Viewpoint startingViewpoint = new Viewpoint(
                centralPoint,
                3000);
            // Set starting viewpoint
            myMap.InitialViewpoint = startingViewpoint;

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.SetMinMaxScale.SetMinMaxScale"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <esri:MapView x:Name="MyMapView"/>
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
AuthorMapCreate and save a map as an ArcGIS `PortalItem` (i.e. web map).
BufferListGenerate multiple individual buffers or a single unioned buffer around multiple points.
ChangeBlendRendererBlend a hillshade with a raster by specifying the elevation data. The resulting raster looks similar to the original raster, but with some terrain shading, giving it a textured look.
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeSublayerRendererApply a renderer to a sublayer.
ClipGeometryClip a geometry with another geometry.
CustomDictionaryStyleUse a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
DisplayLayerViewStateDetermine if a layer is currently being viewed.
DisplaySubtypeFeatureLayerDisplays a composite layer of all the subtype values in a feature class.
FeatureLayerDefinitionExpressionLimit the features displayed on a map with a definition expression.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerRenderingModeMapRender features statically or dynamically by setting the feature layer rendering mode.
FeatureLayerSelectionSelect features in a feature layer.
FeatureLayerUrlShow features from an online feature service.
FindServiceAreaFind the service area within a network from a given point.
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.
ListTransformationsGet a list of suitable transformations for projecting a geometry between two spatial references with different horizontal datums.
ManageBookmarksAccess and create bookmarks on a map.
MapImageLayerTablesFind features in a spatial table related to features in a non-spatial table.
MapImageSublayerQueryFind features in a sublayer based on attributes and location.
OfflineRoutingSolve a route on-the-fly using offline data.
QueryFeatureCountAndExtentZoom to features matching a query and count the features in the current visible extent.
RasterHillshadeUse a hillshade renderer on a raster.
RasterRgbRendererApply an RGB renderer to a raster layer to enhance feature visibility.
RenderPictureMarkersUse pictures for markers.
RenderSimpleMarkersShow a simple marker symbol on a map.
RouteAroundBarriersFind a route that reaches all stops without crossing any barriers.
ServiceFeatureTableCacheDisplay a feature layer from a service using the **on interaction cache** feature request mode.
ServiceFeatureTableManualCacheDisplay a feature layer from a service using the **manual cache** feature request mode.
ServiceFeatureTableNoCacheDisplay a feature layer from a service using the **no cache** feature request mode.
SetInitialMapAreaDisplay the map at an initial viewpoint representing a bounding geometry.
SetMinMaxScaleRestrict zooming between specific scale ranges.
SimpleRenderersDisplay common symbols for all graphics in a graphics overlay with a renderer.
StyleWmsLayerChange the style of a Web Map Service (WMS) layer.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.
WMSLayerUrlDisplay a WMS layer using a WMS service URL.