<?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 Re: Line snapping is not working in my code in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1503727#M12872</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/779848"&gt;@NagaMaheshBabupolana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I tested the public code sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/tree/main/src/WPF/WPF.Viewer/Samples/Geometry/SnapGeometryEdits" target="_self"&gt;SnapGeometryEdits&lt;/A&gt;&amp;nbsp;and line snapping is functioning correctly. Can you try modifying your code to follow this workflow? If you are still running into this bug, I would be happy to debug a simple reproducer if you can upload it to GitHub. Reproducer steps as well would be very helpful.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2024 18:12:13 GMT</pubDate>
    <dc:creator>williambohrmann3</dc:creator>
    <dc:date>2024-07-10T18:12:13Z</dc:date>
    <item>
      <title>Line snapping is not working in my code</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1499665#M12845</link>
      <description>&lt;P&gt;Here i have written code for enabling snapping point and line for the existing line.But its not working in my code.Its working for point without any issue. can u help me out in adding new functions or features added to the code.&lt;BR /&gt;webmap--&amp;gt;Group Layer--&amp;gt;Feature Layers&lt;BR /&gt;&lt;BR /&gt;on Initialize i am calling the&amp;nbsp;EnableSnapping();&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;private async void EnableSnapping()&lt;BR /&gt;{&lt;BR /&gt;// Ensure all feature layers within the map are loaded&lt;BR /&gt;foreach (var layer in mapView.Map.OperationalLayers)&lt;BR /&gt;{&lt;BR /&gt;await LoadLayerRecursively(layer);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Synchronize the snap source collection with the map's operational layers.&lt;BR /&gt;_geometryEditor.SnapSettings.SyncSourceSettings();&lt;/P&gt;&lt;P&gt;// Enable snapping on the geometry layer.&lt;BR /&gt;_geometryEditor.SnapSettings.IsEnabled = true;&lt;/P&gt;&lt;P&gt;// Optionally, configure snap tolerance and other settings&lt;BR /&gt;_geometryEditor.SnapSettings.Tolerance = 10.0; // Adjust tolerance as needed&lt;/P&gt;&lt;P&gt;// Create a list of snap source settings with snapping disabled initially&lt;BR /&gt;List&amp;lt;SnapSourceSettingsVM&amp;gt; snapSourceSettingsVMs = new List&amp;lt;SnapSourceSettingsVM&amp;gt;();&lt;/P&gt;&lt;P&gt;// Iterate through the feature layers to set snapping for points and polylines&lt;BR /&gt;foreach (var snapSourceSetting in _geometryEditor.SnapSettings.SourceSettings)&lt;BR /&gt;{&lt;BR /&gt;if (snapSourceSetting.Source is FeatureLayer featureLayer)&lt;BR /&gt;{&lt;BR /&gt;var snapSourceSettingsVM = new SnapSourceSettingsVM(snapSourceSetting) { IsEnabled = false };&lt;BR /&gt;snapSourceSettingsVMs.Add(snapSourceSettingsVM);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Populate lists of snap source settings for point and polyline layers.&lt;BR /&gt;var pointSnapSettings = snapSourceSettingsVMs.Where(snapSourceSettingVM =&amp;gt; snapSourceSettingVM.GeometryType == GeometryType.Point).ToList();&lt;BR /&gt;var polylineSnapSettings = snapSourceSettingsVMs.Where(snapSourceSettingVM =&amp;gt; snapSourceSettingVM.GeometryType == GeometryType.Polyline).ToList();&lt;/P&gt;&lt;P&gt;PointSnapSettingsList.ItemsSource = pointSnapSettings;&lt;BR /&gt;PolylineSnapSettingsList.ItemsSource = polylineSnapSettings;&lt;/P&gt;&lt;P&gt;// Debug: Print counts of point and polyline snap settings&lt;BR /&gt;Debug.WriteLine($"Point Snap Settings Count: {pointSnapSettings.Count}");&lt;BR /&gt;Debug.WriteLine($"Polyline Snap Settings Count: {polylineSnapSettings.Count}");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private async Task LoadLayerRecursively(Layer layer)&lt;BR /&gt;{&lt;BR /&gt;if (layer is GroupLayer groupLayer)&lt;BR /&gt;{&lt;BR /&gt;foreach (var subLayer in groupLayer.Layers)&lt;BR /&gt;{&lt;BR /&gt;await LoadLayerRecursively(subLayer);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else if (layer is FeatureLayer featureLayer)&lt;BR /&gt;{&lt;BR /&gt;if (featureLayer.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded)&lt;BR /&gt;{&lt;BR /&gt;await featureLayer.LoadAsync();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;private void EnableAllPolylineSnapSourceButton_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;foreach (var item in PolylineSnapSettingsList.ItemsSource)&lt;BR /&gt;{&lt;BR /&gt;if (item is SnapSourceSettingsVM snapSourceSettingsVM)&lt;BR /&gt;{&lt;BR /&gt;snapSourceSettingsVM.IsEnabled = true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void EnableAllPointSnapSourceButton_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;foreach (var item in PointSnapSettingsList.ItemsSource)&lt;BR /&gt;{&lt;BR /&gt;if (item is SnapSourceSettingsVM snapSourceSettingsVM)&lt;BR /&gt;{&lt;BR /&gt;snapSourceSettingsVM.IsEnabled = true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;public class SnapSourceSettingsVM : INotifyPropertyChanged&lt;BR /&gt;{&lt;BR /&gt;public SnapSourceSettings SnapSourceSettings { get; set; }&lt;/P&gt;&lt;P&gt;public SnapSourceSettingsVM(SnapSourceSettings snapSourceSettings)&lt;BR /&gt;{&lt;BR /&gt;SnapSourceSettings = snapSourceSettings;&lt;/P&gt;&lt;P&gt;if (snapSourceSettings.Source is FeatureLayer featureLayer &amp;amp;&amp;amp; featureLayer.FeatureTable != null)&lt;BR /&gt;{&lt;BR /&gt;Name = featureLayer.Name;&lt;BR /&gt;GeometryType = featureLayer.FeatureTable.GeometryType;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;IsEnabled = snapSourceSettings.IsEnabled;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private string _name;&lt;BR /&gt;public string Name&lt;BR /&gt;{&lt;BR /&gt;get =&amp;gt; _name;&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;_name = value;&lt;BR /&gt;OnPropertyChanged();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private bool _isEnabled;&lt;BR /&gt;public bool IsEnabled&lt;BR /&gt;{&lt;BR /&gt;get =&amp;gt; _isEnabled;&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;_isEnabled = value;&lt;BR /&gt;SnapSourceSettings.IsEnabled = value;&lt;BR /&gt;OnPropertyChanged();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public GeometryType GeometryType { get; set; }&lt;/P&gt;&lt;P&gt;public event PropertyChangedEventHandler PropertyChanged;&lt;/P&gt;&lt;P&gt;protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)&lt;BR /&gt;{&lt;BR /&gt;PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 06:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1499665#M12845</guid>
      <dc:creator>NagaMaheshBabupolana</dc:creator>
      <dc:date>2024-07-01T06:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Line snapping is not working in my code</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1503727#M12872</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/779848"&gt;@NagaMaheshBabupolana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I tested the public code sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/tree/main/src/WPF/WPF.Viewer/Samples/Geometry/SnapGeometryEdits" target="_self"&gt;SnapGeometryEdits&lt;/A&gt;&amp;nbsp;and line snapping is functioning correctly. Can you try modifying your code to follow this workflow? If you are still running into this bug, I would be happy to debug a simple reproducer if you can upload it to GitHub. Reproducer steps as well would be very helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 18:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1503727#M12872</guid>
      <dc:creator>williambohrmann3</dc:creator>
      <dc:date>2024-07-10T18:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Line snapping is not working in my code</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1504287#M12875</link>
      <description>&lt;P&gt;I noticed that&amp;nbsp;in the provided code snippet the feature tiling mode is not enabled with full resolution when supported. There is great &lt;A href="https://www.esri.com/arcgis-blog/products/sdk-kotlin/developers/feature-snapping-with-the-native-maps-sdks/" target="_blank" rel="noopener"&gt;blog on snapping&lt;/A&gt;, see the section on data requirements. Points aren't quantized the same way as polylines, making them safer to snap too. This is why you're seeing the snap source failing to be set for polylines.&lt;/P&gt;&lt;PRE&gt;myMap.LoadSettings.FeatureTilingMode = FeatureTilingMode.EnabledWithFullResolutionWhenSupported&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 16:27:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/line-snapping-is-not-working-in-my-code/m-p/1504287#M12875</guid>
      <dc:creator>williambohrmann3</dc:creator>
      <dc:date>2024-07-11T16:27:37Z</dc:date>
    </item>
  </channel>
</rss>

