I'm using Ubuntu 14.04, OSM in a Postgres database, and Tilemill to style and export to a mbtiles files. How can I generate tiles for an irregular-shaped (not rectangular) area. For example, if I want to generate tiles for the US states of Michigan or Illinois, I currently specify a rectangular bounding box based on the min and max latitude and longitude. This results in an enormous amount of unnecessary tiles being generated for, in the case of Michigan, Wisconsin and Canada.

If it can't be accomplished with my current tools, can I alter my process to incorporate a tool that allows me to use an irregular area?

Is there a tool I can use to trim the source OSM data to an irregular boundary? Even if I'm limited to a rectangular box when generating tiles, at least there will be no data and hopefully I get blank tiles or a single tile repeated over the areas with no data.

  • The usual trick is to use a view that maps all the "empty" (or transparent, depending on output format) tiles back to the same data. The generation is pretty cheap if there are no database hits, and the view avoids storing redundant data. – BradHards Feb 20 '15 at 22:27
  • Can you provide more dual about your suggestion? I know what a database view is but beyond that, as far as the rest of your technique, I'm lost. – DenaliHardtail Feb 20 '15 at 22:42
  • See stackoverflow.com/questions/21210333/… for a link. Short version: TileMill does this for you. – BradHards Feb 20 '15 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.