26 June 2009

Mapnik need to know postgis column type

Mapnik need to know postgis column type to render properly. This mapnik xml for style not working for me.


<Style name="jalan_casing2">
<Rule>
<Filter>[jenis] = 'lebuhraya'</Filter>
<MaxScaleDenominator>&maxscale_zoom7;</MaxScaleDenominator>
<MinScaleDenominator>&minscale_zoom7;</MinScaleDenominator>
<LineSymbolizer>
<CssParameter name="stroke">#808080</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Layer name="jalan_lebuhraya" srs="+proj=latlong +datum=WGS84" status="on">
<StyleName>jalan_casing2</StyleName>
<StyleName>jalan_fill</StyleName>
<StyleName>jalan_text</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="password"></Parameter>
<Parameter name="host">localhost</Parameter>
<Parameter name="port">5432</Parameter>
<Parameter name="user">helmi</Parameter>
<Parameter name="dbname">road</Parameter>
<Parameter name="table">(select * no_jalan, 'lebuhraya' as jenis, the_geom from jalanraya.lebuhraya) as jalan</Parameter>
<Parameter name="estimate_extent">false</Parameter>
<Parameter name="extent">-180,-90,180,89.99</Parameter>
</Datasource>
</Layer>


My workaround (only tested on Ubuntu Jaunty) is cast the new column as varchar.

(select * no_jalan, 'lebuhraya'::varchar as jenis, the_geom from jalanraya.lebuhraya) as jalan


Mapnik is better than MapGuide when rendering road labels

OptimizeRenderingWithPostGIS
Post a Comment