Mapnik from database slower than from shapefile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mapnik from database slower than from shapefile

caneta
Hi everyone.
I have the following xml file to use with OSM script generate_tiles.py:

<!DOCTYPE Map [
<!ENTITY srs900913 "+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">

<!ENTITY datasource_shp "<Datasource><Parameter name='type'>shape</Parameter><Parameter name='file'>myshape</Parameter><Parameter name='estimate_extent'>true</Parameter></Datasource>">

<!ENTITY datasource_psq "<Datasource><Parameter name='table'>(select lbtyp,the_geom from salzburg) as stuff</Parameter><Parameter name='type'>postgis</Parameter><Parameter name='password'>mypwd</Parameter><Parameter name='host'>localhost</Parameter><Parameter name='port'>5433</Parameter><Parameter name='user'>myusr</Parameter><Parameter name='dbname'>salzburg</Parameter></Datasource>">
]>

<Map srs="&srs900913;" minimum-version="0.7.2">
    <Style name="building">
        <Rule>
            <Filter>[lbtyp] = 1</Filter>
            <PolygonSymbolizer fill="#dd0000"/>
        </Rule>
    </Style>
    <Style name="otherConstructedAreas">
        <Rule>
            <Filter>[lbtyp] = 2</Filter>
            <PolygonSymbolizer fill="#fef8a9"/>
        </Rule>
    </Style>
    <Style name="dwarfShrubs">
        <Rule>
            <Filter>[lbtyp] = 3</Filter>
            <PolygonSymbolizer fill="#aafea9"/>
        </Rule>
    </Style>
    <Style name="bareSoil">
        <Rule>
            <Filter>[lbtyp] = 4</Filter>
            <PolygonSymbolizer fill="#dac6a3"/>
        </Rule>
    </Style>
    <Style name="reed">
        <Rule>
            <Filter>[lbtyp] = 5</Filter>
            <PolygonSymbolizer fill="#ffff00"/>
        </Rule>
    </Style>
    <Style name="surfaceWater">
        <Rule>
            <Filter>[lbtyp] = 6</Filter>
            <PolygonSymbolizer fill="#0000ff"/>
        </Rule>
    </Style>
    <Style name="trees">
        <Rule>
            <Filter>[lbtyp] = 9</Filter>
            <PolygonSymbolizer fill="#018700"/>
        </Rule>
    </Style>
    <Style name="bushes">
        <Rule>
            <Filter>[lbtyp] = 10</Filter>
            <PolygonSymbolizer fill="#97b234"/>
        </Rule>
    </Style>
    <Style name="greenVegetation">
        <Rule>
            <Filter>[lbtyp] = 12</Filter>
            <PolygonSymbolizer fill="#00ff00"/>
        </Rule>
    </Style>


    <Layer name="building" status="on" srs="&srs900913;">
        <StyleName>building</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="otherConstructedAreas" status="on" srs="&srs900913;">
        <StyleName>otherConstructedAreas</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="dwarfShrubs" status="on" srs="&srs900913;">
        <StyleName>dwarfShrubs</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="bareSoil" status="on" srs="&srs900913;">
        <StyleName>bareSoil</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="reed" status="on" srs="&srs900913;">
        <StyleName>reed</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="surfaceWater" status="on" srs="&srs900913;">
        <StyleName>surfaceWater</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="trees" status="on" srs="&srs900913;">
        <StyleName>trees</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="bushes" status="on" srs="&srs900913;">
        <StyleName>bushes</StyleName>
        &datasource_shp;
    </Layer>
    <Layer name="greenVegetation" status="on" srs="&srs900913;">
        <StyleName>greenVegetation</StyleName>
        &datasource_shp;
    </Layer>
</Map>

I can produce the same tiles giving in input the shapefile or the database parameters...but with the database it is something like 20 times slower (shapefile and database are both on my machine).
Can you tell me why?

Thanks in advance.