none
Resize Ellipse when zoom level change RRS feed

  • Question

  • Hi everyone! I figured it out how i can add different shapes in map layout. But i have 2 questions:

    1. When i click on map, on map add new Ellipse with width and height equal 100 and when map zoom level resize Ellipse remains the same size. Lets suppose, i need create Ellipse which will cover a radius of in 10 km. How i can make it so that when zoom changes Ellipse always cover 10 km the same territory?
    2. Ellipse fields width and height work with pixels or metric system? That is if i work with map then Ellipse width="1" equal 1 pixel or 1 metre or 1 centimeter?

    Thank you for your answers

    Wednesday, August 28, 2019 4:42 AM

Answers

  • It sounds like what you want to use is a MapPolygon

    https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Maps.MapPolygon

    Rather than a XAML ellipse object. XAML is fundamentally in screen-space, not map space and won't scale with map content. You could choose to listen to map events and try to scale the ellipse yourself, but this would be a fair bit of code, the XAML would never stay in sync fully with the map content, and it wouldn't correctly represent an actual ellipse in world space distance through different map projections (you mention you want 10km in size for example - a 10km radius region isn't circular in the Mercator projection).

    MapPolygon will do all of the above for you automatically.

    Wednesday, August 28, 2019 3:57 PM
    Moderator

All replies

  • It sounds like what you want to use is a MapPolygon

    https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Maps.MapPolygon

    Rather than a XAML ellipse object. XAML is fundamentally in screen-space, not map space and won't scale with map content. You could choose to listen to map events and try to scale the ellipse yourself, but this would be a fair bit of code, the XAML would never stay in sync fully with the map content, and it wouldn't correctly represent an actual ellipse in world space distance through different map projections (you mention you want 10km in size for example - a 10km radius region isn't circular in the Mercator projection).

    MapPolygon will do all of the above for you automatically.

    Wednesday, August 28, 2019 3:57 PM
    Moderator
  • Thank you.

    Today durring the day i will try to implement it.

    Thursday, August 29, 2019 3:49 AM
  • How i can implement this functions from this articles? If i understand correct this example implement on JavaScript.

    https://blogs.bing.com/maps/2019-08/how-maplytics-uses-spatial-math-module-for-emergency-response-by-locating-affected-areas-on-bing-maps


    Friday, August 30, 2019 4:45 AM
  • Here's a more relevant post

    https://social.msdn.microsoft.com/forums/onedrive/en-US/33878b72-08ca-4c3b-8291-75bd4f43b776/draw-a-circle-given-a-latlong-and-radius-in-miles

    Friday, August 30, 2019 4:13 PM
    Moderator