I want to place river names in Tilemill. I use "text-dy" to displace label from the center line of a river. But for labeling polygonal rivers, names extracted from lines are used too. So at a small zoom, labels of polygon rivers crawl over river's banks (see attachment_1).
ST_intersects to exclude from the selection linear rivers being intersected by polygonal ones, and not to displace labels for them:
( SELECT way,name, FROM planet_osm_line WHERE waterway IN ('river','canal') AND name IS NOT NULL AND ST_Intersects(way,( SELECT ST_Collect(way) FROM planet_osm_polygon WHERE waterway = 'riverbank' AND way && !bbox!)) ) AS riv_center
It runs sucessfully, but there are some other problem: line rivers, falling into polygon ones, have short intersection with them and are labelled too (see attachment_2). Maybe one can specify some tolerance for intersection to exclude all line rivers from selection?
Thanks in advance.