On Jun 2, 2010, at 5:42 PM, Firmin,Mark [Ontario] wrote:

> Hello All,
> 
> I am relatively new when using mapnik.  I have had some experience generating 
> imagery, but am having trouble making maps with the correct bounding box.  It 
> seems when I use generate_image.py to create a specific image with a  
> bounding box I am getting a slightly different map.  After you use the 
> command zoom-to-box() function does the bounding box change and if so how can 
> I find out the new bounding box?
> 
> Thanks,
> Mark 
> P.S. I am trying to great a geo-referenced tiff.
> 
Hi Mark,

Yes, if the aspect ratio (dimensions) don't match the bbox, the bbox is 
adjusted accordingly. If you'd rather have the reverse happen, that's 
reasonable and you can do it by settings a property on the mapnik.Map object in 
python. I think what you are after is:

m = mapnik.Map(width,height)
m.aspect_fix_mode = mapnik.aspect_fix_mode.GROW_CANVAS

(all the varied options are here: 
http://media.mapnik.org/api_docs/python/mapnik._mapnik.aspect_fix_mode-class.html)

I've been meaning to expose this option in nik2img, which supports generating a 
world file, and in turn creating a georeferenced tiff.

I've not yet gotten to that, but you might benefit from checking out the python 
code from nik2img to achieve what you need within your python script.

See the `to_wld` function (which is effectively a method off the mapnik.Map 
object using injectors) here:

http://mapnik-utils.googlecode.com/svn/trunk/nik2img/mapnik_utils/metaclass_injectors.py

Simply doing:

>>> import metaclass_injectors

will magically make m.to_wld() available, but  you can also just rip that 
function out.

Dane
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to