2009/12/6 Dane Springmeyer <[email protected]>:
> If you are running trunk you can do:
>
> (SELECT DISTINCT ON (name)
> way,highway,aeroway,name,ref,char_length(ref) AS length,
> ST_Length(way) AS road_len,
>      CASE WHEN bridge IN ('yes','true','1') THEN 'yes'::text ELSE
> bridge END AS bridge
>      FROM (select DISTINCT ON (name) * from planet_osm_line WHERE
> ST_Intersects(way, !bbox!)) AS bounded_lines
>      WHERE waterway IS NULL
>        AND leisure IS NULL
>        AND landuse IS NULL
>        AND (name IS NOT NULL OR ref IS NOT NULL)
>        ORDER BY name,road_len DESC
> ) as foo
>
>
> Note the 'ST_Intersects(way, !bbox!))'... if that fails either upgrade to
> latest trunk or pass ALL CAPS !BBOX!

Ok, this is great! Just upgraded to 0.7, and this is the final query
that I have used. I am well pleased :-) With this query, I get only
one label for each road, even if it is made of multiple segments. I
can select point or line placement based on the length of the way. All
I need to do now is play around with the styles to get it just right.

Thank you Dane and all mapnik contributors.

     <Parameter name="table">
       (SELECT DISTINCT ON (name)
way,highway,aeroway,name,ref,char_length(ref) AS length,
ST_Length(way) AS road_len,
           CASE WHEN bridge IN ('yes','true','1') THEN 'yes'::text
ELSE bridge END AS bridge
           FROM (select * from planet_osm_line WHERE
ST_Intersects(way, !bbox!)) AS bounded_lines
           WHERE waterway IS NULL
           AND leisure IS NULL
           AND landuse IS NULL
           AND (name IS NOT NULL OR ref IS NOT NULL)
           ORDER BY name,road_len DESC
       ) AS roads
     </Parameter>

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

Reply via email to