On 28 Mar 2008, at 16:37, Tom Chance wrote:
> On 28 March 2008 at 15:54 Artem Pavlenko wrote:
>> On 28 Mar 2008, at 15:29, Tom Chance wrote:
>>> I'd like to show symbols in the center of certain areas, like the
>>> parking symbols in OpenStreetMap:
>>> http://www.openstreetmap.org/?
>>> lat=51.46993&lon=-0.06831&zoom=16&layers=B
>>> 0FT
>>>
>>> It's not immediately obvious to me how this is achieved, looking at
>>> the style sheet:
>>> http://svn.openstreetmap.org/applications/rendering/mapnik/osm.xml
>>
>>> Can anyone enlighten me?
>>>
>>
>> You should be able to use PointSymbolizer/TextSymbolizer/
>> ShieldSymbolizer for polygons. Positions are simply centroids atm:
>> ....
>> <Rule>
>> <MaxScaleDenominator>20000</MaxScaleDenominator>
>> <Filter>[amenity]='parking'</Filter>
>> <PointSymbolizer file="parking.png" type="png" width="16"
>> height="16" allow_overlap="false"/>
>> </Rule>
>> ...
>>
>> In OSM there is an extra step (I think) in osm2pgsql to
>> extract centroids and put them into separate layer.
>
> OK, thanks, so I need to duplicate the add_parking_node function for
> other areas, or make it more generic so it works for several different
> features? For example power=generator, leisure=sports_centre and so
> on?
Try using PointSymbolizer on polygons first, it should work.
>
> I'm not a C hacker but I'll play around a bit with this part of
> output-pgsql.c from osm2pgsql:
>
> void add_parking_node(int id, struct keyval *tags, double node_lat,
> double node_lon)
> {
> // insert into planet_osm_point(osm_id,name,amenity,way) select
> osm_id,name,amenity,centroid(way) from planet_osm_polygon where
> amenity='parking';
> const char *access = getItem(tags, "access");
> const char *amenity = getItem(tags, "amenity");
> const char *name = getItem(tags, "name");
> struct keyval nodeTags;
>
> if (!amenity || strcmp(amenity, "parking"))
> return;
>
> // Do not add a 'P' symbol if access is defined and something
> other than public.
> if (access && strcmp(access, "public"))
> return;
>
> initList(&nodeTags);
> addItem(&nodeTags, "amenity", amenity, 0);
> if (name)
> addItem(&nodeTags, "name", name, 0);
> if (access)
> addItem(&nodeTags, "access", access, 0);
>
> pgsql_out_node(id, &nodeTags, node_lat, node_lon);
> resetList(&nodeTags);
> }
>
> Kind regards,
> Tom
>
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users