Hell Rob,

Sorry I missed responding to this earlier.

OL default settings assume EPSG:4326, so in general if your Map is in  
that projection you don't need to set maxResolution.

And if your map is in EPSG:900913 it is easiest to copy/paste from  
working examples to get the construction options needed. But of course  
understanding those variables is helpful.

I think maxResolution is calculated like:

function maxResForTileSize(tileSize){
     return map.maxExtent.getWidth()/tileSize
}

Where the default tilesize is usually 256 unless you change it.

Keep in mind that this is an OpenLayers issue and you'll get vastly  
better answers on that list. However matching up the parameters  
between TileCache and OpenLayer can be tricky for anything but the  
most common projections and searching the TileCache users mailing list  
can be helpful in that regard.

Dane


On Aug 3, 2009, at 5:10 AM, rob777 wrote:

>
> Thank you Dane,
>
> The layer is in WGS84 which I believe is EPSG:4326
>
> On this maxResolution, how is it caculated?
>
> Thank you again.
>
>
> Dane Springmeyer wrote:
>>
>> Rob,
>>
>> Your setup looks on the right track, but is incomplete at the
>> OpenLayers step.
>>
>> If you are setting up a TileCache layer using 'type=Mapnik' in
>> spherical mercator then that needs to be requested via OpenLayers  
>> with:
>>
>> 1) An OpenLayers map in the same projection and
>> 2) using an OpenLayers.Layer.TMS/OSM layer.
>>
>>
>> For #1 try something like:
>>
>> var options = {
>>     maxResolution: 156543.0339,
>>     units: 'm',
>>     projection: new OpenLayers.Projection("EPSG:900913"),
>>     maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
>> 20037508.34, 20037508.34)
>>     };
>>
>> map = new OpenLayers.Map("map", options);
>>
>> and for # 2 do:
>>
>> var tad_tms = new OpenLayers.Layer.TMS("TileCache Mapnik
>> Layer","http://localhost/tilecache.py?
>> ",
>>                 { serviceVersion: "1.0.0", layername: "tad",  type:
>> "png" });
>> map.addLayer(tad_tms);
>>
>> I would keep it simple for your TileCache.cfg at first and pair that
>> OpenLayers map request with a tilecache config like:
>> [tad]
>> type=Mapnik
>> mapfile=C:\data_dir\data\shapefiles\tad.xml
>> spherical_mercator=true
>> Dane
>> On Aug 1, 2009, at 5:12 AM, rob777 wrote:
>>
>>>
>>> I hope someone can help.
>>>
>>> I have Mapnik up and all examples are working.
>>>
>>> I have Tilecache up and it's example is working.
>>>
>>> When trying to get the two to work it fails.
>>>
>>> Can some one please tell us or point us to documentation on the
>>> proper way
>>> to use these two togeather.
>>>
>>> My tilecache.cfg looks like this.
>>> [tad]
>>> type=mapnik
>>> mapfile=C:\data_dir\data\shapefiles\tad.xml
>>> extension=png
>>> metaTile=yes
>>> spherical_mercator=true
>>> tms_type=google
>>>
>>> My OpenLayers Looks like this.
>>> <script type="text/javascript">
>>>       <!--
>>>       var map, layer;
>>>
>>>       function init(){
>>>           map = new OpenLayers.Map( $('map'), {'maxResolution':
>>> 360/512});
>>>           layer = new OpenLayers.Layer.WMS( "mapnik",
>>>                   "tilecache.py?", {layers: 'tad', format: 'image/
>>> png' }
>>> );
>>>           map.addLayer(layer);
>>>           map.addControl(new OpenLayers.Control.Permalink());
>>>           if (!map.getCenter()) map.zoomToMaxExtent();
>>>       }
>>>       // -->
>>>   </script>
>>>
>>>
>>> Any help is appreciated.
>>>
>>> Thanks,
>>> Rob
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Mapnik-%2B-Tilecache-%2B-OpenLayers-tp24768564p24768564.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
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Mapnik-%2B-Tilecache-%2B-OpenLayers-tp24768564p24789660.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

Reply via email to