WPF RadMap Location

2 Answers 15 Views
Map
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
Ohad asked on 11 Jan 2022, 09:53 AM | edited on 11 Jan 2022, 10:02 AM

Hi,

I got from the user Location = {90, -12.516352000000095}

and when I try to create the Provider I get an exception that "'∞' is not a valid value for property 'Height'."

At any other point, everything works properly.

I would be happy if you could help me, 

Thanks.

 

<telerik:RadMap
                                                                x:Name="map"
                                                                Center="{Binding PinLocation}"
                                                                CommandBarVisibility="Collapsed"
                                                                IsKeyboardNavigationEnabled="False"
                                                                Loaded="Map_OnLoaded_RefreshProvider"
                                                                MiniMapExpanderVisibility="Collapsed"
                                                                MouseClickMode="SelectItem"
                                                                MouseDoubleClickMode="None"
                                                                MouseDragMode="None"
                                                                MouseLocationIndicatorVisibility="Collapsed"
                                                                MouseWheelMode="ZoomToCenter"
                                                                NavigationVisibility="Collapsed"
                                                                ScaleVisibility="Collapsed"
                                                                UseSpringAnimations="False"
                                                                ZoomBarVisibility="Collapsed"
                                                                ZoomLevel="16">

                                                                <telerik:InformationLayer>
                                                                    <telerik:Pushpin
                                                                        telerik:MapLayer.Location="{Binding PinLocation}"
                                                                        Cursor="Hand"
                                                                        Style="{StaticResource MapPushpinStyle}" />
                                                                </telerik:InformationLayer>
                                                            </telerik:RadMap>

 

  private void Map_OnLoaded_RefreshProvider(object sender, RoutedEventArgs e)
        {
            if (sender is RadMap map)
            {
                map.Language = XmlLanguage.GetLanguage(CultureInfo.DefaultThreadCurrentCulture.Name);
                map.Provider = MapProviderFactory.Create();
            }
        }

* If I change map,Provider to:

map.Provider = new BingRestMapProvider(MapMode.Aerial, true, "key");

I will get the same exception.

 

2 Answers, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 13 Jan 2022, 01:11 PM

Hello Ohad,

I have created a sample project using the provided code snippet, in order to test this, and upon running the application, I was able to observe the mentioned exception. This behavior is expected, due to the passed latitude value (90 in the provided code) to the telerik:MapLayer.Location attached property of the Pushpin element. In addition, only latitude values between -90 and +90 degrees are considered valid, whereas passing a value equal to or greater than the boundaries values, will result in an exception. The following article contains additional information on the latitude and longitude values.

Latitude, Longitude and Coordinate System Grids - GIS Geography

With that said, setting a value lower than 90, for example, 89 (which is a value between the mentioned boundaries) would prevent the application from throwing the observed exception:

<telerik:InformationLayer>
    <telerik:Pushpin telerik:MapLayer.Location="89,-12.516352000000095"/>
</telerik:InformationLayer>

I hope the provided information is of help to you. Let me know if you need any further assistance.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Jan 2022, 07:48 AM
Thanks!
Tags
Map
Asked by
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stenly
Telerik team
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or