Skip to content

Commit

Permalink
Use @mapbox/gazetteer for benchmark coordinates
Browse files Browse the repository at this point in the history
- Closes #8059
  • Loading branch information
tristen committed Mar 21, 2019
1 parent 337dc12 commit 8d68d6c
Show file tree
Hide file tree
Showing 3 changed files with 3,715 additions and 3,266 deletions.
113 changes: 21 additions & 92 deletions bench/lib/style_locations.js
Original file line number Diff line number Diff line change
@@ -1,94 +1,23 @@
import { OverscaledTileID } from '../../src/source/tile_id';
import locations from '@mapbox/gazetteer/mapbox-streets/style-benchmark-locations.json';
import MercatorCoordinate from '../../src/geo/mercator_coordinate';

export default [
{
"description": "Roads – Houston, z12",
"tileID": [new OverscaledTileID(12, 0, 12, 962, 1692)],
"zoom": 12,
"center": [-95.392263, 29.799396]
},
{
"description": "Roads – Houston, z13",
"tileID": [new OverscaledTileID(13, 0, 13, 1925, 3386)],
"zoom": 13,
"center": [-95.38116, 29.74916]
},
{
"description": "High zoom labels (also: buildings, roads) – New York City, z16",
"tileID": [new OverscaledTileID(16, 0, 16, 19299, 24629)],
"zoom": 16,
"center": [-73.984682, 40.757660]
},
{
"description": "High zoom labels (also: buildings, roads) – New York City, z17, overzoomed",
"tileID": [new OverscaledTileID(17, 0, 17, 19299, 24629)],
"zoom": 17,
"center": [-73.984682, 40.757660]
},
{
"description": "High zoom cjk labels, when using local lang (also: buildings, roads) – Tokyo, z16",
"tileID": [new OverscaledTileID(16, 0, 16, 58210, 25803)],
"zoom": 16,
"center": [139.759860, 35.69522]
},
{
"description": "High zoom cjk labels, when using local lang (also: buildings, roads) – Tokyo, z17, overzoomed",
"tileID": [new OverscaledTileID(17, 0, 17, 58210, 25803)],
"zoom": 17,
"center": [139.759860, 35.69522]
},
{
"description": "Water – Finland, z10",
"tileID": [new OverscaledTileID(10, 0, 10, 590, 288)],
"zoom": 10,
"center": [27.602348, 61.520945]
},
{
"description": "Landuse and roads – Paris, z11",
"tileID": [new OverscaledTileID(11, 0, 11, 1036, 705)],
"zoom": 11,
"center": [2.209530, 48.745030]
},
{
"description": "Buildings – LA, z16",
"tileID": [new OverscaledTileID(16, 0, 16, 11229, 26180)],
"zoom": 6,
"center": [-118.314417, 33.995654]
},
{
"description": "High zoom (roads, paths, landuse, labels) – Paris, 15",
"tileID": [new OverscaledTileID(15, 0, 15, 16594, 11271)],
"zoom": 15,
"center": [2.315725, 48.866517]
},
{
"description": "High zoom (pedestrian polygon fills, roads, paths, landuse, labels) – Paris, z16",
"tileID": [new OverscaledTileID(16, 0, 16, 33189, 22543)],
"zoom": 16,
"center": [2.315725, 48.866517]
},
{
"description": "Hillshading – Switzerland, z9",
"tileID": [new OverscaledTileID(9, 0, 9, 268, 181)],
"zoom": 9,
"center": [8.835221, 46.317157]
},
{
"description": "Hillshading and contours – Switzerland, z12",
"tileID": [new OverscaledTileID(12, 0, 12, 2148, 1452)],
"zoom": 12,
"center": [8.835221, 46.317157]
},
{
"description": "Landcover – Germany z6",
"tileID": [new OverscaledTileID(6, 0, 6, 33, 21)],
"zoom": 6,
"center": [8.429493, 51.056406]
},
{
"description": "Landcover – Germany z8",
"tileID": [new OverscaledTileID(8, 0, 8, 133, 86)],
"zoom": 8,
"center": [7.762074, 50.322133]
}
];
export default locations.features.map(feature => {
const { coordinates } = feature.geometry;
const { zoom, place_name } = feature.properties;
const { x, y } = MercatorCoordinate.fromLngLat({
lng: coordinates[0],
lat: coordinates[1]
});

const scale = Math.pow(2, zoom);
const tileX = Math.floor(x * scale);
const tileY = Math.floor(y * scale);

return {
description: place_name,
tileID: [new OverscaledTileID(zoom, 0, zoom, tileX, tileY)],
zoom,
center: coordinates
};
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"@mapbox/appropriate-images-react": "^1.0.0",
"@mapbox/dr-ui": "0.6.0",
"@mapbox/gazetteer": "^3.1.0",
"@mapbox/geojson-rewind": "^0.4.0",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
Expand Down
Loading

0 comments on commit 8d68d6c

Please sign in to comment.