Collin, Check out the way OpenStreetMap generates their tiles for an example:
http://trac.openstreetmap.org/browser/applications/rendering/mapnik/generate_tiles.py -Justin - Original message - Wow, thank you Mike. This is quite a bit of info. I am ... On 5/5/08, Collin Olan <[EMAIL PROTECTED]> wrote: > Wow, thank you Mike. This is quite a bit of info. I am reading over > the Google explanation of different ways to use and represent > Coordinates. Also very interesting and useful is the Map Provider > Tutorial on the Modest Maps site about cutting up a an existing map > (The Oakland Bus Lines). > > I definitely understand the basic concept of generating the tiles. > Now, from what else I understand, and you have touched upon, one will > only generate as many tiles as are needed for any particular > application. For example, if I were making a map of Central Park, I > would generate tiles only for the park and not include the rest of the > city and beyond. And in this example, if I were to be allowing for say > 10 levels of zoom, then I would be generating 10 sets of tiles at > different resolutions for those zoom levels correct? > > Once I get a little further your XML settings for minimum / maximum > zoom levels will fit into place. > > Thank you very much, I'm sure I will have more questions but this is a > great start. > > Collin > > > On May 5, 2008, at 12:39 PM, Michal Migurski wrote: > > > Hello Collin, > > > > There's kind of a lot buried in your question. I'm also new to Mapnik, > > but I've had a lot of experience dealing with maps as a consumer for > > our Modest Maps project. A lot of my current work in tile generation > > is tuned specifically for consumption by that particular Flash-based > > library. > > > > Some short answers: generating tiles is just like generating lots of > > small images, each one covering a small square area of your projected > > world. Because there are *so many* tiles in an extensive map, it > > usually makes sense to use a caching layer and generate only those > > tiles that you need, at whatever zoom level is requested by your user. > > I'm not sure what books would be available on a topic as green as this > > one, but I did recently order Krygier's Making Maps out of curiosity > > (it hasn't shipped yet): > > http://www.amazon.com/gp/product/1593852002 > > > > Mapnik has a "render_tile_to_file()" that takes some extra parameters > > above and beyond "render_to_file" - seems relevant here, but I haven't > > been able to find a satisfactory explanation for how it works, so I'm > > ignoring it at the moment. > > > > It helps to understand how a typical slippy map divides the world into > > x, y, and z coordinates. Google and MS both have short primers here: > > http://msdn.microsoft.com/en-us/library/bb259689.aspx > > > > http://code.google.com/apis/maps/documentation/overlays.html#Google_Maps_Coordinates > > > > Once you start dealing with multiple zoom levels, you'll find that > > your style rules need minimum and maximum scale denominators, e.g.: > > <MaxScaleDenominator>100000</MaxScaleDenominator> > > <MinScaleDenominator>50000</MinScaleDenominator> > > > > Numbers that seem to work for the projection above are: > > Zoom 1, min/max: 200000000 / 500000000 > > Zoom 2, min/max: 100000000 / 200000000 > > Zoom 3, min/max: 50000000 / 100000000 > > Zoom 4, min/max: 25000000 / 50000000 > > Zoom 5, min/max: 12500000 / 25000000 > > Zoom 6, min/max: 6500000 / 12500000 > > Zoom 7, min/max: 3000000 / 6500000 > > Zoom 8, min/max: 1500000 / 3000000 > > Zoom 9, min/max: 750000 / 1500000 > > Zoom 10, min/max: 400000 / 750000 > > Zoom 11, min/max: 200000 / 400000 > > Zoom 12, min/max: 100000 / 200000 > > Zoom 13, min/max: 50000 / 100000 > > Zoom 14, min/max: 25000 / 50000 > > Zoom 15, min/max: 12500 / 25000 > > Zoom 16, min/max: 5000 / 12500 > > Zoom 17, min/max: 2500 / 5000 > > Zoom 18, min/max: 1000 / 2500 > > > > Paul Smith from Everyblock has an excellent high-level article on ALA > > that explains how Mapnik fits into a broader system for tile delivery: > > http://www.alistapart.com/articles/takecontrolofyourmaps > > > > FWIW, the decision to use OpenLayers and TileCache in Paul's write-up > > is definitely not set in stone. For a project I'm working on > > currently, I've written some of my own tile-rendering code in Python, > > and I'm serving up the imagery in a selection of Modest Maps and > > OpenLayers front ends. For the tile-rendering portion, I've been using > > a bunch of the helper classes from Modest Maps to handle coordinate > > systems and projections, specifically the Core.Coordinate class and > > Microsoft projection: > > http://modestmaps.mapstraction.com/trac/browser/trunk/py/ModestMaps > > > > OpenLayers in particular takes a bit of wrangling to act like the > > Mercator projection used by Google, Yahoo, Microsoft, and others. This > > projection looks like it's fast becoming a de facto standard for > > general web cartography. One way to get your OpenLayers map to behave > > properly is to feed these args to its constructor in a dictionary: > > > > maxExtent: new OpenLayers.Bounds(-20037508.3427892, > > -20037508.3427892, 20037508.3427892, 20037508.3427892), > > numZoomLevels: 18, > > maxResolution: 156543.0339, > > units: 'm', > > displayProjection: new OpenLayers.Projection('EPSG:4326'), > > projection: 'EPSG:900913', > > Something I'm handling at the moment is the need to overshoot your > > tile boundaries a bit when rendering, and ways to make that less of a > > hit. The general idea here is that if you have derived features that > > cross a tile boundary (for example, a really fat road whose centerline > > is on one tile, but whose width extends onto a second tile), you want > > to add some padding to your tiles to account for such features before > > cutting them back, otherwise the road will never show up on the second > > tile and your map will look wrong. OpenStreetMap renders their tiles > > in swaths of 8x8 with a 128 pixel padding to make this less of a > > performance hit, for example. > > > > I hope this braindump is helpful, I'm elbows-deep in all of this right > > now, and when I come up for air in a week or two I'll try to write all > > of this up in an article of some kind. Paul and Dominic on this list > > have been wildly helpful with installation & technical assistance. > > > > -mike. > > > > On May 5, 2008, at 7:10 AM, Collin wrote: > > > >> Hello, > >> > >> I am completely new to this stuff so please bear with me. I am just > >> teaching myself Python and Django and don't have a background in > >> programming really (I can find my way around in Javascript and spent > >> a lot of time doing Max/MSP stuff so i am not completely ignorant > >> either). > >> > >> It took me a week but I was able to get Mapnik installed properly on > >> OS X Leopard. > >> > >> I have now gone through the two short tutorials on the Mapnik Wiki > >> and am able to generate a .png of the world and alter the colors, > >> one while setting those parameters in an XML file. > >> > >> Now what? How does one generate tiles rather than one image? And for > >> that matter, is the idea to generate a set of tiles for each zoom > >> level you plan to support? Maybe I am missing some common knowledge > >> about this and if so I apologize, and ask if someone could please > >> point me to resources on this. Where does a beginner start? > >> > >> Are there any books this list could recommend on web cartography? I > >> just ordered this one, which seemed pretty good: > >> http://tinyurl.com/6m5y3b > >> > >> > >> Thanks! > > > > ---------------------------------------------------------------- > > michal migurski- [EMAIL PROTECTED] > > 415.558.1610 > > > > _______________________________________________ > > Mapnik-users mailing list > > [email protected] > > https://lists.berlios.de/mailman/listinfo/mapnik-users > > > > -- Sent from Gmail for mobile | mobile.google.com _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

