Hi,
Since it seems like you're doing this all in Python, can I recommend
the Python port of Modest Maps?
http://modestmaps.com/
http://modestmaps.mapstraction.com/trac/browser/trunk/py
I use Modest Maps as a crutch in 99% of my Mapnik work, most of the
time for tile-based applications. I've found it easier to work at the
powers-of-two zoom levels common among slippy maps with a library
that's tile-aware and includes built-in support for OSM, Google, etc.
For example, I might use the mapBy* functions in the ModestMaps module
to generate (but not render) maps with specific characteristics: zoom
levels, dimensions, coverage etc. I'm guessing one of these two is
appropriate for your city map:
mapByExtent, if you want a map of a specific size
http://modestmaps.mapstraction.com/trac/browser/trunk/py/ModestMaps/__init__.py#L100
mapByExtentZoom, if you want a map at a specific resolution
http://modestmaps.mapstraction.com/trac/browser/trunk/py/ModestMaps/__init__.py#L107
Then I can use the dimensions and pointLocation() method of the
resulting map object to determine what envelope to feed to Mapnik
based on top left and bottom right corners of the map.
-mike.
On Oct 26, 2008, at 10:56 PM, Dane Springmeyer wrote:
> Hi Steve,
>
> I don't feel like you are overlooking anything simple. I've been
> wondering about this issue as well.
>
> As you are finding, map.scale() only gives you the current map scale
> rather than accepting an argument.
>
> I occasionally use map.zoom(factor) to effectively zoom in and out,
> but only after setting an appropriate bounding box with zoom_to_box().
>
> Mapnik does not have any built in function to zoom to a given level
> because it depends on the projection.
>
> For some hints on further understanding the google mercator based zoom
> levels, check out the code in the 'generate_tiles.py' script for a
> start: http://svn.openstreetmap.org/applications/rendering/mapnik
>
> Hope that helps a bit,
>
> Dane
>
>
>
> On Oct 22, 2008, at 6:25 AM, Stephen Baker wrote:
>
>>
>> Hi everyone,
>>
>> I am working with Mapnik to render a series of New York City
>> shapefiles. I
>> have a few questions - apologies in advance if I am overlooking
>> something
>> simple.
>>
>> 1. I would like to output an image of an entire shapefile (a city
>> map)
>> scaled to a Google Maps zoom/scale level. (For example zoom level=8
>> scale_denom=2183915.09386). How do I plug in this value? I am
>> familiar
>> with map.zoom_to_box(bounding_box), map.zoom_all(), and
>> map.zoom(factor). I
>> see map.scale(...) in the documentation and can't figure out the
>> required
>> parameters to get this to work - I know that map.scale() gets the
>> scale -
>> but is there a way to set the scale with map.scale(..)?
>>
>> Thanks,
>>
>> Steve
>> --
>> View this message in context:
>> http://www.nabble.com/Output-image-with-Scale-Denominator-tp20110669p20110669.html
>> Sent from the Mapnik - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Mapnik-users mailing list
>> [email protected]
>> https://lists.berlios.de/mailman/listinfo/mapnik-users
>
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users
>
----------------------------------------------------------------
michal migurski- [EMAIL PROTECTED]
415.558.1610
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users