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

How to add raster (georeferenced bitmap) to InformationLayer

1 Answer 137 Views
Map
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 10 Feb 2020, 07:52 PM

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.

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Feb 2020, 09:57 AM

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.
Tags
Map
Asked by
Thomas
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or