Mapsui icon indicating copy to clipboard operation
Mapsui copied to clipboard

Mapsui (3.0.0.0) has the same problem

Open pauldendulk opened this issue 3 years ago • 4 comments

HI, I've tryed to install the new version of mapsui (3.0.0.0) and change the include asset to none, but the problem is the same. Attached refreshed app.

Are there something to solve it ?

App1.zip

Originally posted by @aprilesalvatore in https://github.com/Mapsui/Mapsui/issues/1216#issuecomment-940066485

pauldendulk avatar Oct 12 '21 07:10 pauldendulk

@aprilesalvatore Could you describe how to reproduce the problem and what you see? Is there is stacktrace or logging that could help? There are two tile layers? Does it make a difference if you remove one of those?

pauldendulk avatar Oct 12 '21 07:10 pauldendulk

Environment: Xamarin Forms Version : 5.0.0.2125 Vs 2019: 16.11.5 Xamarin Ios: 15.0.0.8. Iphone 13 mini simulator

I think that to find the problem: I use 2 different layer plus adding points

Please check This Methods

private void InitMaps(MapView mapView)
{
    var map = new Mapsui.Map
    {
        CRS = "EPSG:3857",
        Transformation = new MinimalTransformation(),
    };
    map.Layers.Add(OpenStreetMap.CreateTileLayer());
    map.Layers.Add(OpenRailStreetMap.CreateTileLayer());

    map.Widgets.Add(new Mapsui.Widgets.ScaleBar.ScaleBarWidget(map) { TextAlignment = Mapsui.Widgets.Alignment.Center, HorizontalAlignment = Mapsui.Widgets.HorizontalAlignment.Left, VerticalAlignment = Mapsui.Widgets.VerticalAlignment.Bottom });

    mapView.Map = map;

    Mapsui.Logging.Logger.LogDelegate += (level, message, ex) =>
    {
        if (ex != null)
            System.Diagnostics.Debug.WriteLine($"APP1 message: {message} | Exception: {ex?.Message}");
    };
}

There are 2 layers OpenStreetMap and OpenRailStreetMap. If I enable both thera is a problem, if there is only the OpenStreetMap work successfully**, If I add only OpenRailStreetMap it NOT works.** It seems that the problem is a OpenRailStreetMap layer.

This is a implementation of OpenRailStreetMap


 public static class OpenRailStreetMap
    {
        private static readonly BruTile.Attribution OpenStreetMapAttribution = new BruTile.Attribution(
            "© OpenStreetMap contributors", "https://www.openstreetmap.org/copyright");

        public static TileLayer CreateTileLayer(string userAgent = null)
        {
            if (String.IsNullOrEmpty(userAgent))
                userAgent = $"user-agent-of-{Path.GetFileNameWithoutExtension(System.AppDomain.CurrentDomain.FriendlyName)}";

            return new TileLayer(CreateTileSource(userAgent)) { Name = "OpenRailwayMap" };
        }

        private static HttpTileSource CreateTileSource(string userAgent)
        {
            return new HttpTileSource(new GlobalSphericalMercator(),
                "https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png",
                new[] { "a", "b", "c" }, name: "OpenRailwayMap",
                attribution: OpenStreetMapAttribution, userAgent: userAgent);
        }
    }

On android with 2 layers plus points run successfully.

Another problem is that the ballon not appear when I click on the point. This problem is always present (with 1 layer anc with 2 layers)

aprilesalvatore avatar Oct 13 '21 08:10 aprilesalvatore

Thanks for all the info. Perhaps something is going wrong with the threads and locks involved in fetching the tiles.

Could you also provide the output of the logger? It seems to be a different problem than the one caused by System.Memory. I do not expect the same exception.

pauldendulk avatar Oct 13 '21 13:10 pauldendulk

Could you check if v3.0.1 that was released yesterday helps?

pauldendulk avatar Oct 15 '21 07:10 pauldendulk

In the meantime there is a 4.0.0. Please create a new issue if you run into this problem.

pauldendulk avatar Jun 23 '23 19:06 pauldendulk