Make sure areas above 160000000 get rank 2 or 1 (#1623)

This is a follow-up on https://github.com/openmaptiles/openmaptiles/pull/1604 . Seminole Nation is shown in the screenshot there with rank 3 while based on area it should be 1. This PR fixes `area_rank()` function to handle areas greater than 160000000, e.g. this fixes #1622 .

Co-authored-by: Paul Norman <penorman@mac.com>
This commit is contained in:
Peter Hanecak 2024-01-29 07:51:24 +01:00 committed by GitHub
parent bb154f4ee8
commit fe61912c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,12 @@
CREATE OR REPLACE FUNCTION area_rank(area real) RETURNS int AS
$$
SELECT CASE
WHEN area < 10000000 THEN 6
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
WHEN area > 40000000 THEN 3
WHEN area > 160000000 THEN 2
WHEN area > 640000000 THEN 1
WHEN area > 160000000 THEN 2
WHEN area > 40000000 THEN 3
WHEN area > 15000000 THEN 4
WHEN area > 10000000 THEN 5
WHEN area > 0 THEN 6
ELSE 7
END;
$$ LANGUAGE SQL IMMUTABLE