Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] The tile layer image for OpenStreetMap was not displayed in Xamarin.Forms UWP when the tile layer URI is added to the Image control #15783

Open
VishalOmprasad opened this issue Jul 23, 2023 · 0 comments
Labels
a/maps 🌐 p/UWP s/unverified New report that has yet to be verified t/bug 🐛

Comments

@VishalOmprasad
Copy link

Description

I was trying to display the image of tile layer for OpenStreetMap using the Image control in the UWP platform, but the tile layer was displayed or displayed blank.

Steps to Reproduce

  1. Create a new Xamarin.Forms application.
  2. In the MainPage.xaml, add a simple image control.
  3. In the MainPage.xaml.cs, initialize a new BitMapImage control and set the OSM tile layer's URI to its UriSource property. Then set the BitMapImage to the Image.Source.
  4. Run the application.

Expected Behavior

The image of the OSM tile should be displayed.

Actual Behavior

The image of the OSM tile was not displayed.

Example Code Snippet

In MainPage.xaml

<Page
    x:Class="BitmapImageDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BitmapImageDemo"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Image x:Name="image"
               Stretch="Uniform" />
    </Grid>
</Page>

In MainPage.xaml.cs

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
        BitmapImage bitmapImage = new BitmapImage();
        bitmapImage.UriSource = new Uri("https://tile.openstreetmap.org/1/1/0.png", UriKind.RelativeOrAbsolute);
        image.Width = bitmapImage.DecodePixelWidth = 256;
        image.Height = bitmapImage.DecodePixelHeight = 256;
        image.Source = bitmapImage;
    }
}

Your can also find/download the example sample from the following github link.

Basic Information

  • In Android and iOS the image of the OSM tile got displayed. Issue occurred only in UWP.
@VishalOmprasad VishalOmprasad added s/unverified New report that has yet to be verified t/bug 🐛 labels Jul 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/maps 🌐 p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants