Raster Map Overlays

In researching Map Overlays, I watched the WWDC video on it. I wanted to try the Raster Map Overlay demo for myself as James Howard described in the video using the example project TileMap.

Skip to the summary

He explained that he got the image from NOAA and that you cd create the needed tiles w/ gdal using the gdal2tiles.py script.

Sounds easy, huh?

I installed macports and using that I installed gdal using:
sudo port install gdal

But I cdn’t find the gdal2tiles.py script. Loooong story short, I macports installed 1.6.3 which I’m not sure includes gdal2tiles.py.

So then I installed KyngChaos‘s GDAL 1.7 which did have the script.

Then I downloaded a chart from NOAA – I picked Idaho b/c it was small (4 MB). I unzipped that file which produced several directories of files. I don’t know raster so I wasn’t sure what these files were??? And when I tried using gdal2tiles.py w/ them, I didn’t know what to do. 🙂

Fortunately, MapTiler provides a GUI for gdal2tiles.py and allowed me to select the files (1 at a time). I just processed one using the Spatial Reference System ‘Custom definition of the system (WKT, Proj.4,..)’… whatever that means.

I processed that and it produces a bunch more directories w/ pngs – now there’s something I understand. I used the 10-15 zoom levels for processing so it produced a dir for each of those w/ subdirs and images.

I removed the project’s images under ‘Tiles’ and copied my new images there, added them to the project and… nothing. For some reason, the images weren’t being found in the dir structure expected by the project???

I noticed the images in the original project weren’t in the project target’s ‘copy bundle resources.’ How were the images getting included in the build?

I tried several things, but what worked was to NOT remove the original images, add my new image dirs and THEN remove the original image groups/folders/dirs from the project.

I’d love to know what’s going on there???

The good thing is, once it worked, it worked… sorta. It overlayed the image and even recentered the map but I don’t think it’s in the right location b/c the river shown in the image doesn’t seem to be there on the map.

TileMap using Idaho Raster from NOAA

TileMap using Idaho Raster from NOAA

So I’m still working on that, but wanted to get the above down before I forgot what I did.

In summary, the steps are…

1. Install KyngChaos
2. Download NOAA Raster image/data
3. Install MapTiler
4. Process data from #2 w/ #3 which uses #1.
5. Replace images in example project TileMap project w/ #4 output.

I’d love to hear any comments on places that cd be done better above or make the location work right, etc.

5 thoughts on “Raster Map Overlays

  • Hi, this looks rather interesting. Ok I’ll say it. Awesome. But I couldn’t download the code cus I don’t have a ticket for the conference : / Could you help me with that.

    • You don’t need a WWDC ticket – being in the paid developer program should be enough – maybe not. It is for the videos which is probably just as helpful.

      Otherwise, I can’t help as I def don’t want to give away Apple’s code when they’re saying no. 😉

  • In the iTunes main page for the WWDC sessions, there is a link to the sample code. You can download it even if you were not registered for WWDC (what I’m doing right now).

  • “I just processed one using the Spatial Reference System ‘Custom definition of the system (WKT, Proj.4,..)’… whatever that means.”

    To get your image centered right, you need to provide the right coordinate system at this prompt.
    Most of the time, coordinate systems have a code (‘EPSG code’) which makes it easier to provide to softwares like TileMapper.

    • Thanks for the comment. This type of stuff is so far removed from my typical development that it’s like magic to me. 3D games, audio manipulation and now this are considered “other beasts” to me when you get into heavy lifting.
      When the time comes for me to do more of this, I’ll be in touch. 😉

Comments are closed.