[Tilecache] mapnik+tilecache caching problem
FreemanUz
ozodbekulmasov at gmail.com
Tue Oct 6 02:35:21 EDT 2009
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>
/* var map, world, wms, kml, ia_wms;
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
});
wms = new OpenLayers.Layer.WMS("Mapnik
WMS","http://localhost/cgi-bin/mapnikserv.py?",
{map:'F:/ms4w/Apache/htdocs/mapnik/maxmap/maxtrackmap.xml', mode: 'view',
format:'image/png256'} );
ia_wms = new
OpenLayers.Layer.WMS("Nexrad","http://localhost/cgi-bin/mapnikserv.py?",{map:'F:/ms4w/Apache/htdocs/mapnik/maxmap/poi.xml',transparent:true,
mode: 'view', format:'image/png256'} );
kml = new OpenLayers.Layer.GML("KMLPOINT", "poi.kml", { format:
OpenLayers.Format.KML, formatOptions: { extractStyles: false,
extractAttributes: true, maxDepth: 2 } }); */
/* map.addControl(selectControl);
selectControl.activate();
selectControl = new
OpenLayers.Control.SelectFeature( kml,
{onSelect: onFeatureSelect,
onUnselect: onFeatureUnselect}); */
/*
kml1 = new OpenLayers.Layer.GML("KMLPOINT", "poi.kml", { format:
OpenLayers.Format.KML, formatOptions: { extractStyles: true,
extractAttributes: true, maxDepth: 2 } });
var styleMapLabelZoom;
function set_styleMapLabelZoom()
{
var context = {
getFontSize : function(){
var diffZ = map.getZoom() - 14;
return diffZ > 0 ? 7 + 3*diffZ +"px" : "0px";
},
getName : function (ft){
return ft.attributes.name;
}
};
var template = {
strokeColor: "#0000FF",
strokeOpacity: 1,
strokeWidth: 3,
fillColor: "#00AAFF",
fillOpacity: 1,
pointRadius: 5,
pointerEvents: "visiblePainted",
label : "${getName}",
labelOffsetX: "10",
labelOffsetY: "-10",
fontColor: "red",
fontSize: "${getFontSize}",
fontFamily: "Arial",
fontWeight: "bold",
labelAlign: "bt"
};
styleMapLabelZoom = new OpenLayers.StyleMap(new
OpenLayers.Style(template, {context:context}) );
}
set_styleMapLabelZoom();
kml.styleMap=styleMapLabelZoom;
kml.redraw();
map.addLayers([wms, ia_wms, kml1, kml]);
map.fractionalZoom = true;
map.setCenter(new OpenLayers.LonLat(63, 41), 6);
//map.zoomToMaxExtent();
var bounds = map.layers[0].getGridBounds();
var bbox = bounds.left + ',' + bounds.top + ',' + bounds.right +
',' + bounds.bottom;
$('debug').innerHTML = ' ' +
wms.getFullRequestString({bbox:bbox, width:'500',
height:'300'}).replace('view','debug') + ' Debug WMS Layer ';
}
*/
</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
>
--
View this message in context: http://n2.nabble.com/mapnik-tilecache-caching-problem-tp3773400p3773412.html
Sent from the TileCache mailing list archive at Nabble.com.
More information about the Tilecache
mailing list