MAP - load JPW file data

6 posts, 1 answers
  1. Max
    Max avatar
    3 posts
    Member since:
    Jul 2013

    Posted 09 Mar 2015 Link to this post

    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.
     
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 11 Mar 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Max
    Max avatar
    3 posts
    Member since:
    Jul 2013

    Posted 11 Mar 2015 in reply to Martin Link to this post

    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.

  5. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 16 Mar 2015 Link to this post

    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.

     
  6. Max
    Max avatar
    3 posts
    Member since:
    Jul 2013

    Posted 16 Mar 2015 in reply to Martin Link to this post

    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.
  7. Answer
    Martin
    Admin
    Martin avatar
    1101 posts

    Posted 19 Mar 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready