- gdal, also available to install via
brew install gdal
- Lagekarten der Uni Heidelberg: http://www.uni-heidelberg.de/universitaet/besucher/karten/
-
Create VRT file from map image with at least 4 sets of coordinates (x,y) in pixels from the top left and (lat, long) in degrees:
$ gdal_translate -of VRT -a_srs EPSG:4326 [-gcp x y long lat]* [source_file] [destination_file]
-
Generate tiles:
$ python gdal2tiles.py -p mercator [vrt_file] -z 15-20
- INF:
-gcp 510 543 8.658369 49.422397 -gcp 2920 489 8.674420 49.422641 -gcp 3237 2805 8.676662 49.412631 -gcp 1482 2266 8.664986 49.414950
- ALT:
-gcp 5331 1875 8.716172 49.410304 -gcp 2915 2136 8.705491 49.409538 -gcp 94 1482 8.693046 49.411565 -gcp 3835 753 8.709578 49.413607
- BERG:
-gcp 537 1353 8.682831 49.408787 -gcp 3384 2434 8.687846 49.408416 -gcp 6474 1567 8.692385 49.410241 -gcp 3391 710 8.687073 49.410302
- Upload to server directory
/static/map-tiles/{campusRegion.identifier}/
-
Add a
MKTileOverlay
with appropriate URL template to the map view:MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:[NSString stringWithFormat:@"%@/{z}/{x}/{y}.png", serverURL]]; overlay.geometryFlipped = YES; overlay.minimumZ = 14; overlay.maximumZ = 17; overlay.canReplaceMapContent = NO; [mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];
-
In
mapView:rendererForOverlay:
return anMKTileOverlayRenderer
initialized with the tile overlay