[Tilecache] completing basic tutorial

Chang, Elizabeth Elizabeth.Chang at noblis.org
Tue Jun 9 10:24:40 EDT 2009


Hi, sorry if this is a double post. I was not subscribed to the list
before and I don't think my previous message went through.

 

 I'm just trying to do something basic, which is set up openlayers,
tilecache and mapnik on my laptop and show the world_boundaries.shp
which is available on the mapnik tutorials page. All I am getting are
pink tiles.

 

I installed Tilecache and mapnik using instructions here:

 

http://oegeo.wordpress.com/2008/03/08/the-5-minute-guide-to-setting-up-t
ilecache-on-windows/

 

Everything worked fine to this step.

 

Then I ran the mapnik tutorial 2 which is making a png file out of the
world_borders.shp file using the xml file and python commands.

This step ran ok too and I saw the png which had the world boundaries.

 

Then I tried to run this world_styles.xml file through tilecache and
this is where I am having trouble. The error I am getting is "An error
occurred: No module named mapnik" but I did install mapnik and I can to
import mapnik as well as successfully complete mapnik tutorial 2.

 

World_styles.xml

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE Map>

<Map bgcolor="steelblue" srs="+proj=latlong +datum=WGS84">

 

  <Style name="My Style">

    <Rule>

      <PolygonSymbolizer>

        <CssParameter name="fill">#f2eff9</CssParameter>

      </PolygonSymbolizer>

      <LineSymbolizer>

        <CssParameter name="stroke">rgb(50%,50%,50%)</CssParameter>

        <CssParameter name="stroke-width">0.1</CssParameter>

      </LineSymbolizer>

    </Rule>

  </Style>

 

  <Layer name="world" srs="+proj=latlong +datum=WGS84">

    <StyleName>My Style</StyleName>

    <Datasource>

      <Parameter name="type">shape</Parameter>

      <Parameter
name="file">C:\RasmasTilecache\world_borders\world_borders.shp</Paramete
r>

    </Datasource>

  </Layer>

</Map>

 

Tilecache.cfg:

[basic]

type=MapnikLayer

mapfile=C:\RasmasTilecache\world_styles.xml

maxResolution=0.703125

bbox=-180.0,-90,180,90

 

Html file:

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>

    <style type="text/css">

        #map {

            width: 512px;

            height: 256px;

            border: 1px solid black;

        }

                body {

                  padding:0px; 

                  margin:2px

                }

                #labs {

                 position:absolute;

                 bottom:15px;

                 left:7px;

                 font-size:smaller;

                 z-index: 5000;

        }      

    </style>

    <script src="http://openlayers.org/api/OpenLayers.js"></script>

    <script type="text/javascript">

        <!--

        var map, layer;

//360/512

        function init(){

            map = new OpenLayers.Map( $('map'), {

 
'maxResolution': 0.703125,

 
maxExtent: new OpenLayers.Bounds(-180,-90,180,90)

                                                                });

            layer = new OpenLayers.Layer.WMS( "VMap0", 

                    "cgi-bin/tilecache.cgi?", {layers: 'basic', format:
'image/png' } ,

 
{

 
maxResolution: 0.703125,

 
maxExtent: new OpenLayers.Bounds(-180,-90,180,90)

 
});

            map.addLayer(layer);

            map.addControl(new OpenLayers.Control.Permalink());

                                                map.zoomToExtent(

                new OpenLayers.Bounds(

                    -180,-90,180,90

                ));

            //if (!map.getCenter()) map.zoomToMaxExtent();

        }

        // -->

    </script>

  </head>

  <body onload="init()">

    <div id="map">

    <div id="labs">From <a href="http://labs.metacarta.com/">MetaCarta
Labs</a>.</div>

    </div>

  </body>

</html>

 

 

Thanks so much!

 

-Elizabeth Chang

Lead

Noblis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/tilecache/attachments/20090609/b70819d6/attachment.html


More information about the Tilecache mailing list