3

I'm using OpenStreet map to with our own map server with iOS. for iOS I couldn't find any third party library (free or paid) which can use with our open StreetMap server. then I decided to go with MKMapView using MKTileOverlay like below :

added a MapKit outlet to my storyboard. made a outlet connection and set delegates to self using storyboard and then here is my viewdidload method.

let urltemplate = "http://tile.openstreetmap.org/17/94621/62995.png"
let overlay = MKTileOverlay(urlTemplate: urltemplate)
overlay.canReplaceMapContent = true
mapView.add(overlay)

then the output is like below :

Out put of Map

Any idea of what is going on. when I scroll to right of left I can only see this image. please help me with this.

Marlon Brando aka Ben
  • 863
  • 1
  • 14
  • 33

1 Answers1

1

Because that's exactly what you specified in your URL template.

Instead of

http://tile.openstreetmap.org/17/94621/62995.png

use

http://tile.openstreetmap.org/{z}/{x}/{y}.png

scai
  • 20,297
  • 4
  • 56
  • 72
  • then How can I pass thos z, x and y values – Marlon Brando aka Ben Jul 16 '18 at 17:36
  • MKTileOverlay is supposed to fill them automatically. It should support the XYZ tile scheme. Z refers to the zoom level while X and Y are coordinates. See [slippy map tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) for details. – scai Jul 17 '18 at 07:10