mapnik+tilecache caching problem

3 messages Options
Embed this post
Permalink
FreemanUz

mapnik+tilecache caching problem

Reply Threaded More More options
Print post
Permalink
Hello,
 We developed special XML file for Mapnik. Its working great when
we render it without Tilecache. But we have to use our map for GPS
tracking project and we have to make a cache using Tilecache. While
caching with Tilecache, some parts of some layers are missing or some
parts of lines are drawing incorrectly.  You can see it in attached
screenshots. Please tell us what is the problem here and how we can
fix it?

Thanks,
Freeman
FreemanUz

Re: mapnik+tilecache caching problem

Reply Threaded More More options
Print post
Permalink
The source code of my index.php file...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Mapnik WMS Test</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <link rel="stylesheet" href="style.css" type="text/css" />
  <style type="text/css">

    body {margin: 0px;}
    #map {
    width: 1024px;
    height: 768px;

    }
   </style>
    <script src="http://localhost/OpenLayers/lib/OpenLayers.js"></script>
    <script type="text/javascript">
         var lon = 5;
        var lat = 40;
        var zoom = 5;
        var map, layer;
 
        function init(){
            map = new OpenLayers.Map('map', {
                    controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.LayerSwitcher({'ascending':false}),
                        new OpenLayers.Control.Permalink(),
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.Permalink('permalink'),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.OverviewMap(),
                        new OpenLayers.Control.KeyboardDefaults(),
                                                new OpenLayers.Control.NavToolbar()
                    ],
                    numZoomLevels: 19

                });
                               
            layer = new OpenLayers.Layer.WMS( "maxmap", "http://localhost/tilecache21/tilecache.py?", {layers: 'maxmap', format:'image/png' }
           
                        );
                       
            map.addLayer(layer);
           
                        //KML
                        map.addLayer(new OpenLayers.Layer.GML("KML", "poi.kml",
               {
                format: OpenLayers.Format.KML,
                formatOptions: {
                  extractStyles: true,
                  extractAttributes: true
                }
               }));
             selectControl = new OpenLayers.Control.SelectFeature(map.layers[1],
                {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});
 
            map.addControl(selectControl);
            selectControl.activate();  
            map.zoomToMaxExtent();

                        map.fractionalZoom = true;
                        map.setCenter(new OpenLayers.LonLat(63, 41), 6);
        }
               
        function onPopupClose(evt) {
            selectControl.unselect(selectedFeature);
        }
               
        function onFeatureSelect(feature) {
            selectedFeature = feature;
            popup = new OpenLayers.Popup.FramedCloud("chicken",
                                     feature.geometry.getBounds().getCenterLonLat(),
                                     new OpenLayers.Size(100,100),
                                     "<div style='font-size:.8em'>"+feature.attributes.name+"<br>"+feature.attributes.description+"</div>",
                                     null, true, onPopupClose);
            feature.popup = popup;
            map.addPopup(popup);
        }
               
        function onFeatureUnselect(feature) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }
       
       
    </script>
  </head>
  <body onload="init()">
      <h2 style="position:absolute; z-index:10000; left: 100px;">Mapnik SimpleCGI as WMS Test</h2>
    <div id="map">
    </div>
    <!--<div style="font-size: small; left:10px; position:absolute; bottom: 30px; z-index:10000;overflow: auto;">
    Sample WMS Request:<br /> <input type="textarea" size= "100%" id='info'/>
    --></div>
    <div id="debug" style="font-size: large; right:10px; position:absolute; bottom: 30px; z-index:10000;"></div>
  </body>
</html>

FreemanUz wrote:
Hello,
 We developed special XML file for Mapnik. Its working great when
we render it without Tilecache. But we have to use our map for GPS
tracking project and we have to make a cache using Tilecache. While
caching with Tilecache, some parts of some layers are missing or some
parts of lines are drawing incorrectly.  You can see it in attached
screenshots. Please tell us what is the problem here and how we can
fix it?

Thanks,
Freeman
Dane Springmeyer

Re: mapnik+tilecache caching problem

Reply Threaded More More options
Print post
Permalink
In reply to this post by FreemanUz
Freeman,

My hunch would be a threading problem (http://en.wikipedia.org/wiki/Race_condition 
).

I see that your are trying to deploy TileCache within MS4W on windows  
and I read here:

http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

That the 'The Windows 'winnt' MPM' is multi-threaded by default, which  
may be what is causing the problem.

Normally, on linux you would address this by using apache 'pre-fork'  
or deploying TileCache using mod_wsgi, daemon mode, and using  
thread=1. One windows I'm not sure about the best route.

Have you tried simply pre-generating a whole cache using (the single-
threaded) 'tilecache_seed.py' script?

Dane



On Oct 5, 2009, at 11:29 PM, FreemanUz wrote:

>
> Hello,
> We developed special XML file for Mapnik. Its working great when
> we render it without Tilecache. But we have to use our map for GPS
> tracking project and we have to make a cache using Tilecache. While
> caching with Tilecache, some parts of some layers are missing or some
> parts of lines are drawing incorrectly.  You can see it in attached
> screenshots. Please tell us what is the problem here and how we can
> fix it?
>
> Thanks,
> Freeman
> --
> View this message in context: http://n2.nabble.com/mapnik-tilecache-caching-problem-tp3773400p3773400.html
> Sent from the TileCache mailing list archive at Nabble.com.
> _______________________________________________
> Tilecache mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/tilecache

_______________________________________________
Tilecache mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/tilecache