Prevent whilte tiles in Pixelkarte

22 views
Skip to first unread message

Luzian Scherrer

unread,
Jun 28, 2025, 3:15:56 AMJun 28
to GeoAdminCh API
Hello

I'm using the Swisstopo Pixelkarte as an overlay to a MKMapView on iOS like so:

let baseMapTemplate = "https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/{z}/{x}/{y}.jpeg"

baseMapTileOverlay = MKTileOverlay(urlTemplate: baseMapTemplate)

baseMapTileOverlay!.canReplaceMapContent = false

baseMapRenderer = MKTileOverlayRenderer(tileOverlay: baseMapTileOverlay!)

mapView.addOverlay(baseMapTileOverlay!, level: .aboveRoads)


What I would like to achieve is having the Swisstopo tiles shown in Switzerland and using the regular Apple tiles as a fallback in any other region. However, the result I get is this:

Screenshot 2025-06-28 at 09.09.04.png

It seems that the Swisstopo server is returning white tiles in some areas at its border. And even worse, the white border spans different regions in different zoom levels.

My question: How can I get rid of the white tiles?

Pascal Barth

unread,
Jul 2, 2025, 4:18:20 AMJul 2
to geoadm...@googlegroups.com
Hi Luzian,

Sadly we can't really improve this situation without changing the whole National Map product. It's currently made with JPEG tiles, which means there's not transparency (hence the white border you see when no data).
The extent of the white depends on the tiles you are loading (see screenshot)
image.png

You could maybe try limiting the max zoom, so that tiles that are mostly white aren't loaded. (a value of 8 might work well).
Another way to deal with that might be to set a boundingMapRect to your overlay, and limiting the bbox to the LV95 extent (you can find it here https://epsg.io/2056, you might need to tweak this down a little bit to minimize the white borders)

I don't know if we will ever produce background tiles in PNG, but for these kinds of use case that would be very nice to have.

Cheers,
Pascal

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/geoadmin-api/4dbef62c-954d-418b-8c35-66d471f30801n%40googlegroups.com.
Message has been deleted

Luzian Scherrer

unread,
Jul 2, 2025, 11:07:39 AMJul 2
to GeoAdminCh API
Hi Pascal,

Thanks for your response, it is much appreciated!

Setting a bounding box on the overlay retrieval and limiting the z value to >=8 is working fine. Unfortunately at z=17 and higher the cutoff seems to happen exactly at the border and not at a bounding box any more. So that would effectively restrict me to 16 >= z >= 8.

Screenshot 2025-07-02 at 11.10.57.png

Pascal Barth

unread,
Jul 2, 2025, 11:12:18 AMJul 2
to geoadm...@googlegroups.com
Hi Luzian,

Great that it already improves a bit the situation.
If you want to go a step further, you can have a look at VectorTiles, which could provide a better transparency support. I'm just not really aware if this is achievable in a iOs/Swift context, or not. https://api3.geo.admin.ch/services/sdiservices.html#mapbox-vector-tiles
There's no "out-of-the-box" support for that from Apple, so you'll have to use a 3rd party map library.
But that might require you step away from using MKMapView, which is a big step away...

Cheers,
Pascal

Reply all
Reply to author
Forward
0 new messages