From 4f0efb6c1a4a7609aa6ad62beaec9811b955db27 Mon Sep 17 00:00:00 2001 From: Komzpa Date: Sun, 6 Nov 2011 16:30:38 +0200 Subject: [PATCH] Support for nicer housenumber rotation --- src/komap.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/komap.py b/src/komap.py index bf04b39..c68435b 100644 --- a/src/komap.py +++ b/src/komap.py @@ -698,8 +698,8 @@ if options.renderer == "mapnik": ST_Translate( ST_Rotate( ST_GeomFromEWKT('SRID=900913;LINESTRING(-50 0, 50 0)'), - -1*ST_Azimuth(ST_PointN(ST_ShortestLine(l.way, h.way),1), - ST_PointN(ST_ShortestLine(l.way, h.way),2) + -1*ST_Azimuth(ST_PointN(ST_ShortestLine(l.way, ST_PointOnSurface(h.way)),1), + ST_PointN(ST_ShortestLine(l.way, ST_PointOnSurface(h.way)),2) ) ), ST_X(ST_PointOnSurface(ST_Buffer(h.way,0.1))), @@ -710,7 +710,31 @@ if options.renderer == "mapnik": as way from planet_osm_line l where - l.way && ST_Expand(h.way, 300) and + l.way && ST_Expand(h.way, 600) and + l."name" = h."addr:street" and + l.highway is not NULL and + l."name" is not NULL + order by ST_Distance(ST_Buffer(h.way,0.1), l.way) asc + limit 1 + ), + (select + ST_Intersection( + ST_Translate( + ST_Rotate( + ST_GeomFromEWKT('SRID=900913;LINESTRING(-50 0, 50 0)'), + -1*ST_Azimuth(ST_PointN(ST_ShortestLine(l.way, ST_PointOnSurface(h.way)),1), + ST_PointN(ST_ShortestLine(l.way, ST_PointOnSurface(h.way)),2) + ) + ), + ST_X(ST_PointOnSurface(ST_Buffer(h.way,0.1))), + ST_Y(ST_PointOnSurface(ST_Buffer(h.way,0.1))) + ), + ST_Buffer(h.way,20) + ) + as way + from planet_osm_polygon l + where + l.way && ST_Expand(h.way, 600) and l."name" = h."addr:street" and l.highway is not NULL and l."name" is not NULL