Click or drag to resize

PictureMarkerSymbol Class

Symbol used to display an image as a marker symbol.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Symbology
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.3.0.0
Syntax
public class PictureMarkerSymbol : MarkerSymbol

The PictureMarkerSymbol type exposes the following members.

Constructors
  NameDescription
Public methodCode examplePictureMarkerSymbol(Uri)
Initializes a new instance of the PictureMarkerSymbol class from an image URI.
Public methodPictureMarkerSymbol(RuntimeImage)
Initializes a new instance of the PictureMarkerSymbol class from runtime image data container.
Top
Properties
  NameDescription
Public propertyAngle
Gets or sets the rotation angle.
(Inherited from MarkerSymbol.)
Public propertyAngleAlignment
Gets or sets the rotation angle alignment. Default value is Screen
(Inherited from MarkerSymbol.)
Public propertyCode exampleHeight
Gets or sets the image height.
Public propertyCode exampleLeaderOffsetX
Gets or sets the leader offset X of the marker symbol.
(Inherited from MarkerSymbol.)
Public propertyLeaderOffsetY
Gets or sets the leader offset Y of the marker symbol.
(Inherited from MarkerSymbol.)
Public propertyCode exampleOffsetX
Gets or sets the X offset.
(Inherited from MarkerSymbol.)
Public propertyCode exampleOffsetY
Gets or sets the Y offset.
(Inherited from MarkerSymbol.)
Public propertyOpacity
Gets or sets the opacity for the symbol.
Public propertyRotationType Obsolete.
Gets or sets the rotation type of the marker symbol.
(Inherited from MarkerSymbol.)
Public propertyUri
Get the URI of the picture marker symbol.
Public propertyCode exampleWidth
Gets or sets the image width.
Top
Methods
  NameDescription
Public methodClone
Clones this instance of Symbol and its members.
(Inherited from Symbol.)
Public methodStatic memberCode exampleCreateAsync
Creates a new instance of a PictureMarkerSymbol from a stream of encoded image bytes
Public methodCreateSwatchAsync(Double)
Creates a swatch image of this symbol using the default size and a transparent background.
(Inherited from Symbol.)
Public methodCreateSwatchAsync(Color, Double)
Creates a swatch image of this symbol, using the default sizing and a transparent background.
(Inherited from Symbol.)
Public methodCreateSwatchAsync(Int32, Int32, Double, Color)
Creates a swatch image of this symbol, scaled to fit the specified dimensions.
(Inherited from Symbol.)
Public methodCreateSwatchAsync(Int32, Int32, Single, Color, Geometry)
Creates a swatch image of this symbol, with the specified image size, dpi, background color, and geometry.
(Inherited from Symbol.)
Public methodToJson
Returns the json representation of the symbol
(Inherited from Symbol.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Symbol.)
Top
Examples

WPF

Example Name: RenderPictureMarkers

This sample demonstrates how to create picture marker symbols from a URL and embedded resources.

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;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using System;
using System.Reflection;
using System.Threading.Tasks;

namespace ArcGISRuntime.WPF.Samples.RenderPictureMarkers
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Render picture markers",
        "Symbology",
        "This sample demonstrates how to create picture marker symbols from a URL and embedded resources.",
        "")]
    [ArcGISRuntime.Samples.Shared.Attributes.EmbeddedResource(@"PictureMarkerSymbols\pin_star_blue.png")]
    public partial class RenderPictureMarkers
    {
        public RenderPictureMarkers()
        {
            InitializeComponent();

            // Create the UI, setup the control references and execute initialization
            Initialize();
        }

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -229835, 6550763, -222560, 6552021,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Assign the map to the MapView
            MyMapView.Map = myMap;

            // Create overlay to where graphics are shown
            GraphicsOverlay overlay = new GraphicsOverlay();

            // Add created overlay to the MapView
            MyMapView.GraphicsOverlays.Add(overlay);

            // Add graphics using different source types
            CreatePictureMarkerSymbolFromUrl(overlay);
            await CreatePictureMarkerSymbolFromResources(overlay);
        }

        private void CreatePictureMarkerSymbolFromUrl(GraphicsOverlay overlay)
        {
            // Create uri to the used image
            var symbolUri = new Uri(
                "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0/images/e82f744ebb069bb35b234b3fea46deae");

            // Create new symbol using asynchronous factory method from uri.
            PictureMarkerSymbol campsiteSymbol = new PictureMarkerSymbol(symbolUri)
            {
                Width = 40,
                Height = 40
            };

            // Create location for the campsite
            MapPoint campsitePoint = new MapPoint(-223560, 6552021, SpatialReferences.WebMercator);

            // Create graphic with the location and symbol
            Graphic campsiteGraphic = new Graphic(campsitePoint, campsiteSymbol);

            // Add graphic to the graphics overlay
            overlay.Graphics.Add(campsiteGraphic);
        }

        private async Task CreatePictureMarkerSymbolFromResources(GraphicsOverlay overlay)
        {
            // Get current assembly that contains the image
            var currentAssembly = Assembly.GetExecutingAssembly();

            // Get image as a stream from the resources
            // Picture is defined as EmbeddedResource and DoNotCopy
            var resourceStream = currentAssembly.GetManifestResourceStream(
                "ArcGISRuntime.Resources.PictureMarkerSymbols.pin_star_blue.png");

            // Create new symbol using asynchronous factory method from stream
            PictureMarkerSymbol pinSymbol = await PictureMarkerSymbol.CreateAsync(resourceStream);
            pinSymbol.Width = 50;
            pinSymbol.Height = 50;

            // Create location for the pint
            MapPoint pinPoint = new MapPoint(-226773, 6550477, SpatialReferences.WebMercator);

            // Create graphic with the location and symbol
            Graphic pinGraphic = new Graphic(pinPoint, pinSymbol);

            // Add graphic to the graphics overlay
            overlay.Graphics.Add(pinGraphic);
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.RenderPictureMarkers.RenderPictureMarkers"
             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
ClosestFacilityDemonstrates how to solve a Closest Facility Task to find the closest route between a facility (hospital) and a incident (black cross).
FindAddressThis sample demonstrates how you can use the LocatorTask API to geocode an address and display it with a pin on the map. Tapping the pin displays the reverse-geocoded address in a callout.
FindPlaceThis sample demonstrates how to use geocode functionality to search for points of interest, around a location or within an extent.
FindRouteThis sample demonstrates how to solve for the best route between two locations on the map and display driving directions between them.
RenderPictureMarkersThis sample demonstrates how to create picture marker symbols from a URL and embedded resources.