tilezen / vector-datasource

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

Modify gate min zoom to 17 #820

Closed nvkelso closed 8 years ago

nvkelso commented 8 years ago

In working on https://github.com/mapzen/vector-datasource/pull/819 for kind:toll_booth, we've discovered the min zoom of kind:gate POIs to be very high at zoom 15. That should be defaulting to zoom 17 instead as many gates are digitized in fences, not just across roads.

@zerebubuth How hard would it be to modify the zoom based on what road class the the gate was on?

A gate on a path &/or fence at zoom 17. But a gate on a major road zoom 14 and minor road zoom 15?

nvkelso commented 8 years ago

For context, we hide most gates from display in the map because the data is too funky in tiles now.

zerebubuth commented 8 years ago

A query like this will do the trick:

SELECT
  osm_id,
  MAX(CASE
    WHEN highway IN ('motorway', 'trunk', 'primary', 'motorway_link',
                     'trunk_link', 'primary_link') THEN 3
    WHEN highway IN ('secondary', 'tertiary', 'secondary_link',
                     'tertiary_link') THEN 2
    WHEN highway IN ('residential', 'unclassified') THEN 1
    ELSE 0
  END) AS highway_level
FROM (
  SELECT
    p.osm_id,
    hstore(w.tags)->'highway' AS highway
  FROM planet_osm_point p
  JOIN planet_osm_ways w
  ON ARRAY[p.osm_id] && w.nodes
  WHERE
    p.way && <insert bbox here>
    AND p.barrier='gate'
    AND hstore(w.tags) ? 'highway'
) x
GROUP BY osm_id;

This will have a performance impact but hopefully, since gates are relatively rare, it might not be noticeable. The form above is good for experimentation, but it's probably best for maintainability to rewrite it as a function of osm_id returning the appropriate highway level (or zoom level) and then just use that as the min_zoom expression in the YAML.

rmarianski commented 8 years ago

The form above is good for experimentation, but it's probably best for maintainability to rewrite it as a function of osm_id returning the appropriate highway level (or zoom level) and then just use that as the min_zoom expression in the YAML.

:+1:

okavvada commented 8 years ago

Is this referring to kind:gate or kind:toll_booth ? Usually, gates are not digitized on the road, I couldn't find any examples of a gate on a major highway, secondary road. kind:toll_booth are digitized on highways. Should the rule apply to kind:toll_booth?

nvkelso commented 8 years ago

Only for gate (not for toll_booth). Let me look for some gates on roads...

zerebubuth commented 8 years ago

Here's an example of a gate at the end of a secondary road. This one in Quantico Marine Corps base is in the middle of the road, but I'd expect to find gates on military bases, even on higher class roads. Same for this one on the University of Virginia campus.

I'm using this Overpass query to find matching gates. Although a great many seem to be where footpaths join the road, suggesting that they're editing mistakes, and the gate is far more likely to be on the footpath than the secondary road.

nvkelso commented 8 years ago
nvkelso commented 8 years ago

Dev's not loading many z16 tiles at the moment, and not even some z15 tiles so holding off verification until it's sorted itself out.

nvkelso commented 8 years ago

I don't see the gate by Moffet field referenced in this test, did the test pass?

nvkelso commented 8 years ago

(everything else checks out)

nvkelso commented 8 years ago

@zerebubuth Can you please run the integration tests against dev to see if they all pass, please?

nvkelso commented 8 years ago

The following tests failed (including gate):

integration-test/524-peak-kind-tile-rank.py
integration-test/661-historic-transit-stops.py
integration-test/719-add-kind-detail-for-pois.py
integration-test/742-predictable-layers-pois.py
integration-test/820-gate-min-zoom.py
integration-test/829-garden-pois.py
integration-test/841-normalize-boundaries-kind.py
integration-test/896-ne-shield-enums.py
integration-test/927-normalize-operator-values.py
integration-test/931-locality-changes-places.py
integration-test/981-remove-unstyled-ne-places.py
integration-test/982-remove-unstyled-localities.py
integration-test/993-remove-props-road-merge.py
nvkelso commented 8 years ago

Verified Moffett Gates.