diff --git a/.github/workflows/test-build-mac.yml b/.github/workflows/test-build-macos-13.yml similarity index 92% rename from .github/workflows/test-build-mac.yml rename to .github/workflows/test-build-macos-13.yml index 02143eded..224ba1bc4 100644 --- a/.github/workflows/test-build-mac.yml +++ b/.github/workflows/test-build-macos-13.yml @@ -1,4 +1,4 @@ -name: Test Build (MacOS) +name: Test Build (MacOS 13) on: pull_request: @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: macos-latest + runs-on: macos-13 steps: - name: Checkout 🛎️ uses: actions/checkout@v3 diff --git a/icons/shield40_us_nm_2.svg b/icons/shield40_us_nm_2.svg new file mode 100644 index 000000000..13a23c708 --- /dev/null +++ b/icons/shield40_us_nm_2.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/icons/shield40_us_nm_3.svg b/icons/shield40_us_nm_3.svg new file mode 100644 index 000000000..a15b60d6a --- /dev/null +++ b/icons/shield40_us_nm_3.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/scripts/stats.js b/scripts/stats.js index b75ef7f01..c493f120a 100644 --- a/scripts/stats.js +++ b/scripts/stats.js @@ -1,6 +1,7 @@ import * as Style from "../src/js/style.js"; import config from "../src/config.js"; import { Command, Option } from "commander"; +import fs from "node:fs"; const program = new Command(); program @@ -18,9 +19,31 @@ program .addOption( new Option("-s, --layer-size", "size of all layers").conflicts("allJson") ) + .addOption( + new Option( + "-ss1, --spritesheet-1x-size", + "size of 1x sprite sheet" + ).conflicts("allJson") + ) + .addOption( + new Option( + "-ss2, --spritesheet-2x-size", + "size of 2x sprite sheet" + ).conflicts("allJson") + ) + .addOption( + new Option("-sh, --shield-json-size", "size of ShieldJSON").conflicts( + "allJson" + ) + ) .option("-loc, --locales ", "language codes", ["mul"]) .option("-j, --all-json", "output all stats in JSON") - .option("-pp, --pretty", "pretty-print JSON output"); + .option("-pp, --pretty", "pretty-print JSON output") + .option( + "-d, --directory ", + "specify location of Americana distribution", + ["dist"] + ); program.parse(process.argv); @@ -29,6 +52,7 @@ const opts = program.opts(); if (Object.keys(opts).length === 1) program.help(); const locales = opts.locales[0].split(","); +const distDir = opts.directory; const style = Style.build( config.OPENMAPTILES_URL, @@ -45,8 +69,37 @@ if (opts.layerCount) { process.exit(); } -const styleSize = JSON.stringify(layers).length; +function spriteSheetSize(distDir, single) { + let size = single ? "" : "@2x"; + return ( + fs.statSync(`${distDir}/sprites/sprite${size}.png`).size + + fs.statSync(`${distDir}/sprites/sprite${size}.json`).size + ); +} + +function distFileSize(distDir, path) { + return fs.statSync(`${distDir}/${path}`).size; +} +const spriteSheet1xSize = spriteSheetSize(distDir, true); +if (opts.spritesheet1xSize) { + console.log(spriteSheet1xSize); + process.exit(); +} + +const spriteSheet2xSize = spriteSheetSize(distDir, false); +if (opts.spritesheet2xSize) { + console.log(spriteSheet2xSize); + process.exit(); +} + +const shieldJSONSize = distFileSize(distDir, "shields.json"); +if (opts.shieldJsonSize) { + console.log(shieldJSONSize); + process.exit(); +} + +const styleSize = JSON.stringify(layers).length; if (opts.layerSize) { console.log(styleSize); process.exit(); @@ -58,6 +111,9 @@ const stats = { layerCount, styleSize, layerGroup: {}, + spriteSheet1xSize, + spriteSheet2xSize, + shieldJSONSize, }; for (let i = 0; i < layerCount; i++) { diff --git a/scripts/stats_compare.js b/scripts/stats_compare.js index 45f70dad7..bf999529a 100644 --- a/scripts/stats_compare.js +++ b/scripts/stats_compare.js @@ -22,13 +22,40 @@ const layersRow = mdCompareRow( ); const sizeRow = mdCompareRow( - "Size (b)", + "StyleJSON Size (b)", stats1.styleSize, stats2.styleSize, difference.styleSize ); -printTable("Style size statistics", [layersRow, sizeRow]); +const shieldRow = mdCompareRow( + "ShieldJSON Size (b)", + stats1.shieldJSONSize, + stats2.shieldJSONSize, + difference.shieldJSONSize +); + +const ss1xRow = mdCompareRow( + "1x Sprite Sheet Size (b)", + stats1.spriteSheet1xSize, + stats2.spriteSheet1xSize, + difference.spriteSheet1xSize +); + +const ss2xRow = mdCompareRow( + "2x Sprite Sheet Size (b)", + stats1.spriteSheet2xSize, + stats2.spriteSheet2xSize, + difference.spriteSheet2xSize +); + +printTable("Style size statistics", [ + layersRow, + sizeRow, + ss1xRow, + ss2xRow, + shieldRow, +]); /** * Show comparison of the number of layers in each group before and after diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index 4864535cc..1529c0c5f 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -775,11 +775,14 @@ export function loadShields() { ["BUS"], Color.shields.green ); - shields["US:CA:CR"] = pentagonUpShield( - 3, - 15, - Color.shields.blue, - Color.shields.yellow + ["CR", "Sierra"].forEach( + (county) => + (shields[`US:CA:${county}`] = pentagonUpShield( + 3, + 15, + Color.shields.blue, + Color.shields.yellow + )) ); shields["US:CA:Mendocino"] = roundedRectShield( Color.shields.green, @@ -1141,8 +1144,8 @@ export function loadShields() { "Webster", "Winn", ].forEach( - (county) => - (shields[`US:LA:${county}`] = pentagonUpShield( + (parish) => + (shields[`US:LA:${parish}`] = pentagonUpShield( 3, 15, Color.shields.blue, @@ -1424,6 +1427,11 @@ export function loadShields() { // Mississippi shields["US:MS"] = ovalShield(Color.shields.white, Color.shields.black); + shields["US:MS:Scenic"] = banneredShield( + ovalShield(Color.shields.white, Color.shields.blue), + ["SCEN"], + Color.shields.blue + ); [ "Alcorn", "Calhoun", @@ -1665,11 +1673,17 @@ export function loadShields() { ); // New Mexico - shields["US:NM"] = pillShield( - Color.shields.white, - Color.shields.pink, - Color.shields.black - ); + shields["US:NM"] = { + spriteBlank: ["shield40_us_nm_2", "shield40_us_nm_3"], + textColor: Color.shields.black, + textLayout: textConstraint("ellipse"), + padding: { + left: 5, + right: 5, + top: 5, + bottom: 5, + }, + }; shields["US:NM:Frontage"] = { spriteBlank: "shield_us_nm_frontage", textColor: Color.shields.black, @@ -2484,11 +2498,14 @@ export function loadShields() { bottom: 5, }, }; - shields["US:UT:Wayne"] = pentagonUpShield( - 3, - 15, - Color.shields.blue, - Color.shields.yellow + ["Wayne", "Washington"].forEach( + (county) => + (shields[`US:UT:${county}`] = pentagonUpShield( + 3, + 15, + Color.shields.blue, + Color.shields.yellow + )) ); // Virginia @@ -3728,23 +3745,13 @@ export function loadShields() { }; shields["US:KY:Parkway"].refsByName = { - // FIXME: This object contains both spelled-out and abbreviated road - // names to accommodate both the abbreviated names from OpenMapTiles and - // the spelled-out names from Planetiler. - // https://github.com/onthegomap/planetiler/issues/14 "Audubon Parkway": "AU", "Bluegrass Parkway": "BG", - "Bluegrass Pkwy": "BG", "Cumberland Parkway": "LN", - "Cumberland Pkwy": "LN", "Hal Rogers Parkway": "HR", - "Hal Rogers Pkwy": "HR", "Mountain Parkway": "MP", - "Mountain Pkwy": "MP", "Purchase Parkway": "JC", - "Purchase Pkwy": "JC", "Western Kentucky Parkway": "WK", - "Western Kentucky Pkwy": "WK", }; shields["US:CT:Parkway"].overrideByName = { @@ -3784,15 +3791,13 @@ export function loadShields() { }; shields["US:NY:Parkway"].refsByName = { - "Bear Mountain Parkway": "BMP", - "Bronx and Pelham Parkway": "PP", + "Bear Mountain State Parkway": "BMP", "Bronx River Parkway": "BRP", "Cross County Parkway": "CCP", "Hutchinson River Parkway": "HRP", "Korean War Veterans Parkway": "KWVP", "Mosholu Parkway": "MP", "Niagara Scenic Parkway": "NSP", - "Pelham Parkway": "PP", "Saw Mill River Parkway": "SMP", "Sprain Brook Parkway": "SBP", "Taconic State Parkway": "TSP", @@ -3812,14 +3817,7 @@ export function loadShields() { "Fort Bend Westpark Tollway": "WPT", }; shields["US:TX:Harris:HCTRA"].refsByName = { - "East Sam Houston Tollway North": "SHT", - "East Sam Houston Tollway South": "SHT", - "North Sam Houston Tollway East": "SHT", - "North Sam Houston Tollway West": "SHT", - "South Sam Houston Tollway East": "SHT", - "South Sam Houston Tollway West": "SHT", - "West Sam Houston Tollway North": "SHT", - "West Sam Houston Tollway South": "SHT", + "Sam Houston Tollway": "SHT", "Fort Bend Toll Road": "FBTR", "Hardy Toll Road": "HTR", "Tomball Tollway": "TBT", diff --git a/src/layer/park.js b/src/layer/park.js index 662f3af01..bcf2cebd3 100644 --- a/src/layer/park.js +++ b/src/layer/park.js @@ -13,7 +13,6 @@ export const fill = { "fill-color": Color.parkFill, }, source: "openmaptiles", - minzoom: 5, "source-layer": "park", }; @@ -25,7 +24,6 @@ export const outline = { "line-color": Color.parkOutline, }, source: "openmaptiles", - minzoom: 5, metadata: {}, "source-layer": "park", }; diff --git a/src/layer/poi.js b/src/layer/poi.js index 885c12d30..d9a5ddbcc 100644 --- a/src/layer/poi.js +++ b/src/layer/poi.js @@ -345,7 +345,7 @@ export const poi = { "parking", "police", "school", - "college", + ...getSubclasses(iconDefs.college), "library", "townhall", ...getSubclasses(iconDefs.post_office), @@ -368,9 +368,11 @@ export const poi = { [ "match", ["get", "subclass"], + [...getSubclasses(iconDefs.college)], + 10, ["station", "halt"], 12, - ["bus_station", "subway", ...getSubclasses(iconDefs.college)], + ["bus_station", "subway"], 14, [ "bus_stop",