<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Clustering on non geo map view in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500265#M12856</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I created non-geo map view and placed 1000 of points.&amp;nbsp;&lt;BR /&gt;I want to cluster them using&amp;nbsp;FeatureReduction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i start application i can see:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_0-1719924279883.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108535iCD766A8ED67EF182/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_0-1719924279883.png" alt="nsamar1_0-1719924279883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But when I click "draw cluster" i got an error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_1-1719924303545.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108536iC13C1806631FC664/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_1-1719924303545.png" alt="nsamar1_1-1719924303545.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Pulse Failed: Invalid argument: Not a GCS or PCS&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is my MainWindow.xaml.cs:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Esri.ArcGISRuntime.ArcGISServices;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Mapping.Labeling;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.Portal;
using Esri.ArcGISRuntime.Reduction;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Clusters
{
    /// &amp;lt;summary&amp;gt;
    /// Interaction logic for MainWindow.xaml
    /// &amp;lt;/summary&amp;gt;
    public partial class MainWindow : Window
    {
        private FeatureLayer _layer;
        GraphicsOverlay _theGraphicsOverlays;
        GraphicsOverlay _theGraphicsOverlaysNon;
        private ClusteringFeatureReduction _clusteringFeatureReduction;
        public MainWindow()
        {
            InitializeComponent();
            _ = Initialize();
        }
        

        bool generatePoints = true;
        int countPoints = 200;
        void addIncidents()
        {
            _theGraphicsOverlays = new GraphicsOverlay();

            // Get the graphic collection from the graphics overlay.
            GraphicCollection theGraphicCollection = _theGraphicsOverlays.Graphics;
            SimpleMarkerSymbol theSimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, System.Drawing.Color.Red, 28);
            theSimpleMarkerSymbol.Outline = new SimpleLineSymbol();
            theSimpleMarkerSymbol.Outline.Color = System.Drawing.Color.Black;

            List&amp;lt;Graphic&amp;gt; mapPoints = new List&amp;lt;Graphic&amp;gt;();
            List&amp;lt;Graphic&amp;gt; mapPoints1 = new List&amp;lt;Graphic&amp;gt;();

            if (generatePoints)
            {
                Random random = new Random();
                for (int i = 0; i &amp;lt; countPoints; i++)
                {
                    double x = random.Next(0, 2000); // Replace 10000 with your desired range for X coordinates
                    double y = random.Next(-1000, 0); // Replace 10000 with your desired range for Y coordinates
                    double z = 0; // If you need random Z values, generate them here

                    MapPoint point = new MapPoint(x, y, z);

                    var textSymbol = new TextSymbol
                    {
                        Text = $"{x},{y}",
                        Color = System.Drawing.Color.Black,
                        HaloColor = System.Drawing.Color.White,
                        HaloWidth = 2,
                        Size = 4,
                        VerticalAlignment = Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle,
                        HorizontalAlignment = Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center
                    };
                    var compositeSymbol = new CompositeSymbol
                    {
                        Symbols = { theSimpleMarkerSymbol, textSymbol }
                    };

                    mapPoints.Add(new Graphic(point, compositeSymbol));
                    mapPoints1.Add(new Graphic(point, compositeSymbol));
                }
            }
            
            theGraphicCollection.AddRange(mapPoints);

            MyMapViewNonGeo.GraphicsOverlays.Add(_theGraphicsOverlays);
        }
       
      
        
        private async void LoadRaster(RasterLayer myRasterLayer)
        {
            await myRasterLayer.LoadAsync();

            await MyMapViewNonGeo.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
        }
        private async Task Initialize()
        {
            //MyMapView.Map = new Map(SpatialReferences.WebMercator);

            MyMapViewNonGeo.Map = new Map();

            string filename = System.IO.Path.GetFullPath(@"C:\Files\QuartzTest\QuartzTest\NonGeo\worldmap-countries-hd.jpg");

            // Create the layer                       
            RasterLayer imageLayer = new RasterLayer(filename);

            LoadRaster(imageLayer);

            MyMapViewNonGeo.Map.Basemap.BaseLayers.Add(imageLayer);


            DrawClustersButton.IsEnabled = true;
            addIncidents();

        }
        private void CreateCustomFeatureReduction()
        {
            try
            {
                // Create a class breaks renderer to apply to the custom feature reduction.
                ClassBreaksRenderer classBreaksRenderer = new ClassBreaksRenderer();
                classBreaksRenderer.DefaultSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Diamond, System.Drawing.Color.White, 24)
                {
                    Outline = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.FromArgb(0, 122, 204), 2)
                };
                _clusteringFeatureReduction = new ClusteringFeatureReduction(classBreaksRenderer);

                // Set the feature reduction for the layer.
                //_layer.FeatureReduction = _clusteringFeatureReduction;
                var incidents = MyMapViewNonGeo.GraphicsOverlays.First();
                incidents.FeatureReduction = _clusteringFeatureReduction;

                var simpleLabelExpression = new SimpleLabelExpression("[cluster_count]");
                var textSymbol = new TextSymbol()
                {
                    Color = System.Drawing.Color.Black,
                    Size = 15,
                    HaloColor = System.Drawing.Color.White,
                    HaloWidth = 2
                };
                var labelDefinition = new LabelDefinition(simpleLabelExpression, textSymbol) { Placement = LabelingPlacement.PointCenterCenter };

                // Add the label definition to the feature reduction.
                 //_clusteringFeatureReduction.LabelDefinitions.Add(labelDefinition);
                // Populate the cluster radius and max scale pickers with default values.
                 List&amp;lt;double&amp;gt; items = new List&amp;lt;double&amp;gt; { 0, 1, 2, 3, 4, 5, 6, 10, 15, 30, 45, 60, 75, 90, 100,200,300, 1000 };


                ClusterRadiusPicker.ItemsSource = items;
                // Set initial picker values.
                // Note that the default value for cluster radius is 60.
                // Increasing the cluster radius increases the number of features that are grouped together into a cluster.            
                ClusterRadiusPicker.SelectedValue = _clusteringFeatureReduction.Radius;
            }
            catch (Exception ex)
            {

            }
            

            
        }

       
        #region EventHandlers

        private void DisplayLabelsCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if ((bool)(sender as CheckBox).IsChecked)
            {
                // Create a label definition with a simple label expression.
                var simpleLabelExpression = new SimpleLabelExpression("[cluster_count]");
                var textSymbol = new TextSymbol() { Color = System.Drawing.Color.Black,
                    Size = 15,
                    HaloColor = System.Drawing.Color.White,
                    HaloWidth = 2
                };
                var labelDefinition = new LabelDefinition(simpleLabelExpression, textSymbol) { Placement = LabelingPlacement.PointCenterCenter };

                // Add the label definition to the feature reduction.
                _clusteringFeatureReduction?.LabelDefinitions.Add(labelDefinition);
            }
            else
            {
                _clusteringFeatureReduction.LabelDefinitions.Clear();
            }
        }

        // When a new picker item is selected, update the feature reduction cluster radius.
        private void ClusterRadiusPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_layer != null)
            {
                ((ClusteringFeatureReduction)_layer.FeatureReduction).Radius = (double)ClusterRadiusPicker.SelectedItem;
            }
            if (_theGraphicsOverlaysNon != null)
            {
                ((ClusteringFeatureReduction)_theGraphicsOverlaysNon.FeatureReduction).Radius = (double)ClusterRadiusPicker.SelectedItem;               
            }
        }


        private void DrawClustersButton_Clicked(object sender, RoutedEventArgs e)
        {
            try
            {
                // Create a new clustering feature reduction.
                CreateCustomFeatureReduction();

                // Show the feature reduction's clustering options.
                ClusteringOptions.Visibility = Visibility.Visible;

                // Hide the draw clusters button.
                DrawClustersButton.Visibility = Visibility.Collapsed;
            }
            catch(Exception ex)
            {

            }
        }

        // Hide and nullify the opened popup when user left clicks.
        private void PopupBackground_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            PopupBackground.Visibility = Visibility.Collapsed;
            //PopupViewer.Popup = null;
        }

        #endregion EventHandlers
    }
}&lt;/LI-CODE&gt;&lt;P&gt;Here is MainWindow.xaml&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;Window x:Class="Clusters.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Clusters"
        xmlns:quartz="http://schemas.esri.com/arcgis/runtime/2013"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800"&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;quartz:MapView x:Name="MyMapViewNonGeo" /&amp;gt;
        &amp;lt;Border Width="auto"
                Height="auto"&amp;gt;
            &amp;lt;StackPanel Orientation="Vertical"&amp;gt;
                &amp;lt;Button x:Name="DrawClustersButton"
                        Padding="5"
                        HorizontalAlignment="Center"
                        Click="DrawClustersButton_Clicked"
                        Content="Draw clusters"
                        IsEnabled="False" /&amp;gt;
                &amp;lt;Grid x:Name="ClusteringOptions" Visibility="Collapsed"&amp;gt;
                    &amp;lt;Grid.RowDefinitions&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                    &amp;lt;/Grid.RowDefinitions&amp;gt;
                    &amp;lt;Grid.ColumnDefinitions&amp;gt;
                        &amp;lt;ColumnDefinition Width="2*" /&amp;gt;
                        &amp;lt;ColumnDefinition Width="*" /&amp;gt;
                    &amp;lt;/Grid.ColumnDefinitions&amp;gt;
                    &amp;lt;TextBlock Grid.ColumnSpan="2"
                               Padding="5"
                               HorizontalAlignment="Center"
                               FontSize="16"
                               FontWeight="Bold"
                               Text="Clustering Properties" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="1"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"
                               FontWeight="Bold"
                               Text="Display labels:" /&amp;gt;
                    &amp;lt;CheckBox x:Name="DisplayLabelsCheckBox"
                              Grid.Row="1"
                              Grid.Column="1"
                              VerticalAlignment="Center"
                              Checked="DisplayLabelsCheckBox_Checked"
                              IsChecked="true"
                              Unchecked="DisplayLabelsCheckBox_Checked" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="2"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Cluster radius:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=ClusterRadiusSlider, Path=Value, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                    &amp;lt;ComboBox x:Name="ClusterRadiusPicker"
                              Grid.Row="2"
                              Grid.Column="1"
                              Width="75"
                              HorizontalAlignment="Left"
                              VerticalAlignment="Center"
                              SelectionChanged="ClusterRadiusPicker_SelectionChanged" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="3"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Maximum map scale:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=MaxScaleSlider, Path=Value, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                    &amp;lt;TextBlock Grid.Row="4"
                               Grid.Column="0"
                               Grid.ColumnSpan="2"
                               Padding="5"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Current map scale: " /&amp;gt;
                        &amp;lt;Run Text="1:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=MyMapView, Path=MapScale, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                &amp;lt;/Grid&amp;gt;
                
            &amp;lt;/StackPanel&amp;gt;
        &amp;lt;/Border&amp;gt;
        &amp;lt;TextBlock x:Name="DistanceTextBlock" Foreground="Black"
                    HorizontalAlignment="Left" VerticalAlignment="Center" 
					Text="Distance between points: " TextWrapping="Wrap" FontWeight="Bold" Margin="28,10,0,395" Height="auto" Width="266"/&amp;gt;
        &amp;lt;Grid x:Name="PopupBackground"
              Background="#AA333333"
              MouseLeftButtonDown="PopupBackground_MouseLeftButtonDown"
              Visibility="Collapsed"&amp;gt;
            &amp;lt;Border HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Background="White"&amp;gt;
            &amp;lt;!--&amp;lt;quartz:PopupViewer x:Name="PopupViewer"
                                MaxWidth="400"
                                MaxHeight="400"
                                Margin="5"
                                Padding="5" /&amp;gt;--&amp;gt;
            &amp;lt;/Border&amp;gt;
        &amp;lt;/Grid&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;My question is do you support clustering at all for Non geo maps, if yes, what should i change to have it working?&amp;nbsp;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2024 12:46:06 GMT</pubDate>
    <dc:creator>nsamar1</dc:creator>
    <dc:date>2024-07-02T12:46:06Z</dc:date>
    <item>
      <title>Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500265#M12856</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I created non-geo map view and placed 1000 of points.&amp;nbsp;&lt;BR /&gt;I want to cluster them using&amp;nbsp;FeatureReduction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i start application i can see:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_0-1719924279883.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108535iCD766A8ED67EF182/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_0-1719924279883.png" alt="nsamar1_0-1719924279883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But when I click "draw cluster" i got an error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_1-1719924303545.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108536iC13C1806631FC664/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_1-1719924303545.png" alt="nsamar1_1-1719924303545.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Pulse Failed: Invalid argument: Not a GCS or PCS&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is my MainWindow.xaml.cs:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Esri.ArcGISRuntime.ArcGISServices;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Mapping.Labeling;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.Portal;
using Esri.ArcGISRuntime.Reduction;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Clusters
{
    /// &amp;lt;summary&amp;gt;
    /// Interaction logic for MainWindow.xaml
    /// &amp;lt;/summary&amp;gt;
    public partial class MainWindow : Window
    {
        private FeatureLayer _layer;
        GraphicsOverlay _theGraphicsOverlays;
        GraphicsOverlay _theGraphicsOverlaysNon;
        private ClusteringFeatureReduction _clusteringFeatureReduction;
        public MainWindow()
        {
            InitializeComponent();
            _ = Initialize();
        }
        

        bool generatePoints = true;
        int countPoints = 200;
        void addIncidents()
        {
            _theGraphicsOverlays = new GraphicsOverlay();

            // Get the graphic collection from the graphics overlay.
            GraphicCollection theGraphicCollection = _theGraphicsOverlays.Graphics;
            SimpleMarkerSymbol theSimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, System.Drawing.Color.Red, 28);
            theSimpleMarkerSymbol.Outline = new SimpleLineSymbol();
            theSimpleMarkerSymbol.Outline.Color = System.Drawing.Color.Black;

            List&amp;lt;Graphic&amp;gt; mapPoints = new List&amp;lt;Graphic&amp;gt;();
            List&amp;lt;Graphic&amp;gt; mapPoints1 = new List&amp;lt;Graphic&amp;gt;();

            if (generatePoints)
            {
                Random random = new Random();
                for (int i = 0; i &amp;lt; countPoints; i++)
                {
                    double x = random.Next(0, 2000); // Replace 10000 with your desired range for X coordinates
                    double y = random.Next(-1000, 0); // Replace 10000 with your desired range for Y coordinates
                    double z = 0; // If you need random Z values, generate them here

                    MapPoint point = new MapPoint(x, y, z);

                    var textSymbol = new TextSymbol
                    {
                        Text = $"{x},{y}",
                        Color = System.Drawing.Color.Black,
                        HaloColor = System.Drawing.Color.White,
                        HaloWidth = 2,
                        Size = 4,
                        VerticalAlignment = Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle,
                        HorizontalAlignment = Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center
                    };
                    var compositeSymbol = new CompositeSymbol
                    {
                        Symbols = { theSimpleMarkerSymbol, textSymbol }
                    };

                    mapPoints.Add(new Graphic(point, compositeSymbol));
                    mapPoints1.Add(new Graphic(point, compositeSymbol));
                }
            }
            
            theGraphicCollection.AddRange(mapPoints);

            MyMapViewNonGeo.GraphicsOverlays.Add(_theGraphicsOverlays);
        }
       
      
        
        private async void LoadRaster(RasterLayer myRasterLayer)
        {
            await myRasterLayer.LoadAsync();

            await MyMapViewNonGeo.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
        }
        private async Task Initialize()
        {
            //MyMapView.Map = new Map(SpatialReferences.WebMercator);

            MyMapViewNonGeo.Map = new Map();

            string filename = System.IO.Path.GetFullPath(@"C:\Files\QuartzTest\QuartzTest\NonGeo\worldmap-countries-hd.jpg");

            // Create the layer                       
            RasterLayer imageLayer = new RasterLayer(filename);

            LoadRaster(imageLayer);

            MyMapViewNonGeo.Map.Basemap.BaseLayers.Add(imageLayer);


            DrawClustersButton.IsEnabled = true;
            addIncidents();

        }
        private void CreateCustomFeatureReduction()
        {
            try
            {
                // Create a class breaks renderer to apply to the custom feature reduction.
                ClassBreaksRenderer classBreaksRenderer = new ClassBreaksRenderer();
                classBreaksRenderer.DefaultSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Diamond, System.Drawing.Color.White, 24)
                {
                    Outline = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.FromArgb(0, 122, 204), 2)
                };
                _clusteringFeatureReduction = new ClusteringFeatureReduction(classBreaksRenderer);

                // Set the feature reduction for the layer.
                //_layer.FeatureReduction = _clusteringFeatureReduction;
                var incidents = MyMapViewNonGeo.GraphicsOverlays.First();
                incidents.FeatureReduction = _clusteringFeatureReduction;

                var simpleLabelExpression = new SimpleLabelExpression("[cluster_count]");
                var textSymbol = new TextSymbol()
                {
                    Color = System.Drawing.Color.Black,
                    Size = 15,
                    HaloColor = System.Drawing.Color.White,
                    HaloWidth = 2
                };
                var labelDefinition = new LabelDefinition(simpleLabelExpression, textSymbol) { Placement = LabelingPlacement.PointCenterCenter };

                // Add the label definition to the feature reduction.
                 //_clusteringFeatureReduction.LabelDefinitions.Add(labelDefinition);
                // Populate the cluster radius and max scale pickers with default values.
                 List&amp;lt;double&amp;gt; items = new List&amp;lt;double&amp;gt; { 0, 1, 2, 3, 4, 5, 6, 10, 15, 30, 45, 60, 75, 90, 100,200,300, 1000 };


                ClusterRadiusPicker.ItemsSource = items;
                // Set initial picker values.
                // Note that the default value for cluster radius is 60.
                // Increasing the cluster radius increases the number of features that are grouped together into a cluster.            
                ClusterRadiusPicker.SelectedValue = _clusteringFeatureReduction.Radius;
            }
            catch (Exception ex)
            {

            }
            

            
        }

       
        #region EventHandlers

        private void DisplayLabelsCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if ((bool)(sender as CheckBox).IsChecked)
            {
                // Create a label definition with a simple label expression.
                var simpleLabelExpression = new SimpleLabelExpression("[cluster_count]");
                var textSymbol = new TextSymbol() { Color = System.Drawing.Color.Black,
                    Size = 15,
                    HaloColor = System.Drawing.Color.White,
                    HaloWidth = 2
                };
                var labelDefinition = new LabelDefinition(simpleLabelExpression, textSymbol) { Placement = LabelingPlacement.PointCenterCenter };

                // Add the label definition to the feature reduction.
                _clusteringFeatureReduction?.LabelDefinitions.Add(labelDefinition);
            }
            else
            {
                _clusteringFeatureReduction.LabelDefinitions.Clear();
            }
        }

        // When a new picker item is selected, update the feature reduction cluster radius.
        private void ClusterRadiusPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_layer != null)
            {
                ((ClusteringFeatureReduction)_layer.FeatureReduction).Radius = (double)ClusterRadiusPicker.SelectedItem;
            }
            if (_theGraphicsOverlaysNon != null)
            {
                ((ClusteringFeatureReduction)_theGraphicsOverlaysNon.FeatureReduction).Radius = (double)ClusterRadiusPicker.SelectedItem;               
            }
        }


        private void DrawClustersButton_Clicked(object sender, RoutedEventArgs e)
        {
            try
            {
                // Create a new clustering feature reduction.
                CreateCustomFeatureReduction();

                // Show the feature reduction's clustering options.
                ClusteringOptions.Visibility = Visibility.Visible;

                // Hide the draw clusters button.
                DrawClustersButton.Visibility = Visibility.Collapsed;
            }
            catch(Exception ex)
            {

            }
        }

        // Hide and nullify the opened popup when user left clicks.
        private void PopupBackground_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            PopupBackground.Visibility = Visibility.Collapsed;
            //PopupViewer.Popup = null;
        }

        #endregion EventHandlers
    }
}&lt;/LI-CODE&gt;&lt;P&gt;Here is MainWindow.xaml&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;Window x:Class="Clusters.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Clusters"
        xmlns:quartz="http://schemas.esri.com/arcgis/runtime/2013"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800"&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;quartz:MapView x:Name="MyMapViewNonGeo" /&amp;gt;
        &amp;lt;Border Width="auto"
                Height="auto"&amp;gt;
            &amp;lt;StackPanel Orientation="Vertical"&amp;gt;
                &amp;lt;Button x:Name="DrawClustersButton"
                        Padding="5"
                        HorizontalAlignment="Center"
                        Click="DrawClustersButton_Clicked"
                        Content="Draw clusters"
                        IsEnabled="False" /&amp;gt;
                &amp;lt;Grid x:Name="ClusteringOptions" Visibility="Collapsed"&amp;gt;
                    &amp;lt;Grid.RowDefinitions&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                        &amp;lt;RowDefinition Height="auto" /&amp;gt;
                    &amp;lt;/Grid.RowDefinitions&amp;gt;
                    &amp;lt;Grid.ColumnDefinitions&amp;gt;
                        &amp;lt;ColumnDefinition Width="2*" /&amp;gt;
                        &amp;lt;ColumnDefinition Width="*" /&amp;gt;
                    &amp;lt;/Grid.ColumnDefinitions&amp;gt;
                    &amp;lt;TextBlock Grid.ColumnSpan="2"
                               Padding="5"
                               HorizontalAlignment="Center"
                               FontSize="16"
                               FontWeight="Bold"
                               Text="Clustering Properties" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="1"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"
                               FontWeight="Bold"
                               Text="Display labels:" /&amp;gt;
                    &amp;lt;CheckBox x:Name="DisplayLabelsCheckBox"
                              Grid.Row="1"
                              Grid.Column="1"
                              VerticalAlignment="Center"
                              Checked="DisplayLabelsCheckBox_Checked"
                              IsChecked="true"
                              Unchecked="DisplayLabelsCheckBox_Checked" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="2"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Cluster radius:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=ClusterRadiusSlider, Path=Value, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                    &amp;lt;ComboBox x:Name="ClusterRadiusPicker"
                              Grid.Row="2"
                              Grid.Column="1"
                              Width="75"
                              HorizontalAlignment="Left"
                              VerticalAlignment="Center"
                              SelectionChanged="ClusterRadiusPicker_SelectionChanged" /&amp;gt;
                    &amp;lt;TextBlock Grid.Row="3"
                               Grid.Column="0"
                               Padding="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Maximum map scale:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=MaxScaleSlider, Path=Value, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                    &amp;lt;TextBlock Grid.Row="4"
                               Grid.Column="0"
                               Grid.ColumnSpan="2"
                               Padding="5"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"&amp;gt;
                        &amp;lt;Run FontWeight="Bold" Text="Current map scale: " /&amp;gt;
                        &amp;lt;Run Text="1:" /&amp;gt;
                        &amp;lt;Run Text="{Binding ElementName=MyMapView, Path=MapScale, Mode=OneWay, StringFormat=n0}" /&amp;gt;
                    &amp;lt;/TextBlock&amp;gt;
                &amp;lt;/Grid&amp;gt;
                
            &amp;lt;/StackPanel&amp;gt;
        &amp;lt;/Border&amp;gt;
        &amp;lt;TextBlock x:Name="DistanceTextBlock" Foreground="Black"
                    HorizontalAlignment="Left" VerticalAlignment="Center" 
					Text="Distance between points: " TextWrapping="Wrap" FontWeight="Bold" Margin="28,10,0,395" Height="auto" Width="266"/&amp;gt;
        &amp;lt;Grid x:Name="PopupBackground"
              Background="#AA333333"
              MouseLeftButtonDown="PopupBackground_MouseLeftButtonDown"
              Visibility="Collapsed"&amp;gt;
            &amp;lt;Border HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Background="White"&amp;gt;
            &amp;lt;!--&amp;lt;quartz:PopupViewer x:Name="PopupViewer"
                                MaxWidth="400"
                                MaxHeight="400"
                                Margin="5"
                                Padding="5" /&amp;gt;--&amp;gt;
            &amp;lt;/Border&amp;gt;
        &amp;lt;/Grid&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;My question is do you support clustering at all for Non geo maps, if yes, what should i change to have it working?&amp;nbsp;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 12:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500265#M12856</guid>
      <dc:creator>nsamar1</dc:creator>
      <dc:date>2024-07-02T12:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500576#M12857</link>
      <description>&lt;P&gt;Could you try and assign a SpatialReference to the MapPoints you're creating and let me know if that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 20:13:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500576#M12857</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-07-02T20:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500795#M12858</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply.&amp;nbsp;&lt;BR /&gt;So, when i added spatial reference WGS84 (on line 10):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;if (generatePoints)
            {
                Random random = new Random();
                for (int i = 0; i &amp;lt; countPoints; i++)
                {
                    double x = random.Next(0, 2000); // Replace 10000 with your desired range for X coordinates
                    double y = random.Next(-1000, 0); // Replace 10000 with your desired range for Y coordinates
                    double z = 0; // If you need random Z values, generate them here

                    MapPoint point = new MapPoint(x, y, z, SpatialReferences.Wgs84);

                    var textSymbol = new TextSymbol
                    {
                        Text = $"{x},{y}",
                        Color = System.Drawing.Color.Black,
                        HaloColor = System.Drawing.Color.White,
                        HaloWidth = 2,
                        Size = 4,
                        VerticalAlignment = Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle,
                        HorizontalAlignment = Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center
                    };
                    var compositeSymbol = new CompositeSymbol
                    {
                        Symbols = { theSimpleMarkerSymbol, textSymbol }
                    };

                    mapPoints.Add(new Graphic(point, compositeSymbol));
                    mapPoints1.Add(new Graphic(point, compositeSymbol));
                }
            }&lt;/LI-CODE&gt;&lt;P&gt;I don't see points add all:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_0-1719990721370.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108647iE6A2D4D4923AF247/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_0-1719990721370.png" alt="nsamar1_0-1719990721370.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I changed to WebMercator:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapPoint point = new MapPoint(x, y, z, SpatialReferences.WebMercator);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I see points:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_1-1719990782948.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108648iF4A152383F271600/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_1-1719990782948.png" alt="nsamar1_1-1719990782948.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But clustering is still not working:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_2-1719990802791.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108649iC463E5F972DA32B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_2-1719990802791.png" alt="nsamar1_2-1719990802791.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 07:14:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1500795#M12858</guid>
      <dc:creator>nsamar1</dc:creator>
      <dc:date>2024-07-03T07:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1503116#M12868</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt; So, when i added spatial reference WGS84 (on line 10)&amp;nbsp;&lt;/SPAN&gt;I don't see points add all:&lt;/P&gt;&lt;P&gt;Yes your spatial reference you use MUST match the spatial reference of your X and Y, whatever that is. Looks like you're just doing random numbers between 0 and 2000, but I wouldn't know what kind of units that is.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 17:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1503116#M12868</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-07-09T17:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1503448#M12870</link>
      <description>&lt;P&gt;Yes, i am doing random points, but as you can on my screenshot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nsamar1_0-1720611401012.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109292iD7959DF32B77619A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nsamar1_0-1720611401012.png" alt="nsamar1_0-1720611401012.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;They are placed.&amp;nbsp;&lt;BR /&gt;I can try to put some specific points, but issue still will be reproducible.&amp;nbsp;&lt;BR /&gt;Clustering will not working.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you provide any information how to make it work with image(raster) layer and clustering of points on it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 11:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1503448#M12870</guid>
      <dc:creator>nsamar1</dc:creator>
      <dc:date>2024-07-10T11:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Clustering on non geo map view</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1516811#M12947</link>
      <description>&lt;P&gt;Could you zip up a running project and attach here, so we can try and reproduce your issue? It's a little hard to gauge from the small screenshot what the expectation and behavior is.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 17:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/clustering-on-non-geo-map-view/m-p/1516811#M12947</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-08-08T17:20:51Z</dc:date>
    </item>
  </channel>
</rss>

