Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putting buildingparts to dev #12

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions queries/buildingslite-z16.pgsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SELECT
name,

(CASE WHEN building != 'yes' THEN building ELSE NULL END) AS kind,
building,

-- strip commas from heights (TODO: may need to strip other characters and/or do unit conversions)
-- multiply by 100 and force int becuase that's what OpenScienceMap expects
(TO_NUMBER(REPLACE(height, ',', '.'), '999999D99S') * 100)::int AS height,

way AS __geometry__

FROM
planet_osm_polygon

WHERE
building IS NOT NULL
AND ST_Area(way) > 25 -- 4px
36 changes: 36 additions & 0 deletions queries/buildingslite-z17.pgsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SELECT
name,

(CASE WHEN COALESCE("building:part", building) != 'yes' THEN COALESCE("building:part", building) ELSE NULL END) AS kind,
COALESCE("building:part", building) AS building,
"building:part" AS building_part,

-- strip commas from heights (TODO: may need to strip other characters and/or do unit conversions)
-- multiply by 100 and force int becuase that's what OpenScienceMap expects
(TO_NUMBER(REPLACE(height, ',', '.'), '999999D99S') * 100)::int AS height,
(TO_NUMBER(REPLACE(min_height, ',', '.'), '999999D99S') * 100)::int AS min_height,

way AS __geometry__

FROM
planet_osm_polygon AS building_outer

WHERE
(building IS NOT NULL OR "building:part" IS NOT NULL)

-- building "shells" that enclose building parts should not be rendered
AND NOT (
building_outer.building IS NOT NULL
AND building_outer."building:part" IS NULL
AND EXISTS (
SELECT
building_part_inner.osm_id
FROM
planet_osm_polygon AS building_part_inner
WHERE
building_part_inner.osm_id != building_outer.osm_id
AND building_part_inner."building:part" IS NOT NULL
AND ST_Intersects(building_outer.way, building_part_inner.way)
LIMIT 1
)
)
7 changes: 4 additions & 3 deletions tilestache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
null, null, null, null,
null, null, null, null,
null, null, null, null,
null,

"queries/buildings-z13.pgsql",
"queries/buildings-z14.pgsql",
Expand Down Expand Up @@ -217,9 +218,9 @@
null, null, null, null,
null, null, null, null,
null, null, null, null,
null, null, null,
"queries/buildings-z16.pgsql",
"queries/buildings-z17.pgsql"
null, null, null, null,
"queries/buildingslite-z16.pgsql",
"queries/buildingslite-z17.pgsql"
]
}
}
Expand Down