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 66cf7f8 commit cb401ea
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 92 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 @@ -13,6 +13,7 @@
"node": ">=6.4.0"
},
"dependencies": {
"@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
78 changes: 78 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,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 @@ -252,6 +259,17 @@
resolved "https://registry.yarnpkg.com/@mapbox/geojson-types/-/geojson-types-1.0.2.tgz#9aecf642cb00eab1080a57c4f949a65b4a5846d6"
integrity sha512-e9EBqHHv3EORHrSfbR9DqecPNn+AmuAoQxV6aL8Xu30bJMJR1o8PZLZzpk1Wq7/NfCbuhmakHTPYRhoqLsXRnw==

"@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":
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 @@ -487,6 +505,11 @@ JSONStream@^1.0.3, JSONStream@^1.0.4:
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 @@ -694,6 +717,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=

ansicolors@~0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.2.1.tgz#be089599097b74a5c9c4a84a0cdbcdb62bd87aef"
Expand Down Expand Up @@ -2505,6 +2533,15 @@ chalk@^2.3.2, chalk@^2.4.1:
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 @@ -2867,6 +2904,16 @@ concat-stream@^1.5.0, concat-stream@^1.6.0, concat-stream@~1.6.0:
readable-stream "^2.2.2"
typedarray "^0.0.6"

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"
readable-stream "^2.2.2"
typedarray "^0.0.6"

concat-stream@~1.5.0, concat-stream@~1.5.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266"
Expand Down Expand Up @@ -5605,6 +5652,11 @@ has-ansi@^2.0.0:
dependencies:
ansi-regex "^2.0.0"

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=

has-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
Expand Down Expand Up @@ -6966,6 +7018,14 @@ jsonify@~0.0.0:
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=

[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 @@ -8407,6 +8467,14 @@ node-releases@^1.0.0-alpha.14:
dependencies:
semver "^5.3.0"

"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 @@ -11528,6 +11596,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-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz#e5211e9224369fbb81d633a2f00044dc8cedad92"
Expand Down Expand Up @@ -12316,6 +12389,11 @@ unc-path-regex@^0.1.2:
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
integrity sha1-5z3T17DXxe2G+6xrCufYxqadUPo=

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

0 comments on commit cb401ea

Please sign in to comment.