Torsten,

On Apr 28, 2009, at 9:14 PM, Torsten Mohr wrote:

> Hello,
>
> i tried to display a country in a different color based on the  
> example at:
>
> http://trac.mapnik.org/wiki/XMLGettingStarted
>
> I tried applying a different color for some countries:
>
>      <Filter>[POP2005] &gt; 60000</Filter>
>      <PolygonSymbolizer>
>        <CssParameter name="fill">#ffcfc9</CssParameter>
>      </PolygonSymbolizer>
>

Yes, this filter will work as long as the countries are not  
__already__ filtered by a previous rule.

> This should match for nearly every country, but the color shown is  
> not what
> i expect.
>
> I'm not sure what's wrong, if POP2005 is contained in the this source:
> <Parameter name =
> "file">/usr/share/mapnik/world_boundaries/shoreline_300</Parameter>
>

Whats wrong is that you need to use a Shapefile with the population  
attribute (specifically a field/column named POP2005) which is found  
in the sample data linked to in the tutorial but NOT in the  
'shorefline_300' shapefile.

It is this shapefile that has that attribute:

http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip

> Also, a filter like [name]='Germany' would be great, but i'm not  
> sure how
> to formulate it (use 'name'?  Or 'country'?  Or something different?
> Match it to 'Germany'?  Or 'Deutschland'?)

It depends on your data. The above shapefile does have a NAME field  
and lists it as 'Germany'

I checked that on a GeoDjango Demo site that displays the attributes  
of this same shapefile:

http://geoadmin.dbsgeo.com/databrowse/world/worldborders/objects/72/

But the easiest thing is to just download the shapefile and open in  
Quantum GIS.

>
> Can anybody give me a hint on how to proceed best or how to
> formulate the filters / rules?
>

You can also use Mapnik to introspect the shapefile, but the interface  
in Python is a bit hidden. I've just been working on this in trunk,  
however, so if you build Mapnik trunk you can do something like the  
example here:

(which loops through various countries and applies a highlighted style)

http://mapnik-utils.googlecode.com/svn/example_code/map_sequences/run.py

Cheers,

Dane

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to