Skip to content

Commit

Permalink
correct bug in SQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulon42 committed Sep 3, 2016
1 parent 0a45eb7 commit 52d85dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,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 != '2' OR (capital = 'yes' AND 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(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 != '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
2 changes: 1 addition & 1 deletion project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ Layer:
FROM planet_osm_point
WHERE place IN ('city', 'town')
AND name IS NOT NULL
AND capital IS NULL OR capital != '2' OR (capital = 'yes' AND admin_level != '2')
AND capital IS NULL OR capital != 'yes' OR (capital = 'yes' AND admin_level != '2')

This comment has been minimized.

Copy link
@martiensch
) as p
ORDER BY score DESC, length(name) DESC, name
) AS placenames_medium
Expand Down

0 comments on commit 52d85dd

Please sign in to comment.