Skip to content

Frequently Asked Questions

Why is the map slower in MAUI on Android than in native Android?

The applications may use different SkiaSharp versions, build configurations, map data, or GPU host views. MAUI defaults to TextureView, while native Android uses SurfaceView. The MAUI sample lets you compare host views with the same local map. See rendering options for the workflow and measurement limits. A different host view is a possible cause, not a confirmed diagnosis or a guaranteed speed improvement.

How can I get rid of the white dots? (or black lines)

Set Layer.Style = null. In Mapsui a Style can be assigned to a ILayer and a Feature. A Layer is created with a default style which is rendered as a white dot for a Point, a black line for a LineString and a black outline for a Polygon. The Layer.Style applies to all features in the layer. If you work with a style on a feature the layer style is still drawn underneath.

The openstreetmap layer does not show

The most common reason is that the default user-agent used by the osm layer is blocked. The default user-agent gets blocked by osm at some point because there is always someone somewhere abusing the api. Within your app you need to use a user-agent that is specific to your app. We change the user agent from time to time so that the samples work but it will probably get blocked again at some point. Better not to wait until that happens and create you own user-agent right away.

MapControl.Map.Layers.Add(OpenStreetMap.CreateTileLayer("your-user-agent"));

How do I set User-Agent or Referer headers on a tiled map source?

Use the configureHttpRequestMessage parameter of HttpTileSource to add any HTTP headers, including Referer:

var tileSource = new HttpTileSource(new GlobalSphericalMercator(),
    "https://example.com/tiles/{z}/{x}/{y}.png",
    configureHttpRequestMessage: (r) =>
    {
        r.Headers.TryAddWithoutValidation("User-Agent", "your-app-name");
        r.Headers.TryAddWithoutValidation("Referer", "https://yoursite.com");
    });
MapControl.Map.Layers.Add(new TileLayer(tileSource));

This is also how OpenStreetMap.CreateTileLayer sets its user-agent internally.

Why is all my data in a small area near the west coast of Africa?

This is because the background data is in SphericalMercator (it is in the SphericalMercator coordinate system) and the foreground data is in WGS84 (latlon). Use SphericalMercator.FromLonLat to transform it. Note: There can be many other forms of mixing up coordinate systems, but this is the most common.

Why does NavigateTo zoom into an area near the west coast of Africa?

This is because the coordinates you pass to NavigateTo are in WGS84 whereas the background data is in SphericalMercator. Use SphericalMercator.FromLonLat to transform the NavigateTo arguments to SphericalMercator. Note: There can be many other forms of mixing up coordinate systems, but this is the most common.