convert size in pixels to map coordinates size

2 posts, 1 answers
  1. Pedro
    Pedro avatar
    25 posts
    Member since:
    Aug 2010

    Posted 18 Oct 2010 Link to this post


    I am drawing a Rectangle (silverlight rectangle) in map. But It draws with the upper left corner in the Location I specified and I want to draw it in the center. How can I do that? is there a way to set a latitude / longitude  offset .

    Is there some method to convert from pixel size (10pixels for instance) to coordinates size?

    Kind regards,
  2. Answer
    Andrey avatar
    1681 posts

    Posted 20 Oct 2010 Link to this post

    Hello Gonçalo,

    You can align framework element around the location using HotSpot object. For example, to specify location at the center of the rectangle you can use following code:

    Rectangle rect = new Rectangle()
        Width = 50,
        Height = 50,
        Fill = new SolidColorBrush(Colors.Red)
    MapLayer.SetLocation(rect, new Location(42.7669999748468, 25.2819999307394));
    HotSpot hotspot = new HotSpot()
        X = 0.5,
        Y = 0.5
    MapLayer.SetHotSpot(rect, hotspot);

    Kind regards,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top