Click or drag to resize

SpatialReference Class

Instances of this class represent a spatial reference.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Geometry
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
public class SpatialReference

The SpatialReference type exposes the following members.

Public methodCode exampleSpatialReference(Int32)
Initializes a new instance of the SpatialReference class.
Public methodSpatialReference(String)
Initializes a new instance of the SpatialReference class.
Public methodSpatialReference(Int32, Int32)
Initializes a new instance of the SpatialReference class.
Public propertyBaseGeographic
Gets the base geographic coordinate system if this is a projected coordinate system.
Public propertyExtent Obsolete.
Gets the extent of this spatial reference.
Public propertyHasVertical
Gets a value indicating whether spatial reference has a vertical coordinate system set.
Public propertyIsGeographic
Returns true if this is a geographic coordinate system.
Public propertyIsPannable
Returns true if this coordinate system supports wrap around.
Public propertyIsProjected
Returns true if this is a projected coordinate system.
Public propertyUnit
The units that the spatial reference coordinates are in.
Public propertyVerticalWkid
Gets the vertical coordinate system Well-known ID.
Public propertyCode exampleWkid
Gets the Well-known ID for this instance.
Public propertyWkText
Gets the Well-known Text for this instance.
Public methodStatic memberCode exampleCreate(Int32)
Returns an instance of the SpatialReference class.
Public methodStatic memberCreate(String)
Initializes a new instance of the SpatialReference class.
Public methodStatic memberCreate(Int32, Int32)
Initializes a new instance of the SpatialReference class.
Public methodStatic memberFromJson
Creates an instance of a spatial reference from a JSON string.
Public methodGetConvergenceAngle
Calculates the grid convergence for a spatial reference at a given point.
Public methodIsEqual
Returns true of the Spatial references are the same, this includes where older Wkid refer to the same underlying spatial reference as a newer id.
Public methodStatic memberIsValidVerticalWkid
Returns a value indicating whether the specified well-known ID can be used to create a vertical coordinate system.
Public methodStatic memberIsValidWkid
Returns a value indicating whether the specified well-known ID can be used to create a horizontal coordinate system.
Public methodStatic memberIsValidWkt
Returns a value indicating whether the specified string is a valid well-known text.
Public methodToJson
Creates an ArcGIS JSON representation of the spatial reference/>
Public methodToString
Returns a String that represents the current Object.
(Overrides ObjectToString.)

Each spatial reference can be represented by either a well-known ID (wkid), or a well-known text (wkt). Spatial References define the spatial properties of a geometry, for instance the coordinate system it uses. There are 2 broad classes of coordinate systems - Geographic & Projected. A Geographic Coordinate system uses a 3-dimensional spherical surface to define locations on the earth. A Projected Coordinate system on the other hand uses a flat, 2-dimensional surface. More information about spatial references and coordinate systems is available here.

It is very important to associate spatial data, such as geometry objects, with corresponding spatial references.



Example Name: FeatureLayerRenderingModeScene

Render features in a scene statically or dynamically by setting the feature layer rendering mode.

Code example screen shot.

// Copyright 2018 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;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.FeatureLayerRenderingModeScene
        name: "Feature layer rendering mode (scene)",
        category: "Layers",
        description: "Render features in a scene statically or dynamically by setting the feature layer rendering mode.",
        instructions: "Click the button to trigger the same zoom animation on both static and dynamicly rendered scenes.",
        tags: new[] { "3D", "dynamic", "feature layer", "features", "rendering", "static" })]
    public partial class FeatureLayerRenderingModeScene
        // Points for demonstrating zoom.
        private readonly MapPoint _zoomedOutPoint = new MapPoint(-118.37, 34.46, SpatialReferences.Wgs84);
        private readonly MapPoint _zoomedInPoint = new MapPoint(-118.45, 34.395, SpatialReferences.Wgs84);

        // Viewpoints for each zoom level.
        private Camera _zoomedOutCamera;
        private Camera _zoomedInCamera;

        // URI for the feature service.
        private string _featureService = "";

        // Hold the current zoom state.
        private bool _zoomed;

        public FeatureLayerRenderingModeScene()

            // Initialize the sample.

        private void Initialize()
            // Initialize the cameras (viewpoints) with two points.
            _zoomedOutCamera = new Camera(_zoomedOutPoint, 42000, 0, 0, 0);
            _zoomedInCamera = new Camera(_zoomedInPoint, 2500, 90, 75, 0);

            // Create the scene for displaying the feature layer in static mode.
            Scene staticScene = new Scene
                InitialViewpoint = new Viewpoint(_zoomedOutPoint, _zoomedOutCamera)

            // Create the scene for displaying the feature layer in dynamic mode.
            Scene dynamicScene = new Scene
                InitialViewpoint = new Viewpoint(_zoomedOutPoint, _zoomedOutCamera)

            foreach (string identifier in new[] {"0", "9", "8"})
                // Create the table.
                ServiceFeatureTable serviceTable = new ServiceFeatureTable(new Uri(_featureService + identifier));

                // Create and add the static layer.
                FeatureLayer staticLayer = new FeatureLayer(serviceTable)
                    RenderingMode = FeatureRenderingMode.Static

                // Create and add the dynamic layer.
                FeatureLayer dynamicLayer = (FeatureLayer)staticLayer.Clone();
                dynamicLayer.RenderingMode = FeatureRenderingMode.Dynamic;

            // Add the scenes to the scene views.
            MyStaticSceneView.Scene = staticScene;
            MyDynamicSceneView.Scene = dynamicScene;

        private void Button_Click(object sender, RoutedEventArgs e)
            // Zoom out if zoomed.
            if (_zoomed)
                MyStaticSceneView.SetViewpointCameraAsync(_zoomedOutCamera, new TimeSpan(0, 0, 5));
                MyDynamicSceneView.SetViewpointCameraAsync(_zoomedOutCamera, new TimeSpan(0, 0, 5));
            else // Zoom in otherwise.
                MyStaticSceneView.SetViewpointCameraAsync(_zoomedInCamera, new TimeSpan(0, 0, 5));
                MyDynamicSceneView.SetViewpointCameraAsync(_zoomedInCamera, new TimeSpan(0, 0, 5));

            // Toggle zoom state.
            _zoomed = !_zoomed;
<UserControl x:Class="ArcGISRuntime.WPF.Samples.FeatureLayerRenderingModeScene.FeatureLayerRenderingModeScene"
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        <Label Content="Static mode:"
               Grid.Row="0" Grid.ColumnSpan="2"
               Foreground="Blue" FontWeight="SemiBold" />
        <esri:SceneView x:Name="MyStaticSceneView"
                        Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" />
        <Label Content="Dynamic mode:"
               Grid.Row="2" Grid.Column="0"
               Foreground="Blue" FontWeight="SemiBold" />
        <Button Content="Animated zoom"
                Grid.Row="2" Grid.Column="1"
                Click="Button_Click" />
        <esri:SceneView x:Name="MyDynamicSceneView"
                        Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" />
See Also
Additional Examples
Hyperlink to ExampleDescription
AddFeaturesAdd features to a feature layer.
AddGraphicsRendererA renderer allows you to change the style of all graphics in a graphics overlay by referencing a single symbol style.
AddGraphicsWithSymbolsUse a symbol style to display a graphic on a graphics overlay.
AnalyzeViewshedCalculate a viewshed using a geoprocessing service, in this case showing what parts of a landscape are visible from points on mountainous terrain.
Animate3DGraphicAn `OrbitGeoElementCameraController` follows a graphic while the graphic's position and rotation are animated.
AnimateImageOverlayAnimate a series of images with an image overlay.
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.
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeSublayerRendererApply a renderer to a sublayer.
ChangeViewpointSet the map view to a new viewpoint.
ChooseCameraControllerControl the behavior of the camera in a scene.
ClipGeometryClip a geometry with another geometry.
ClosestFacilityFind a route to the closest facility from a location.
ConvexHullCreate a convex hull for a given set of points. The convex hull is a polygon with shortest perimeter that encloses a set of points. As a visual analogy, consider a set of points as nails in a board. The convex hull of the points would be like a rubber band stretched around the outermost nails.
ConvexHullListGenerate convex hull polygon(s) from multiple input geometries.
CreateAndSaveKmlFileConstruct a KML document and save it as a KMZ file.
CreateFeatureCollectionLayerCreate a Feature Collection Layer from a Feature Collection Table, and add it to a map.
CreateGeometriesCreate simple geometry types.
CutGeometryCut a geometry along a polyline.
DeleteFeaturesDelete features from an online feature service.
DensifyAndGeneralizeA multipart geometry can be densified by adding interpolated points at regular intervals. Generalizing multipart geometry simplifies it while preserving its general shape. Densifying a multipart geometry adds more vertices at regular intervals.
DictionaryRendererGraphicsOverlayThis sample demonstrates applying a dictionary renderer to graphics, in order to display military symbology without the need for a feature table.
DisplayGridDisplay coordinate system grids including Latitude/Longitude, MGRS, UTM and USNG on a map view. Also, toggle label visibility and change the color of grid lines and grid labels.
DisplayKmlDisplay KML from a URL, portal item, or local KML file.
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.
DisplaySubtypeFeatureLayerDisplays a composite layer of all the subtype values in a feature class.
DisplayUtilityAssociationsCreate graphics for utility associations in a utility network.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
DistanceMeasurementMeasure distances between two points in 3D.
EditFeatureAttachmentsAdd, delete, and download attachments for features from a service.
EditFeatureLinkedAnnotationEdit feature attributes which are linked to annotation through an expression.
EditKmlGroundOverlayEdit the values of a KML ground overlay.
FeatureLayerDefinitionExpressionLimit the features displayed on a map with a definition expression.
FeatureLayerDictionaryRendererConvert features into graphics to show them with mil2525d symbols.
FeatureLayerExtrusionExtrude features based on their attributes.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerRenderingModeMapRender features statically or dynamically by setting the feature layer rendering mode.
FeatureLayerRenderingModeSceneRender features in a scene statically or dynamically by setting the feature layer rendering mode.
FeatureLayerSelectionSelect features in a feature layer.
FeatureLayerUrlShow features from an online feature service.
FindRouteDisplay directions for a route between two points.
FormatCoordinatesFormat coordinates in a variety of common notations.
GenerateOfflineMapTake a web map offline.
GenerateOfflineMapWithOverridesTake a web map offline with additional options for each layer.
GeodatabaseTransactionsUse transactions to manage how changes are committed to a geodatabase.
GeodesicOperationsCalculate a geodesic path between two points and measure its distance.
GetElevationAtPointGet the elevation for a given point on a surface in a scene.
IdentifyGraphicsDisplay an alert message when a graphic is clicked.
IdentifyKmlFeaturesShow a callout with formatted content for a KML feature.
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.
LineOfSightLocationPerform a line of sight analysis between two points in real time.
ListKmlContentsList the contents of a KML file.
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.
NavigateRouteUse a routing service to navigate between points.
NavigateRouteReroutingNavigate between two points and dynamically recalculate an alternate route when the original route is unavailable.
NearestVertexFind the closest vertex and coordinate of a geometry to a point.
OfflineBasemapByReferenceUse the `OfflineMapTask` to take a web map offline, but instead of downloading an online basemap, use one which is already on the device.
OfflineRoutingSolve a route on-the-fly using offline data.
ProjectProject a point from one spatial reference to another.
ProjectWithSpecificTransformationProject a point from one coordinate system to another using a specific transformation step.
QueryFeatureCountAndExtentZoom to features matching a query and count the features in the current visible extent.
RasterLayerImageServiceRasterCreate a raster layer from a raster image service.
RenderPictureMarkersUse pictures for markers.
RenderSimpleMarkersShow a simple marker symbol on a map.
SceneLayerSelectionIdentify features in a scene to select.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
ScenePropertiesExpressionsUpdate the orientation of a graphic using expressions based on its attributes.
SceneSymbolsShow various kinds of 3D symbols in a scene.
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.
SetMapSpatialReferenceSpecify a map's spatial reference.
SetMinMaxScaleRestrict zooming between specific scale ranges.
ShowCalloutShow a callout with the latitude and longitude of user-tapped points.
ShowLabelsOnLayerDisplay custom labels on a feature layer.
ShowLocationHistoryDisplay your location history on the map.
SimpleRenderersDisplay common symbols for all graphics in a graphics overlay with a renderer.
SpatialOperationsFind the union, intersection, or difference of two geometries.
SpatialRelationshipsDetermine spatial relationships between two geometries.
StyleWmsLayerChange the style of a Web Map Service (WMS) layer.
SurfacePlacementsPosition graphics relative to a surface using different surface placement modes.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TerrainExaggerationVertically exaggerate terrain in a scene.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.
UpdateAttributesUpdate feature attributes in an online feature service.
UpdateGeometriesUpdate a feature's location in an online feature service.
UseDistanceCompositeSymChange a graphic's symbol based on the camera's proximity to it.
ViewshedCameraAnalyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point.
ViewshedGeoElementAnalyze the viewshed for an object (GeoElement) in a scene.
WMSLayerUrlDisplay a WMS layer using a WMS service URL.