Click or drag to resize

Renderer Class

Base class for renderers used to display features in a Layer or GraphicsOverlay.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Symbology
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.9.0
Syntax
public abstract class Renderer : INotifyPropertyChanged

The Renderer type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleRotationExpression
Gets/sets the expression describing how a Graphic's attributes are translated into a rotation to be applied to the Graphic.
Public propertyRotationType
Gets/sets whether the rotation calculated from the RotationExpression is screen- or map-relative.
Public propertyCode exampleSceneProperties
Gets or sets the scene properties for the renderer.
Public propertyUnknownJson
Gets unknown data from the source JSON.
Public propertyUnsupportedJson
Gets unsupported data from the source JSON.
Top
Methods
  NameDescription
Public methodCode exampleClone
Returns a clone of the Renderer.
Public methodStatic memberFromJson
Returns the json representation of the renderer
Public methodGetSymbol(GeoElement)
Returns the symbol the renderer uses to represent the supplied GeoElement.
Public methodGetSymbol(GeoElement, Boolean)
Returns the symbol that should be used to visualize the given GeoElement with override attributes from renderer.
Public methodToJson
Returns the json representation of the renderer
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
Top
Examples

WPF

Example Name: Project

Project a point from one spatial reference to another.

Code example screen shot.

C#
// Copyright 2019 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;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using Color = System.Drawing.Color;

namespace ArcGISRuntime.WPF.Samples.Project
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Project",
        category: "Geometry",
        description: "Project a point from one spatial reference to another.",
        instructions: "Click anywhere on the map. A callout will display the clicked location's coordinate in the original (basemap's) spatial reference and in the projected spatial reference.",
        tags: new[] { "WGS 84", "Web Mercator", "coordinate system", "coordinates", "latitude", "longitude", "projected", "projection", "spatial reference" })]
    public partial class Project
    {
        public Project()
        {
            InitializeComponent();
            Initialize();
        }

        private async void Initialize()
        {
            // Show a map in the default WebMercator spatial reference.
            MyMapView.Map = new Map(Basemap.CreateNationalGeographic());

            // Add a graphics overlay for showing the tapped point.
            GraphicsOverlay overlay = new GraphicsOverlay();
            SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 5);
            overlay.Renderer = new SimpleRenderer(markerSymbol);
            MyMapView.GraphicsOverlays.Add(overlay);

            // Respond to user taps.
            MyMapView.GeoViewTapped += MapView_Tapped;

            // Zoom to Minneapolis.
            Envelope startingEnvelope = new Envelope(-10995912.335747, 5267868.874421, -9880363.974046, 5960699.183877,
                SpatialReferences.WebMercator);
            await MyMapView.SetViewpointGeometryAsync(startingEnvelope);
        }

        private void MapView_Tapped(object sender, GeoViewInputEventArgs e)
        {
            // Get the tapped point - this is in the map's spatial reference,
            // which in this case is WebMercator because that is the SR used by the included basemaps.
            MapPoint tappedPoint = e.Location;

            // Update the graphics.
            MyMapView.GraphicsOverlays[0].Graphics.Clear();
            MyMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(tappedPoint));

            // Project the point to WGS84
            MapPoint projectedPoint = (MapPoint) GeometryEngine.Project(tappedPoint, SpatialReferences.Wgs84);

            // Format the results in strings.
            string originalCoords = string.Format("Original: {0:F4}, {1:F4}", tappedPoint.X, tappedPoint.Y);
            string projectedCoords = string.Format("Projected: {0:F4}, {1:F4}", projectedPoint.X, projectedPoint.Y);
            string formattedString = string.Format("{0}\n{1}", originalCoords, projectedCoords);

            // Define a callout and show it in the map view.
            CalloutDefinition calloutDef = new CalloutDefinition("Coordinates:", formattedString);
            MyMapView.ShowCalloutAt(tappedPoint, calloutDef);
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.Project.Project"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddGraphicsRendererA renderer allows you to change the style of all graphics in a graphics overlay by referencing a single symbol style.
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.
BrowseWfsLayersBrowse a WFS service for layers and add them to the map.
BufferCreate a buffer around a map point and display the results as a `Graphic`
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeSublayerRendererApply a renderer to a sublayer.
ClosestFacilityStaticFind routes from several locations to the respective closest facility.
CreateFeatureCollectionLayerCreate a Feature Collection Layer from a Feature Collection Table, and add it to a map.
CustomDictionaryStyleUse a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
DictionaryRendererGraphicsOverlayThis sample demonstrates applying a dictionary renderer to graphics, in order to display military symbology without the need for a feature table.
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.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
ExportTilesDownload tiles to a local tile cache file stored on the device.
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.
FeatureLayerTimeOffsetDisplay a time-enabled feature layer with a time offset.
FindServiceAreasForMultipleFacilitiesFind the service areas of several facilities from a feature service.
GenerateGeodatabaseGenerate a local geodatabase from an online feature service.
GenerateOfflineMapTake a web map offline.
GenerateOfflineMapWithOverridesTake a web map offline with additional options for each layer.
MobileMapSearchAndRouteDisplay maps and use locators to enable search and routing offline using a Mobile Map Package.
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.
RenderUniqueValuesRender features in a layer using a distinct symbol for each unique attribute value.
ScenePropertiesExpressionsUpdate the orientation of a graphic using expressions based on its attributes.
ShowLocationHistoryDisplay your location history on the map.
SimpleRenderersDisplay common symbols for all graphics in a graphics overlay with a renderer.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.
ViewshedGeoElementAnalyze the viewshed for an object (GeoElement) in a scene.