Skip to content

Commit

Permalink
base placename direction parameter on geometry so that it is consist…
Browse files Browse the repository at this point in the history
…ent across metatiles
  • Loading branch information
nebulon42 committed Oct 10, 2016
1 parent 3f412cb commit 6d56aca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n name,\n CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER ELSE 0\n END as population,\n round(random()) AS dir\n FROM planet_osm_point\n WHERE capital = 'yes'\n AND admin_level = '2'\n ORDER BY population DESC\n) AS capital_names",
"table": "(SELECT\n way,\n name,\n CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER ELSE 0\n END as population,\n round(ascii(md5(osm_id::text)) / 55) AS dir -- base direction factor on geometry to be consistent across metatiles\n FROM planet_osm_point\n WHERE capital = 'yes'\n AND admin_level = '2'\n ORDER BY population DESC\n) AS capital_names",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down Expand Up @@ -1320,7 +1320,7 @@
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n name,\n score,\n CASE\n WHEN (place = 'city') THEN 1\n ELSE 2\n END as category,\n round(random()) AS dir\n FROM \n (SELECT\n way,\n place,\n name,\n (\n (CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER\n WHEN (place = 'city') THEN 100000\n WHEN (place = 'town') THEN 1000\n ELSE 1\n END)\n *\n (CASE\n WHEN (capital = '4' OR (capital = 'yes' AND admin_level = '4')) THEN 2\n ELSE 1\n END)\n ) AS score\n FROM planet_osm_point\n WHERE place IN ('city', 'town')\n AND name IS NOT NULL\n AND (capital IS NULL OR capital != 'yes' OR (capital = 'yes' AND (admin_level IS NULL OR admin_level != '2')))\n ) as p\n ORDER BY score DESC, length(name) DESC, name\n) AS placenames_medium",
"table": "(SELECT\n way,\n name,\n score,\n CASE\n WHEN (place = 'city') THEN 1\n ELSE 2\n END as category,\n round(ascii(md5(osm_id::text)) / 55) AS dir -- base direction factor on geometry to be consistent across metatiles\n FROM \n (SELECT\n osm_id,\n way,\n place,\n name,\n (\n (CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER\n WHEN (place = 'city') THEN 100000\n WHEN (place = 'town') THEN 1000\n ELSE 1\n END)\n *\n (CASE\n WHEN (capital = '4' OR (capital = 'yes' AND admin_level = '4')) THEN 2\n ELSE 1\n END)\n ) AS score\n FROM planet_osm_point\n WHERE place IN ('city', 'town')\n AND name IS NOT NULL\n AND (capital IS NULL OR capital != 'yes' OR (capital = 'yes' AND (admin_level IS NULL OR admin_level != '2')))\n ) as p\n ORDER BY score DESC, length(name) DESC, name\n) AS placenames_medium",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down
5 changes: 3 additions & 2 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ Layer:
CASE
WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER ELSE 0
END as population,
round(random()) AS dir
round(ascii(md5(osm_id::text)) / 55) AS dir -- base direction factor on geometry to be consistent across metatiles
FROM planet_osm_point
WHERE capital = 'yes'
AND admin_level = '2'
Expand Down Expand Up @@ -1582,9 +1582,10 @@ Layer:
WHEN (place = 'city') THEN 1
ELSE 2
END as category,
round(random()) AS dir
round(ascii(md5(osm_id::text)) / 55) AS dir -- base direction factor on geometry to be consistent across metatiles
FROM
(SELECT
osm_id,
way,
place,
name,
Expand Down

0 comments on commit 6d56aca

Please sign in to comment.