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

Draw a centered ellipse

2 Answers 145 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sonia
Top achievements
Rank 1
Sonia asked on 15 Mar 2012, 12:35 PM
How can i draw a ellipse centered on lat, lon position?
Thank you.

2 Answers, 1 is accepted

Sort by
0
Sonia
Top achievements
Rank 1
answered on 15 Mar 2012, 01:54 PM
I found the solution
// Calculate ellipse size in degrees (latitude-longitude).
Size degreeSize = map.GetLatitudeLongitudeSize(p, ellipseWidth, ellipseHeight);
 
// Calculate new ellipse location. 
Location ellipseLocation = new Location(p.Latitude + degreeSize.Height / 2, p.Longitude - degreeSize.Width / 2);

I hope it can be useful for anybody.
0
Andrey
Telerik team
answered on 20 Mar 2012, 09:19 AM
Hello Sonia,

We are glad that you managed to resolve this on your own.
Here's another approach to achieve te same - you can use the hotspot feature for positioning any framework element relative to geographical coordinates. For more information please take a look at the following help topic and example:
http://www.telerik.com/help/silverlight/radmap-features-hot-spots.html
http://demos.telerik.com/Silverlight/#Map/HotSpot

Then you can use the MapEllipseGeometry. The sample code is below.

<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadMap x:Name="radMap"
                    Center="42.6957539183824, 23.3327663758679"
                    ZoomLevel="10">
        <telerik:RadMap.Providers>
            <telerik:OpenStreetMapProvider />
        </telerik:RadMap.Providers>
        <telerik:InformationLayer x:Name="informationLayer">
            <telerik:MapPath Fill="Red" Opacity="0.5"
                             Stroke="Orange" StrokeThickness="2">
                <telerik:MapPath.Data>
                    <telerik:MapEllipseGeometry Center="42.6957539183824, 23.3327663758679"
                                                RadiusX="10" RadiusY="10"/>
                </telerik:MapPath.Data>
            </telerik:MapPath>
        </telerik:InformationLayer>
    </telerik:RadMap>
</Grid>

All the best,
Andrey Murzov
the Telerik team

Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Map
Asked by
Sonia
Top achievements
Rank 1
Answers by
Sonia
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or