Rename POI gridrank to rank

This commit is contained in:
lukasmartinelli 2016-10-29 11:15:46 +02:00
parent 6f915eca92
commit ae60f637c0
3 changed files with 12 additions and 12 deletions

View File

@ -9,11 +9,12 @@ a of a variety of OpenStreetMap tags. Mostly contains amenities, sport, shop and
this field will contain the same value as `subclass`. this field will contain the same value as `subclass`.
But for example for schools you only need to style the class `school` to filter the subclasses `school` But for example for schools you only need to style the class `school` to filter the subclasses `school`
and `kindergarten`. Or use the class `shop` to style all shops. and `kindergarten`. Or use the class `shop` to style all shops.
- **gridrank**: The POIs are ranked ascending according to their importance within a grid. The `gridrank` value shows the
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at z14.
Since all POIs already need to be contained at `z14` you can use `less than gridrank=10` epxression to limit
POIs. At some point like z17 you can show all POIs.
- **name_en**: The english `name:en` value if available. - **name_en**: The english `name:en` value if available.
- **name**: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
- **rank**: The POIs are ranked ascending according to their importance within a grid. The `rank` value shows the
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at z14.
Since all POIs already need to be contained at `z14` you can use `less than rank=10` epxression to limit
POIs. At some point like z17 you can show all POIs.
- **subclass**: Original value of either the - **subclass**: Original value of either the
[`amenity`](http://wiki.openstreetmap.org/wiki/Key:amenity), [`amenity`](http://wiki.openstreetmap.org/wiki/Key:amenity),
[`leisure`](http://wiki.openstreetmap.org/wiki/Key:leisure), [`leisure`](http://wiki.openstreetmap.org/wiki/Key:leisure),
@ -22,7 +23,6 @@ POIs. At some point like z17 you can show all POIs.
[`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism) [`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism)
or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop) or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop)
tag. Use this to do more precise styling. tag. Use this to do more precise styling.
- **name**: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
## Mapping ## Mapping

View File

@ -1,13 +1,13 @@
CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer, pixel_width numeric) CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer, pixel_width numeric)
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text, gridrank int) AS $$ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text, "rank" int) AS $$
SELECT osm_id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass, SELECT osm_id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass,
row_number() OVER ( row_number() OVER (
PARTITION BY LabelGrid(geometry, 100 * pixel_width) PARTITION BY LabelGrid(geometry, 100 * pixel_width)
ORDER BY poi_class_rank(poi_class(subclass)) ASC, length(name) DESC ORDER BY poi_class_rank(poi_class(subclass)) ASC, length(name) DESC
)::int AS gridrank )::int AS "rank"
FROM osm_poi_point FROM osm_poi_point
WHERE geometry && bbox WHERE geometry && bbox
AND zoom_level >= 14 AND zoom_level >= 14
AND name <> '' AND name <> ''
ORDER BY gridrank; ORDER BY "rank";
$$ LANGUAGE SQL IMMUTABLE; $$ LANGUAGE SQL IMMUTABLE;

View File

@ -22,15 +22,15 @@ layer:
[`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism) [`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism)
or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop) or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop)
tag. Use this to do more precise styling. tag. Use this to do more precise styling.
gridrank: | rank: |
The POIs are ranked ascending according to their importance within a grid. The `gridrank` value shows the The POIs are ranked ascending according to their importance within a grid. The `rank` value shows the
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at z14. local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at z14.
Since all POIs already need to be contained at `z14` you can use `less than gridrank=10` epxression to limit Since all POIs already need to be contained at `z14` you can use `less than rank=10` epxression to limit
POIs. At some point like z17 you can show all POIs. POIs. At some point like z17 you can show all POIs.
datasource: datasource:
geometry_field: geometry geometry_field: geometry
srid: 900913 srid: 900913
query: (SELECT geometry, name, name_en, class, subclass, gridrank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t query: (SELECT geometry, name, name_en, class, subclass, rank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema: schema:
- ./class.sql - ./class.sql
- ./layer.sql - ./layer.sql