tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
505 stars 119 forks source link

Density filter for POIs / labels #266

Closed zerebubuth closed 8 years ago

zerebubuth commented 8 years ago

As a post-process filter, we should be able to control the density of POIs and labels, preventing a whole bunch of them from rendering on top of one another. Client-side clipping will help, but it would be better to not send all of this data to begin with.

The issue arises because many buildings and other features are legitimately clustered, and each may have its own label / icon. However, once zoomed out these become all mashed together. The fix has to be something that's "zoom sensitive" as it doesn't make sense to merge these POIs at all zooms.

One possible implementation is to divide up the tile into NxN blocks (possibly even one 1x1) and rank the POIs within each block, possibly by type, taking only the most prominent and/or collapsing several of the same type into each other. For example, when binning mountain peaks, order by elevation and take only the highest within the block.

zerebubuth commented 8 years ago

We kind-of have this with the keep_n_features filter implemented as part of #268. We should evaluate the fix for #268 when it hits dev and come up with some specific examples to work on.

zerebubuth commented 8 years ago

Example: Lombard Motor Inn, see these comments for more details.

zerebubuth commented 8 years ago

After mapzen/TileStache#85 and #354:

Before

lombard_motor_inn_z18_before

After

Only one "Lombard Motor Inn"!

lombard_motor_inn_z18_after

nvkelso commented 8 years ago

Super cool!

zerebubuth commented 8 years ago

I'm seeing this for the Everett Middle School / Sanchez Elementary School examples now:

everett_middle_school_z17_after

nvkelso commented 8 years ago

Great! Let's QA this in dev now :)

nvkelso commented 8 years ago

Huge improvement overall :)

One problem so far, though...

Looks like we're missing the California Academy of Sciences in SF (kind=museum) in dev versus prod.

geometries: [
{
type: "Polygon",
properties: {
kind: "museum",
roof_material: "grass",
name: "California Academy of Sciences",
area: 25170,
landuse_kind: "park",
addr_street: "Music Concourse Drive",
height: 95,
addr_housenumber: "55",
id: 28695389
},
nvkelso commented 8 years ago

Costco is missing:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "supermarket",
area: 20711,
id: 43100828,
name: "Costco"
},
coordinates: [
913,
973
]
nvkelso commented 8 years ago

Westfields is missing:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "retail",
name: "Westfield San Francisco Centre",
area: 38946,
height: 62,
id: 332627424
},
coordinates: [
307,
561
]
},
nvkelso commented 8 years ago

Ferry Building is missing / corrupted (only has address part?):

{
type: "Point",
properties: {
label_placement: "yes",
kind: "terminal",
name: "Ferry Building",
area: 16786,
height: 82,
id: 24460886
},
coordinates: [
979,
733
]
},
nvkelso commented 8 years ago

Generally all these things used to show up around zoom 15 (they are more important than the average POI), but now don't show up at all.

zerebubuth commented 8 years ago

Generally all these things used to show up around zoom 15 (they are more important than the average POI), but now don't show up at all.

I can confirm that all of these had a null mz_centroid column, which is why they weren't showing. Not quite sure how this would happen, but we prefer representative_point now anyway, and mapzen/TileStache#88 and #362 should have fixed this, and we can check after dev is next deployed.

nvkelso commented 8 years ago

We're missing the buildings layer label position for the InterContinental Hotel Mark Hopkins in SF:

It does finally show in in zoom 17 in the POIs layer instead:

{
"coordinates":
[
925,
760
],
"properties":
{
"area":
6955,
"id":
288499856,
"kind":
"hotel",
"label_placement":
"yes",
"name":
"InterContinental Hotel Mark Hopkins"
},
"type":
"Point"
},
nvkelso commented 8 years ago

We're missing the building layer label position for the The Fairmont San Francisco Hotel in SF:

It does finally show in in zoom 17 in the POIs layer instead:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "hotel",
area: 13558,
id: 32947165,
name: "The Fairmont San Francisco Hotel"
},
coordinates: [
929,
1016
]
},
nvkelso commented 8 years ago

We're missing a label position for UCSF Medical Center at Mount Zion in SF:

It does finally show in in zoom 15 in the POIs layer instead:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "hospital",
name: "UCSF Medical Center at Mount Zion",
area: 4545,
landuse_kind: "hospital",
id: 256633745
},
coordinates: [
674,
832
]
},
nvkelso commented 8 years ago

(All the missing centroid problems have been fixed!)

nvkelso commented 8 years ago

We're missing a label position for Grace Cathedral in SF:

It does finally show in in zoom 15 in the POIs layer instead:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "place_of_worship",
name: "Grace Cathedral",
area: 4079,
landuse_kind: "place_of_worship",
id: 32946942
},
coordinates: [
846,
220
]
},
nvkelso commented 8 years ago

Best Buy in San Francisco is was kind:electronics but is now showing up as kind:building, a regression.

This is also impacting it's styled zoom visibility because the scene file hides generic building names until later zooms, but shows labels with a kind set (to something other than building) at earlier zooms.

dev:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "building",
name: "Best Buy",
area: 6595,
landuse_kind: "retail",
addr_street: "Harrison Street",
source: "openstreetmap.org",
addr_housenumber: "1717",
id: 25821942
},
coordinates: [
877,
933
]
},

prod:

{
type: "Point",
properties: {
label_placement: "yes",
kind: "electronics",
name: "Best Buy",
area: 6595,
landuse_kind: "retail",
addr_street: "Harrison Street",
addr_housenumber: "1717",
id: 25821942
},
coordinates: [
877,
933
]
},
zerebubuth commented 8 years ago
nvkelso commented 8 years ago

Added the above issues to v0.6.x milestone and marking this send to prod.