4

[Edited to include example image outputs]

SE folks, I'm wanting to modify generate_tiles.py to create 512 x 512 tiles.

At om_henners' recommendation, I tried replacing 12 of the 13 instances of 256 in the Python file (the 13th specifies the .PNG image format). I've since tried a test run, and I can already tell something is wacky...

Replacing all the relevant 256's with 512's merely produces a larger tile, when the intended result is increased mapped-area per tile (I think it amounts to 4x coverage).

Posting the code isn't worthwhile becuase you can see it here, but it is worth noting this is the only line for which I did not change 256 to 512 between test runs:

im.save(tile_uri, 'png256')    <-- the only 256 not changed to 512

So I'm getting these two outputs, and I have two curious observations:

1) The file address is the same. I would expect---if the mapped-area was changed between runs---the same location should fall into a different file, no?

2) Even though the mapped-area remained the same, the 512 tiles gained labels. Very interesting.

256x256 (%/8/61/97.png)

enter image description here

512x512 (%/8/61/97.png)

enter image description here

(And, I apologize for double-posting, but this question isn't getting any interest at help.OSM, and it seems at least one person at GIS.SE is okay with some of that traffic appearing here.)

Thanks in advance for the help!

3
  • 1
    There is an implicit assumption that a particular zoom level covers a particular cartesian area in most tools. See wiki.openstreetmap.org/wiki/Zoom_levels. Consider what the output at zoom level 0 should look like.
    – BradHards
    Commented Dec 22, 2012 at 0:24
  • Maybe you can explain why you are trying to make bigger tiles - that might allow people to come up with better solutions to the real problem you are trying to solve.
    – BradHards
    Commented Dec 22, 2012 at 0:25
  • @BradHards thanks for taking an interest. We (me and another fella at my company) formerly used 256x tiles in our stuff, but we found---in our case---512 creates a better UX. I realize alot of queries on this subject suggest 256x creates a better user experience, but this wasn't the outcome of our experimentats. Maybe our server is slow, but our product, for enterpise clients (not the general public using smart phones), uses a full-screen map viewport. So that said, all of our existing sites use 512x, and I want to stay true to 512x tiles when we deploy the OSM data.
    – elrobis
    Commented Dec 22, 2012 at 1:12

2 Answers 2

2

For testing, I would suggest to start with small countries, like Andorra or Monaco. Geofabrik has those extracts for download, and the result should drop in quickly.

Furthermore, you have to adapt the tilesize in Openlayers or whatever you aim to display the tiles with.

0
1

Update (origianlly said to change all the instances of 256 except the png definition)

Taking a look at your update and the code a bit more carefully, you were right originally - if you also leave the first c = 256 in the GoogelProjection initialisation you will get the tiles back at the correct resolution. However your tile naming convention will be changed compared to the 256 tiles, which depending on your application may or may not be important (x and y are halved).

4
  • +1 Ok great---I appreciate the insight, om_henners. I suspect you are right. Once I've tried it (likely today or by Saturday), I'll return and followup with you. Thanks again for your help.
    – elrobis
    Commented Dec 21, 2012 at 10:22
  • I ran into some goofy stuff whcn changing all (but one) 256 to 512. I updated the question; curious if you have any additional insights.
    – elrobis
    Commented Dec 21, 2012 at 20:44
  • Updated as you were right originally to say not to change the top c = 256
    – om_henners
    Commented Jan 4, 2013 at 2:04
  • Also, apologies for the late reply - been on holidays!
    – om_henners
    Commented Jan 4, 2013 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.