Grab the raw map tiles?


Is it ok to just pull the raw tile images from the OSM database? I know we can do this:


to grab the raw tiles. Is that legal (sorry, it’s already posted in a few places on the net, if this is not supposed to be publicized please just take this post down).

If it’s ok to do that, I’m wondering:

  1. Is there anyway to grab the tiles in 128x128 pixel size? I’m developing for mobile phones and the 256x256 tile size is probably just too big.
  2. Do the tiles grabbed like this have any street data already burnt into the map tiles? Or if you want streets, you need to make a separate API request and put them on top of your image in another layer?

Just some background, I’m making an open-source mapping library for j2me devices (there are none that are truly open where you can have the source code). I have it working already but am pulling the tiles from google maps, which is illegal, so I wanted to go with OSM to steer clear of any trouble. The nice thing about google/yahoo maps is that you can request the tile size, so I’ve been using 128x128, it’d be great if OSM had a separate tile cache of that size for mobile devices too.


I think you will need more than just smaller tiles, I suspect Google tiles use less colors than Openstreetmap, both in palette and in drawing all the fanzy stuff on the maps. So a custom mapnik render rule would probably be a good idea, but then again just splitting the tiles might be enough to get things working, no need to make things harder than they are… :slight_smile:

  1. I don’t think anyone will mind if you fetch the tiles directly from the server, please add a note to your app that the data is from openstreetmap. Similar to what you see in Mobile Google Maps.

  2. No, you should be able to fix Mod tile to do that though, if you do that I’m pretty sure it will be added to the server, if it’s feasible performance wise… ATM the 256x256 tiles are saved in packs of 8 in a custom made .meta package format. And then when a client requests tiles they are extracted from that. (I haven’t read this code just read about it, so I might have some misconceptions)

  3. No, you need to request data for the tiles separatly, see the tile data server concept. Which might work for you. Since OJW is trying to do the same thing, on the fly rendering and routing, by changing the data structures a whee bit.

It’s great that you are doing this for mobilphones, that’s one area where we really need better OSM support IMHO… (I use Google maps on my 4 year old phone, so it should be doable on most phones by now…) I tried using TrekBuddy but that doesn’t work on my phone…

emj, thanks for replying to me on this. I of course have some new questions:

  1. I’ll definitely add the watermark in the map app itself, have to give credit where credit is due.

  2. No, you should be able to fix Mod tile to do that though
    Ok I read through the Mod tile link. It seems that this is for people who want to create their own open street map instance on one of their servers. Then they can choose how to prerender the tiles to be served out? In my case I’d want the world pre-rendered in 128x128 tiles sizes, right? (If this is correct) my problem is that I need something with the server power of open street maps to serve anyone who wants to use the open source community using the library. So I think I’m stuck using the raw 256x256 tiles unless OSM or some other big (free) sponsor wants to host the 128x128 pre-rendered tiles?

  3. No, you need to request data for the tiles separatly
    Ok I modified the library code so it’s pulling the tiles correctly based on lat/lon from OSM (instead of google), and I do see once I zoom in enough streets and street names, which is great. Again, this is by just accessing the raw tiles like:

For mobile phones, this is probably all that’s needed, just the basic streets and their names. But it sounds like the link you provided allows you to setup a rendering pipeline of exactly what data you want from ‘the server’ rendered onto your final map image. In the tile data server link, there’s actually a suggestion for mobile devices to do just:

GET /api/0.5/tiledata/z/x/y

which is the same as accessing the raw data it seems.

Yeah so I guess I’d just like to know who is actually hosting all these tile images when I’m accessing them via the raw link? Is OSM some funded organization that’s doing it? Do you think it’d be worth talking to them about also hosting pre-rendered 128x128 tiles as well (with fewer colors) to support mobile devices? It’d basically be a duplicate in disk size of what they already have just a lot more file nodes.


Yes… So if you want to serve 128 tiles that is were you should change.

Didn’t know that… :slight_smile: Cool tip.

Openstreetmap foundation is founded by donations, if memory serves me right: hardware is donated by companies, bandwidth by Uni of London. And then personal donations and member fees.

As I said above if you have code to serve tiles at 128x128 I’m sure it could be added in some way.


  1. make mod_tile render 128x128
  2. make proxy that gives you 128^2 tiles instead of 256^2
    2.1 crop 256^2 to four parts
    2.2 reduce size to 128^2

2.1 and 1. will make the image and data zoom levels out of sync.

Now I can’t think anymore so I need sleep… :slight_smile:

It’d be worth talking to CloudMade ( about mobile-friendly tiles from OSM data. They have a developer mailing list.

OSM isn’t really a tile hosting service - we provide the tiles to show off the data, but the data is the main point of it all.

Well… Being able to compare osm data on location in the real world seems like a good thing.