[Tilecache] mapnik + tilecache + openlayers

kryptonite paschatap at gmail.com
Tue May 19 09:22:41 EDT 2009


Thanks Dane for making an effort. I will definitely give it a try.
   About resolution and the bbox which I was to include in this post later,
honestly, I am still confused. for the bbox , I use arcgis to get the
bounds, but this in this example, I used the initial extent of the map in
'master' spherical Mercator in the python script:
projectionm.zoom_to_box(Envelope(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)) 

   And resolution , I am at the mercy of a formula that came in one of the
posts..

faktor
inches        1
ft           12
mi        63360
m            39,3701
km        39370,1
dd      4374754
in            1
 
dpi       72                  

for e.g 
scales: [4000000, 2000000, 1000000, 500000, 250000, 125000, 62500]
Resolution = Scale / ( dpi * factor )
Resolution = 4000000 / ( 72 * 4374754  ) = 0.012699

so in my case, I used 39.3701 for the factor. I started using this since
this was the simplest one that I had come across among the many solutions
that were proposed and it did work while I was trying out with
tilecache+openlayers+mapserver. Please do suggest a better method if you
have one in hand. 

    Once again, thanks for your help.

   






Dane Springmeyer wrote:
> 
> 
> On May 18, 2009, at 1:02 PM, kryptonite wrote:
> 
>>
>> Hi,
>>   I have been trying for the past few days to get a simple map to  
>> display
>> with mapnik+tilecache+openlayers. I have installed mapnik , and got  
>> the
>> default rundemo.py running , map.xml being one that was generated.  
>> the image
>> files were generated too like the documentation on mapnik says.
> 
> Great, keep in mind however that those shapefiles that come with the  
> 'rundemo.py' are in a fairly unique lambert projection. It may be  
> easier to try to start with the XML from
> http://trac.mapnik.org/wiki/XMLGettingStarted 
>   that works with a world borders shapefile in EPSG 4326.
> 
> 
>> I have also
>> successfully displayed a map using openlayers and tilecache but this  
>> time
>> was with mapserver.
>>   But coming to the main problem which is using
>> tilecache+openlayers+mapnik. Now all i did in the tilecache.cfg was  
>> include
>> a layer like this:
>>
>> [testlayer]
>> type=Mapnik
>> mapfile=C:\mapnik_0_6_0\demo\python\map.xml
>> bbox=-8024477.28459,5445190.38849,-7381388.20071,5662941.44855
>> maxResolution=2545.4906698
>> extent_type=loose
>> srs=EPSG:900913
>>
> 
> One problem here is that the TileCache Mapnik layer does not respect  
> the 'srs' parameter. We need to add this support in the future. In the  
> meantime you need to specify the projection with the 'projection'  
> parameter and the epsg 900913 proj4 literal as the value:
> 
> [test]
> type=Mapnik
> mapfile=/path/to/mapfile.xml
> projection= +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
> +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over
> # bbox for global extent of epsg 900913
> bbox=-20037508.34, -20037508.34, 20037508.34, 20037508.34
> 
> Also, how are you coming up with the maxRes and bbox?
> 
> Dane
> 
> 
> _______________________________________________
> Tilecache mailing list
> Tilecache at openlayers.org
> http://openlayers.org/mailman/listinfo/tilecache
> 
> 

-- 
View this message in context: http://n2.nabble.com/mapnik-%2B-tilecache-%2B-openlayers-tp2935333p2939485.html
Sent from the TileCache mailing list archive at Nabble.com.




More information about the Tilecache mailing list