David, if your Mapnik Map srs is Spherical Mercator (which it looks to be) then 
you need to pass spherical coordinates to map.zoom_to_box().

A good way to confirm this is to call map.zoom_all() then print out the value 
for map.envelope() and see that the coordinates are in spherical mercator. If 
you need help converting see: 
http://mapnik-utils.googlecode.com/svn/example_code/google_mercator_projection/world_mercator.py

Dane

On Feb 15, 2011, at 9:47 AM, David Wiesen wrote:

> Hi Dane,
> 
> Thanks for the response.  Unfortunately this doesn't seem to solve my issue.  
> In fact
> when I specify epsg:4326 my tiles come up empty (meaning none of the shapes in
> my shapefile appear in the tiles)
> 
> For the tile I have been testing with, the details are
> 
> 256x256 map, using the xml file and shapefile I attached.
> bounding box =  
> Envelope(-122.183074951,37.4770377967,-122.18170166,37.4781276287)
> 
> there are a number of shapes in my shapefile that should fall within that 
> bounding box
> (when I load my shapefile into Google earth, they do) but the outputted image 
> is just
> a transparent square.
> 
> Thanks
> David
> 
> 
> 
> On Mon, Feb 14, 2011 at 9:09 PM, Dane Springmeyer <[email protected]> wrote:
> David,
> 
> If you do not provide an 'srs' value for a <Layer ..> in your Mapnik XML then 
> the srs will be inherited from the <Map ..> 'srs'. In your case your Map is 
> correctly in Spherical Mercator but your data looks to be in WGS84, or 
> EPSG:4326. So, try changing your layer entry to look like:
> 
>   <Layer name="plots" srs="+init=epsg:4326" status="on">
> 
> When I do this things appear correctly when overlaid on top of OSM tiles 
> (when rendered with TileLite).
> 
> It appears like your data is at: 
> http://tile.openstreetmap.org/17/21050/50798.png
> 
> Dane
> 
> 
> On Feb 14, 2011, at 3:22 PM, David Wiesen wrote:
> 
>> When you say generate_tiles.py, do you mean this?
>> 
>> http://svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
>> 
>> When I generate the tiles myself, the lat/long calculations are correct 
>> (well, 
>> they match what I see here 
>> http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/)
>> 
>> but it appears that the actual shapes from the shapefile don't match up with 
>> the base map
>> provided by Google once the shapes are projected onto the png file.
>> 
>> Thanks,
>> David
>> 
>> On Mon, Feb 14, 2011 at 3:15 PM, M∡rtin Koppenhoefer 
>> <[email protected]> wrote:
>> I suggest you use generate_tiles.py and modify it. It will create
>> tiles at the same position and zoom levels then google maps.
>> 
>> cheers,
>> Martin
>> 
>> _______________________________________________
>> 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

Reply via email to