UriImageProvider and Image Coordinates

1 posts, 0 answers
  1. marco
    marco avatar
    33 posts
    Member since:
    Sep 2007

    Posted 30 May 2014 Link to this post

    I'm trying to solve the following issue:

    I load a cartographic image, jpg of size 9472x6656 px and it covers a geographical rectangle area of the following lat&long: 42, 12.3   41.17, 13.88 (decimal degrees)

    I'm loading using directly XAML with the following code:


    01.<telerik:RadMap Height="472" Margin="0,52,0,0" VerticalAlignment="Top" x:Name="RadMap1"
    02.               ZoomLevel="14"
    03.               MinZoomLevel="6"
    04.               MaxZoomLevel="21"
    05.               Center="41.92481708629, 12.5"
    06.               NavigationVisibility="Visible"
    07.                        Cursor="ScrollAll"
    08.               ZoomBarVisibility="Visible"
    09.               CommandBarVisibility="Visible">
    10.           <telerik:RadMap.Provider>
    11.               <telerik:UriImageProvider x:Name="UriImageProvider1" GeoBounds="42.0, 12.3, 41.17, 13.88" Uri="Maps/myMap_Z13.jpg" />
    12.           </telerik:RadMap.Provider>
    13.           <telerik:InformationLayer Name="informationLayer">
    14.               <telerik:MapPinPoint Name="mapPinPoint" telerik:MapLayer.Location="41.92481708629, 12.5"
    15.                               Text="Cavalcavia" Cursor="Hand"
    16.                               ImageSource="Maps/icon01.png"  MouseLeftButtonDown="MapPinPoint_MouseLeftButtonDown" >
    17.                   <telerik:MapLayer.HotSpot>
    18.                       <telerik:HotSpot X="0.5" Y="0.5" />
    19.                   </telerik:MapLayer.HotSpot>
    20. 
    21.               </telerik:MapPinPoint>
    22.           </telerik:InformationLayer>
    23.       </telerik:RadMap>


    I'm trying to understand how coordinates and image size are releated.
    It seems that the coordinates I set for the image provider (GeoBounds) are not right, and image is positioned somewhere else.

    Which is the right way to position an image using UriImageProvider? There is no documentation online on that.
    I've tried to following the suggestion in other post (http://www.telerik.com/forums/uriimageprovider-questions)
    setting bounds with the following code, but I get only an error:

    01.BitmapImage oImage = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.BaseDirectory + "\\" + UriImageProvider1.Uri.OriginalString));
    02. 
    03.            Size geoSize = this.RadMap1.GetGeoSize(new Location(0, 0), new Size(oImage.PixelWidth / 10, oImage.PixelHeight / 10));
    04.            LocationRect view = new LocationRect(new Location(0, 0), new Location(-geoSize.Height, geoSize.Width));
    05. 
    06.            view.MapControl = this.RadMap1;
    07.            this.RadMap1.GeoBounds = view;
    08.            this.RadMap1.MinZoomLevel = view.ZoomLevel;
    09.            this.RadMap1.SetView(view);

    as the view.ZoomLevel property get an impossible number, something like: 243578438.



Back to Top