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

MAP - load JPW file data

5 Answers 147 Views
Map
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 09 Mar 2015, 08:46 AM
Hi guys,
My requirements are to load an image as a provider but with JPW mapping details. 
For example:

0.0000478933
0
0
-0.0000313467
44.6320800
48.8499400


I thought about using LocationRect but it is unclear where the parameters in the FILE should be place in the method call. 
Can you please post an example of JPW with image as provider? 

Thanks,
Max.
 

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 11 Mar 2015, 02:44 PM
Hi Max,

The RadMap control doesn't have a built-in support for JPW files. However, if you tell us what you want to achieve and how you implemented it so far, we can think of an approach that we can suggest you.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Max
Top achievements
Rank 1
answered on 11 Mar 2015, 03:31 PM
Hi Martin,
Thanks for the reply. Let me be more specific about my requirements:
I need to load an image with the given input:
1. pixel size in the x-direction in map units/pixel (e.g. 0.0000478933)
2. pixel size in the y-direction in map units, almost always negative (e.g. -0.0000313467)
3. x-coordinate of the center of the upper left pixel (e.g. 44.6320800)
4. y-coordinate of the center of the upper left pixel (e.g 48.8499400)

The code I tried is as following: 
XAML:
<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <telerik:MapMouseLocationIndicator MapControl="{Binding ElementName=RadMap1}"
                                               LocationFormat="Number"
                                               Margin="10"
                                               HorizontalAlignment="Center"
                                               Width="250"
                                               IndicatorLabelBackground="White"
                                               IndicatorLabelBorderBrush="Black"
                                               Foreground="Black" />
        <telerik:RadMap x:Name="RadMap1"
                  ItemTemplateSelector="{StaticResource GeoItemTemplateSelector}"
                        MapMouseClick="radMap_MapMouseClick"
                        NavigationVisibility="Collapsed"
                        ZoomBarVisibility="Collapsed"
                        MouseLocationIndicatorVisibility="Visible"
                        ZoomLevel="5"
                    Grid.Row="1"
                        CommandBarVisibility="Visible">
            <telerik:InformationLayer x:Name="informationLayer" ItemsSource="{Binding MapObjects,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemTemplateSelector="{StaticResource GeoItemTemplateSelector}">
                <telerik:InformationLayer.ItemTemplate>
                    <DataTemplate>
                        <Ellipse telerik:MapLayer.Location="{Binding}"
                                 Width="20"
                                 Height="20"
                                 Stroke="Red"
                                 StrokeThickness="3"
                                 Fill="Transparent">
                            <telerik:MapLayer.HotSpot>
                                <telerik:HotSpot X="0.5"
                                                      Y="0.5" />
                            </telerik:MapLayer.HotSpot>
                        </Ellipse>
                    </DataTemplate>
                </telerik:InformationLayer.ItemTemplate>
            </telerik:InformationLayer>
        </telerik:RadMap>
    </Grid>

Code behind:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            UriImageProvider UriImageProvider1 = new UriImageProvider();
            UriImageProvider1.Uri = new Uri("MyImage.jpg");
            this.RadMap1.Provider = UriImageProvider1;

            Size geoSize = this.RadMap1.GetGeoSize(new Location(48.8499400,44.6320800), new Size(0.0000478933, 0.0000313467));
            var view = new LocationRect(
                new Location(0, 0),
                new Location(-geoSize.Height, geoSize.Width)) { MapControl = this.RadMap1 };
            this.RadMap1.GeoBounds = view;
            this.RadMap1.MinZoomLevel = view.ZoomLevel;
            this.RadMap1.MaxZoomLevel = 5;
            this.RadMap1.SetView(view);

        }

The result I get is that the upper left corner is (15,-15) instead of  (48.8499400,44.6320800), obviously I'm doing something wrong. Does RadMap supports my requirements? 

Thanks a lot,
Max.

0
Martin Ivanov
Telerik team
answered on 16 Mar 2015, 01:52 PM
Hello Max,

As I understand you want to restrict the geo bounds of the map to start from x:48.8499400  and y:44.6320800 and the geo size to be width:[x+0.0000478933] and height:[y + 0.0000313467]. If that so, you can create a new LocationRect with this coordinates as arguments and set it as GeoBounds of the provider. Here is an example in code:
LocationRect view = new LocationRect(48.8499400, 44.6320800, 0.0000478933, 0.0000313467);
this.UriImageProvider1.GeoBounds = view;
this.RadMap1.SetView(view);

If this is not what you are looking for, can you please send me a drawing that demonstrates the expected and the actual result in your scenario? This will help me in better understanding your case and assist you further.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Max
Top achievements
Rank 1
answered on 16 Mar 2015, 03:26 PM
Hi Martin,
Thanks for the answer, but I don't understand why the upper-left corner is (48.85036, 44.6314255) while I set the image with the boundaries  :
LocationRect view = new LocationRect(48.8499400, 44.6320800, 0.0000478933, 0.0000313467);
Please see attach while the mouse is over the upper-left corner of the image.

Thanks!
Max.
0
Accepted
Martin Ivanov
Telerik team
answered on 19 Mar 2015, 02:54 PM
Hi Max,

It seems that the provided coordinates in the JPW world file represents a map on the Universal Transverse Mercator coordinate system (UTM) and I am afraid that currently the map control does not support this projection.

As a side note, the GeoBounds properties of the map and the MapProvider serve different purposes in RadMap. The RadMap.GeoBounds restricts panning region, while the MapProvider.GeoBounds limits the size of the geographical region covered by the respective provider and allows creation of specific “map windows” over the map.

About your question, unfortunately without the files (image of the map and the data) and your implementation I cannot be sure why the coordinates differs then the defined in the rect. A possible reason could be if the aspect ratio of the loaded image (pixel width/pixel height) do not correspond to the projection that is used. 

You can take a look at the following resources that could be helpful for your requirement:
Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Map
Asked by
Max
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Max
Top achievements
Rank 1
Share this question
or