How to add raster (georeferenced bitmap) to InformationLayer

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    1 posts
    Member since:
    Feb 2011

    Posted 10 Feb Link to this post

    How can I add add a georeferenced bitmap image to a map?  This is a bitmap with known position (latitude and longitude of top left corner) and fixed pixel size (in degrees latitude and longitude).  The following code will place an image on the map (with the top left corner in the right spot):

    <telerik:RadMap x:Name="radMap" ZoomLevel="14" Center="35.561852, -83.732723">
        <telerik:RadMap.Provider>
            <telerik:OpenStreetMapProvider StandardModeUserAgent=""/>
        </telerik:RadMap.Provider>
        <telerik:InformationLayer>
            <Image Source="/Images/sample.png" telerik:MapLayer.Location="35.561852, -83.732723">
                <telerik:MapLayer.HotSpot>
                    <telerik:HotSpot X="0.0" Y="0.0" XUnits="Fraction" YUnits="Fraction" />
                </telerik:MapLayer.HotSpot>
            </Image>
        </telerik:InformationLayer>
    </telerik:RadMap>

    However, this obviously does not scale the image according to the pixel size in degrees.

     

     

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2420 posts

    Posted 13 Feb Link to this post

    Hello Thomas,

    To achieve your requirement, first you will need to determine the geo bounds of the Image. This means, the top left location and the width and height (in degrees). Then you can use the RadMap's GetPixelSize() method. The method needs a base point, and width, and height in distance units (degrees) to produce a pixel size. You can call the method in the ZoomChanged event handler of RadMap, and apply the returned size to the Width and Height properties of the image.

    Regards,
    Martin Ivanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top