1

I used MKTileOverlay class to cover the map by self generated tile images.

All works good, except the tiles on the border at Longitude 180 or -180 degree. At this line, tiles are drawn only sometimes... can anybody give me a hint to solve that?

you can see the effect on this screenshot

enter image description here

This particular area of the map should be covered completely by this "default" tiles. The tile images itself should be OK, as they are displayed on the other tiles.

I use this loadTile(at: ... ) function to provide the generated tile images. The print statements shows that this function is called for all tiles and that the result function gets a valid image. It's just that the tiles are not drawn .. and I use the standard MKTileOverlayRenderer..

override func loadTile(at path: MKTileOverlayPath, result: @escaping (_ data: Data?, _ error: Error?) -> Void) {

    let x: Int = path.x
    let y: Int = path.y
    let zoomLevel : Int = path.z

    // calculate the x for the tile at longitude 180 degree
    let xMax = (1 << zoomLevel) - 1


    if (x == 0) || (x == xMax) {
        print("\(zoomLevel)/\(x)/\(y) requested")
    }

    // local variable to hold the image of the tile
    var localUIImage: UIImage = tileImageForDefaultImage


    // lots of stuff to generate the tile image


    // check if we have a valid image
    if let resultImage = localUIImage.pngData() {

        if (x == 0) || (x == xMax) {
            print("resultImage: \(resultImage.debugDescription)")
        }

        result(resultImage, nil )

    } else {

        let noResultImage = tileImageForDefaultImage.pngData()
        if (x == 0) || (x == xMax) {
            print("noResultImage: \(noResultImage.debugDescription)")
        }

        result(noResultImage, nil )
    }
}

.. any hint is welcomed ;-)

Hardy_Germany
  • 1,259
  • 13
  • 19

1 Answers1

0

In short: Apple confirmed that this is a bug in IOS MapKit. At least IOS versions 11 and 12 are affected. There is no known work around so far.

Long version: I spend a DTS ticket for this and got in contact with a really good Apple engineer. After some work together, he could easily reproduce the issue. He asked me to file a bug report (49270907). By this he was able to talk to the MapKit team and they confirmed the bug.

Hardy_Germany
  • 1,259
  • 13
  • 19
  • is this still an issue for iOS 13? Do you think this bug affects my question. I think it's similar if that both our questions don't seem to render visible tiles? https://stackoverflow.com/questions/62824057/local-tiles-stored-in-sqlite-db-not-rendering-on-loadtileat-pathresult Can you point me to the bug report? Thank you! – Turnipdabeets Jul 09 '20 at 23:38
  • You are right. the bug is gone in IOS 13. The bug number is 49270907. But maybe it's already closed. – Hardy_Germany Jul 11 '20 at 05:12