Draw a centered ellipse

3 posts, 0 answers
  1. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 15 Mar 2012 Link to this post

    How can i draw a ellipse centered on lat, lon position?
    Thank you.
  2. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 15 Mar 2012 Link to this post

    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.
  3. DevCraft banner
  4. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 20 Mar 2012 Link to this post

    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 >>
Back to Top