locked
Clustering MapIcon in W10 Universal Apps (C# VS2015) RRS feed

  • Question

  • How to Clustering MapIcon/Pushpins in W10 Universal Apps (UWP C# VS2015)?

    I tried porting Pushpin Clustering with the Bing Maps WPF control , but found the problem because both use different APIs.

    What is equivalent name for the following functions:
        Layer (WPF) = ... (UWP)? 
        Map.BoundingRectangle (WPF) = .... (UWP)?
        Map (WPF) = MapControl (UWP)?
        Location (WPF) = Geopoint (UWP)? 
        LocationToViewportPoint (WPF)= GetOffsetFromLocation (UWP)?
        Pushpin (WPF) = MapIcon (UWP)?
        ViewportSize.Width (WPF) = ActualWidth (WPF)?
        ViewportSize.Height (WPF) = ActualHeight (WPF)?

    Thank You




    • Edited by mb,, Wednesday, November 11, 2015 5:46 AM
    Tuesday, November 10, 2015 8:09 PM

Answers

  • Here is a the equivalents for you:

        Layer (WPF) = Don't believe there is such a class. You would simply add your shapes directly to the map. You could store a group of them in a list and manage them that way.
         Map.BoundingRectangle (WPF) = GeoBoundingBox
         Map (WPF) = MapControl 
         Location (WPF) = Geopoint or BasicGeoposition
         LocationToViewportPoint (WPF)= GetOffsetFromLocation
         Pushpin (WPF) = MapIcon or you can use any UIElement and pass it into the Children property of the map. This might be a better option as MapIcon's have their own collision detection/clustering like function.
         ViewportSize.Width (WPF) = ActualWidth 
         ViewportSize.Height (WPF) = ActualHeight

    That said, the WPF code likely will only work when you are in 2D mode. If you are in 3D mode in the Windows 10 map control, working with pixel coordinates likely isn't an option. Instead you might want to consider implementing a point/distance based clustering algorithm similar to this: http://bingmapsv7modules.codeplex.com/wikipage?title=Point%20Based%20Clustering You could use the Haversine formula to calculate the true distance between pushpins.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, November 11, 2015 8:39 PM
    • Marked as answer by mb,, Thursday, November 12, 2015 6:05 AM
    Wednesday, November 11, 2015 8:39 PM

All replies

  • Here is a the equivalents for you:

        Layer (WPF) = Don't believe there is such a class. You would simply add your shapes directly to the map. You could store a group of them in a list and manage them that way.
         Map.BoundingRectangle (WPF) = GeoBoundingBox
         Map (WPF) = MapControl 
         Location (WPF) = Geopoint or BasicGeoposition
         LocationToViewportPoint (WPF)= GetOffsetFromLocation
         Pushpin (WPF) = MapIcon or you can use any UIElement and pass it into the Children property of the map. This might be a better option as MapIcon's have their own collision detection/clustering like function.
         ViewportSize.Width (WPF) = ActualWidth 
         ViewportSize.Height (WPF) = ActualHeight

    That said, the WPF code likely will only work when you are in 2D mode. If you are in 3D mode in the Windows 10 map control, working with pixel coordinates likely isn't an option. Instead you might want to consider implementing a point/distance based clustering algorithm similar to this: http://bingmapsv7modules.codeplex.com/wikipage?title=Point%20Based%20Clustering You could use the Haversine formula to calculate the true distance between pushpins.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, November 11, 2015 8:39 PM
    • Marked as answer by mb,, Thursday, November 12, 2015 6:05 AM
    Wednesday, November 11, 2015 8:39 PM
  • Thank You Sir for point out
    Thursday, November 12, 2015 6:06 AM
  • How to Clustering MapIcon/Pushpins in W10 Universal Apps (UWP C# VS2015)?

    I tried porting Pushpin Clustering with the Bing Maps WPF control , but found the problem because both use different APIs.

    What is equivalent name for the following functions:
        Layer (WPF) = ... (UWP)? 
        Map.BoundingRectangle (WPF) = .... (UWP)?
        Map (WPF) = MapControl (UWP)?
        Location (WPF) = Geopoint (UWP)? 
        LocationToViewportPoint (WPF)= GetOffsetFromLocation (UWP)?
        Pushpin (WPF) = MapIcon (UWP)?
        ViewportSize.Width (WPF) = ActualWidth (WPF)?
        ViewportSize.Height (WPF) = ActualHeight (WPF)?

    Thank You




    hello , you could share the universal code in Windows 10 . Thank you

    Wilson Vernay MCP MCAD MCSD

    Friday, November 20, 2015 8:13 PM