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

UriImageProvider and Image Coordinates

1 Answer 86 Views
Map
This is a migrated thread and some comments may be shown as answers.
marco
Top achievements
Rank 2
marco asked on 30 May 2014, 05:52 PM
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.



1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 02 Jun 2014, 10:36 AM
Hi Marco,

The GeoBounds property specifies the LocationRect structure as latitude, longitude, width and height. Where the width and height are specified the width and height of the rectangle given as distance unit used by RadMap control (kilometers or miles).

You can use the GeoBoundsNW and GeoBoundsSE properties instead of GeoBounds property. These properties allow to specify a geographical rectangle area via two locations (north-west and south-east coordinates).

Regards,
Andrey Murzov
Telerik

 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Map
Asked by
marco
Top achievements
Rank 2
Answers by
Andrey
Telerik team
Share this question
or