This is a migrated thread and some comments may be shown as answers.

convert size in pixels to map coordinates size

1 Answer 98 Views
Map
This is a migrated thread and some comments may be shown as answers.
Pedro
Top achievements
Rank 1
Pedro asked on 18 Oct 2010, 07:01 PM
Hi,

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,
Gonçalo

1 Answer, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 20 Oct 2010, 04:42 PM
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);
  
this.informationLayer.Items.Add(rect);


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
Tags
Map
Asked by
Pedro
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or