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 736c6b7
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 96 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 styleBenchmarkLocations from '@mapbox/gazetteer/mapbox-streets/style-benchmark-locations.json';
import MercatorCoordinate from '../../src/geo/mercator_coordinate';
import { OverscaledTileID } from '../../src/source/tile_id';

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 styleBenchmarkLocations.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
91 changes: 87 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,13 @@
pirates "^3.0.2"
vlq "^0.2.1"

"@mapbox/gazetteer@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/gazetteer/-/gazetteer-3.1.0.tgz#8159de2ca9e30c1b8b3a172072d5eece435f9d7a"
integrity sha512-0b9wW4FVGWUav++A3mzMdZWtA61mEE+Np/AhQ/TC6Yc+kRi+yGDT9lgO6eNzYbL8lKhqs9OllNGy+heszsRKXQ==
dependencies:
"@mapbox/geojsonhint" "^2.1.0"

"@mapbox/[email protected]":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@mapbox/geojson-area/-/geojson-area-0.2.2.tgz#18d7814aa36bf23fbbcc379f8e26a22927debf10"
Expand All @@ -1113,6 +1120,17 @@
version "1.0.2"
resolved "https://registry.yarnpkg.com/@mapbox/geojson-types/-/geojson-types-1.0.2.tgz#9aecf642cb00eab1080a57c4f949a65b4a5846d6"

"@mapbox/geojsonhint@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/geojsonhint/-/geojsonhint-2.1.0.tgz#bb94203ff09cf675898946362272e4738547c0d4"
integrity sha1-u5QgP/Cc9nWJiUY2InLkc4VHwNQ=
dependencies:
concat-stream "^1.6.1"
jsonlint-lines "1.7.1"
minimist "1.2.0"
vfile "^2.3.0"
vfile-reporter "^4.0.0"

"@mapbox/hast-util-table-cell-style@^0.1.2", "@mapbox/hast-util-table-cell-style@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@mapbox/hast-util-table-cell-style/-/hast-util-table-cell-style-0.1.3.tgz#5b7166ae01297d72216932b245e4b2f0b642dca6"
Expand Down Expand Up @@ -1383,6 +1401,11 @@ JSONStream@^1.0.3:
jsonparse "^1.2.0"
through ">=2.2.7 <3"

"JSV@>= 4.0.x":
version "4.0.2"
resolved "https://registry.yarnpkg.com/JSV/-/JSV-4.0.2.tgz#d077f6825571f82132f9dffaed587b4029feff57"
integrity sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=

abab@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f"
Expand Down Expand Up @@ -1575,6 +1598,11 @@ ansi-styles@^3.2.1:
dependencies:
color-convert "^1.9.0"

ansi-styles@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178"
integrity sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=

[email protected]:
version "0.1.0"
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
Expand Down Expand Up @@ -3414,6 +3442,15 @@ chalk@^2.4.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.4.0.tgz#5199a3ddcd0c1efe23bc08c1b027b06176e0c64f"
integrity sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=
dependencies:
ansi-styles "~1.0.0"
has-color "~0.1.0"
strip-ansi "~0.1.0"

character-entities-html4@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-1.1.1.tgz#359a2a4a0f7e29d3dc2ac99bdbe21ee39438ea50"
Expand Down Expand Up @@ -3828,9 +3865,10 @@ [email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"

[email protected], concat-stream@^1.4.6, concat-stream@^1.4.7, concat-stream@^1.5.1:
[email protected], concat-stream@^1.4.6, concat-stream@^1.4.7, concat-stream@^1.5.1, concat-stream@^1.6.1:
version "1.6.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34"
integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==
dependencies:
buffer-from "^1.0.0"
inherits "^2.0.3"
Expand Down Expand Up @@ -6939,6 +6977,11 @@ has-binary2@~1.0.2:
dependencies:
isarray "2.0.1"

has-color@~0.1.0:
version "0.1.7"
resolved "https://registry.yarnpkg.com/has-color/-/has-color-0.1.7.tgz#67144a5260c34fc3cca677d041daf52fe7b78b2f"
integrity sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=

[email protected]:
version "1.1.0"
resolved "https://registry.yarnpkg.com/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39"
Expand Down Expand Up @@ -8303,6 +8346,14 @@ jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"

[email protected]:
version "1.7.1"
resolved "https://registry.yarnpkg.com/jsonlint-lines/-/jsonlint-lines-1.7.1.tgz#507de680d3fb8c4be1641cc57d6f679f29f178ff"
integrity sha1-UH3mgNP7jEvhZBzFfW9nnynxeP8=
dependencies:
JSV ">= 4.0.x"
nomnom ">= 1.5.x"

jsonparse@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
Expand Down Expand Up @@ -9626,6 +9677,14 @@ node-status-codes@^1.0.0:
resolved "https://registry.yarnpkg.com/node-status-codes/-/node-status-codes-1.0.0.tgz#5ae5541d024645d32a58fcddc9ceecea7ae3ac2f"
integrity sha1-WuVUHQJGRdMqWPzdyc7s6nrjrC8=

"nomnom@>= 1.5.x":
version "1.8.1"
resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.8.1.tgz#2151f722472ba79e50a76fc125bb8c8f2e4dc2a7"
integrity sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=
dependencies:
chalk "~0.4.0"
underscore "~1.6.0"

noop-logger@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2"
Expand Down Expand Up @@ -12902,9 +12961,10 @@ string-template@~0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add"

string-width@^1.0.1, string-width@^1.0.2:
string-width@^1.0.0, string-width@^1.0.1, string-width@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=
dependencies:
code-point-at "^1.0.0"
is-fullwidth-code-point "^1.0.0"
Expand Down Expand Up @@ -12984,6 +13044,11 @@ strip-ansi@^4.0.0:
dependencies:
ansi-regex "^3.0.0"

strip-ansi@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-0.1.1.tgz#39e8a98d044d150660abe4a6808acf70bb7bc991"
integrity sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=

strip-bom-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz#e7144398577d51a6bed0fa1994fa05f43fd988ee"
Expand Down Expand Up @@ -13167,9 +13232,10 @@ supports-color@^3.1.2, supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"

supports-color@^4.2.1:
supports-color@^4.1.0, supports-color@^4.2.1:
version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
integrity sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=
dependencies:
has-flag "^2.0.0"

Expand Down Expand Up @@ -13850,6 +13916,11 @@ unc-path-regex@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"

underscore@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8"
integrity sha1-izixDKze9jM3uLJOT/htRa6lKag=

unherit@^1.0.4:
version "1.1.0"
resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.0.tgz#6b9aaedfbf73df1756ad9e316dd981885840cd7d"
Expand Down Expand Up @@ -14225,6 +14296,17 @@ vfile-message@^1.0.0:
dependencies:
unist-util-stringify-position "^1.1.1"

vfile-reporter@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vfile-reporter/-/vfile-reporter-4.0.0.tgz#ea6f0ae1342f4841573985e05f941736f27de9da"
integrity sha1-6m8K4TQvSEFXOYXgX5QXNvJ96do=
dependencies:
repeat-string "^1.5.0"
string-width "^1.0.0"
supports-color "^4.1.0"
unist-util-stringify-position "^1.0.0"
vfile-statistics "^1.1.0"

vfile-reporter@^5.0.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/vfile-reporter/-/vfile-reporter-5.1.1.tgz#419688c7e9dcaf65ba81bfdb0ad443e9e0248e09"
Expand All @@ -14250,9 +14332,10 @@ vfile-statistics@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/vfile-statistics/-/vfile-statistics-1.1.0.tgz#02104c60fdeed1d11b1f73ad65330b7634b3d895"

vfile@^2.0.0:
vfile@^2.0.0, vfile@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/vfile/-/vfile-2.3.0.tgz#e62d8e72b20e83c324bc6c67278ee272488bf84a"
integrity sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==
dependencies:
is-buffer "^1.1.4"
replace-ext "1.0.0"
Expand Down

0 comments on commit 736c6b7

Please sign in to comment.