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!

Dane


On Dec 6, 2009, at 3:38 PM, Philip Stubbs wrote:

> 2009/12/6 Philip Stubbs <[email protected]>:
>> I am inching forward here. My road text layer now uses the following
>> SELECT statement
>>
>>      <Parameter name="table">
>>      (SELECT 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 planet_osm_line
>>       WHERE waterway IS NULL
>>         AND leisure IS NULL
>>         AND landuse IS NULL
>>         AND (name IS NOT NULL OR ref IS NOT NULL)
>>         ORDER BY road_len DESC
>>      ) AS roads
>>      </Parameter>
>>
>> Now the road_len allows me to create a rule that selects point
>> placement when the road gets too short. Great! Now I still have a
>> problem where I have a residential road that has side branches with
>> the same name. It seems to me that there should be a way to adjust
>> that select statement to give me only one of each name. Any ideas?
>
> Another step closer. I have started playing with psql and have found
> that the following sort of works:
>
> 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 planet_osm_line
>       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
>
> The problem now is that it is really slow, and I guess it is looking
> at the entire database for distinct names, not just the area I am
> rendering. Any suggestions on how I can limit the area considered by
> my query?
>
> -- 
> Philip Stubbs
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

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

Reply via email to