--[==[
To inspect the content of this data module, use Special:ExpandTemplates
and enter the following input text:  
To inspect the content of this data module when editing, enter the following
into the Debug console:
local util = require("Module:Road data/util")
print(util.arrayToString(p))
To inspect a particular route type, change `p` above to include the route type,
e.g., `p.I` and `p["US-Hist"]`.
]==]  
-- New York
local NY = {}  
local util = require("Module:Road data/util")
local format = mw.ustring.format
util.addAll(NY, require("Module:Road data/strings/USA"))  
local suffix = " ([dab||%dab%, |]New York)"  
NY.I.link = "Interstate %route% (New York)"  
for k, v in pairs(NY) do if k:find ("^I") then
v.link = NY.I.link
end
end  
NY.BL.link = "Interstate %route% Business ([dab||%dab%, |]New York)"  
for k, v in pairs(NY) do if k:find ("^BL") then
v.link = NY.BL.link
end
end  
NY.US.shield = {
["1-9"] = "US 1-9.svg",
["9W"] = "US 9W (NY).svg",
default = {
hook = "splitlen",
split = 3,
above = "US %route% (NY).svg",
below = "US %route%.svg"
}
}
NY.US.shieldmain = NY.US.shield
NY.US.link = "U.S. Route %route% in New York"  
for k, v in pairs(NY) do if k:find ("^US %d") then
v.name = NY.US.name
v.link = NY.US.link
end
end  
for _,auxType in ipairs({"Alt", "Bus", "Byp", "City", "Conn", "Emerg", "Opt", "Scenic", "Spur", "Temp", "Toll", "Truck"}) do
local spec = NY[" aux "][auxType]
for k, v in pairs(NY) do if k:find (auxType) then if k:find ("^US") then
v.shield = NY.US.shield
v.shieldmain = NY.US.shieldmain
v.link = NY.US.base .. " " .. spec.name .. " ([dab||%dab%, |]New York)"
end
end
end
end  
for _,year in ipairs({'1926', '1948', '1961'}) do
for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Truck"}) do
local type = "US " .. year
local spec = NY[" aux "][auxType]
NY[type .. "-" .. auxType] = {
shield = NY[type].shield,
shieldmain = NY[type].shieldmain,
name = NY[type].name .. " " .. spec.name,
link = NY[type].base .. " " .. spec.name .. suffix,
abbr = NY[type].abbr .. " " .. spec.abbrsuffix,
banner = spec.bannerprefix .. " plate " .. year .. ".svg",
aux = spec.aux,
width = NY[type].width
}
end
end  
NY.NY = {
base = "New York State Route %route%",
shield = "NY-%route%.svg",
shieldmain = {
["74"] = {"NY-%route%.svg", "Vermont %route%.svg"},
["149"] = {"NY-%route%.svg", "Vermont %route%.svg"},
["295"] = {"NY-%route%.svg", "MA Route %route%.svg"},
["313"] = {"NY-%route%.svg", "Vermont %route%.svg"},
["314"] = {"NY-%route%.svg", "Vermont %route%.svg"},
["343"] = {"NY-%route%.svg", "Connecticut Highway %route% wide.svg"},
["346"] = {"NY-%route%.svg", "Vermont %route%.svg"},
default = "NY-%route%.svg"
},
name = {
["74"] = "Route %route%",
["149"] = "Route %route%",
["295"] = "Route %route%",
["313"] = "Route %route%",
["314"] = "Route %route%",
["343"] = "New York State Route %route% and
Connecticut Route %route%",
["346"] = "Route %route%",
default = "New York State Route %route%"
},
link = "New York State Route %route% [dab||(%dab%)|]",
abbr = "NY&nbsp;%route%",
}
NY.SR = NY.NY  
NY.Ref = { --Reference routes
shield = "",
shieldlist = "No image.svg",
name = NY.NY.name.default,
link = NY.NY.link,
abbr = NY.NY.abbr
}  
for _,year in ipairs({"1927", "1948", "1955", "1960"}) do
NY["NY " .. year] = {
shield = format("NY-%%route%% (%s).svg", year),
name = NY.NY.name.default,
link = NY.NY.link,
abbr = NY.NY.abbr,,
}
end  
for _,type in ipairs({'NY'}) do
for _,auxType in ipairs({"Alt", "Bus", "Byp", "Spur", "Truck"}) do
local spec = NY[" aux "][auxType]
NY["NY-" .. auxType] = {
shield = NY.NY.shield,
name = NY.NY.name.default .. " " .. spec.name,
link = NY.NY.base .. " " .. spec.name .. NY[" dab "],
abbr = NY.NY.abbr .. " " .. spec.abbrsuffix,
banner = spec.bannerprefix .. " plate.svg",
aux = spec.aux,,
}
end
end  
local pkwys = {
-- link-suffix => parkways
-- Do not list "Parkway" link-suffix.
[""] = {
["Bronx River NYC"] = "Bronx River Parkway",
["Saw Mill"] = "Saw Mill River Parkway",
["Robert Moses Cswy"] = "Robert Moses Causeway"
},
Drive = {
["FDR"] = "Franklin D. Roosevelt East River",
"Harlem River",
"Seven Lakes"
},
["Interstate Parkway"] = {
"Palisades"
},
Road = {
"Arden Valley",
"Tiorati Brook"
},
["State Parkway"] = {
"Bear Mountain",
"Caumsett",
"Lake Ontario",
"Robert Moses",
"Taconic",
}
}
local pkwyShields = {
default = "%route% Pkwy Shield.svg",
Belt = "%route% Pkwy Shield free.svg",
["Bronx River NYC"] = "Bronx River Pkwy Shield free.svg",
["Cross Island"] = "%route% Pkwy Shield free.svg",
["FDR"] = "%route% Drive Shield free.svg",
["FDR Drive"] = "%route% Shield free.svg",
["Grand Central"] = "%route% Pkwy Shield free.svg",
["Harlem River"] = "%route% Drive Shield free.svg",
["Harlem River Drive"] = "%route% Shield free.svg",
["Henry Hudson"] = "%route% Pkwy Shield free.svg",
["Jackie Robinson"] = "%route% Pkwy Shield free.svg",
["Korean War Vets"] = "%route% Pkwy Shield free.svg",
Pelham = "%route% Pkwy Shield free.svg",
Bay = "",
["Long Mountain"] = ""
}  
local pkwyAbbrs = {
-- link-suffix => abbr-suffix
["Interstate Parkway"] = "Parkway"
}
local pkwyLIPkwys = {
-- Parkways in Long Island that do not end with "State Parkway"
"Loop",
"Ocean",
"Robert Moses Cswy",
}
local pkwyLIStatePkwys = {
-- Parkways in Long Island that end with "State Parkway"
"Bethpage",
"Heckscher",
"Meadowbrook",
"Northern",
"Sagtikos",
"Southern",
"Sunken Meadow",
"Wantagh"
}
for _,pkwy in ipairs(pkwyLIStatePkwys) do
table.insert(pkwyLIPkwys, pkwy)
table.insert(pkwys["State Parkway"], pkwy)
end
local pkwyPIPPkwys = {
-- Parkways maintained by Palisades Interstate Park Commission
"Lake Welch",
"Palisades",
}
for _,pkwy in ipairs(pkwys.Road) do
table.insert(pkwyPIPPkwys, pkwy)
end
NY.Parkway = {
shield = pkwyShields,
name = {default = "%route% Parkway"},
link = {default = "%route% Parkway [dab||(%dab%)|]"},
abbr = {default = "%route% Parkway"},
width = {
default = 'square',
["Bear Mountain"] = 'wide',
["Cross County"] = 'wide',
["Saw Mill"] = 'wide',
["Sprain Brook"] = 'wide',
["Taconic State"] = 'wide'
},
bannersuffix = {
default = "green",
Belt = "",
["Bronx River NYC"] = "",
["Cross Island"] = "",
["FDR"] = "",
["FDR Drive"] = "",
["Garden State"] = "GSP",
["Grand Central"] = "",
["Harlem River"] = "",
["Harlem River Drive"] = "",
["Henry Hudson"] = "",
["Jackie Robinson"] = "",
["Korean War Vets"] = "",
["Merritt"] = "blue",
Pelham = "",
["Seven Lakes"] = "brown",
},
orientation = {
default = "",
Niagara = "upright",
}
}
for suffix,list in pairs(pkwys) do
local abbrSuffix = pkwyAbbrs[suffix] or suffix
for abbr,pkwy in pairs(list) do
if type(abbr) == "number" then abbr = pkwy end
if suffix == "" then
NY.Parkway.name[abbr] = pkwy
NY.Parkway.link[abbr] = pkwy
NY.Parkway.abbr[abbr] = pkwy
else
NY.Parkway.name[abbr] = pkwy .. " " .. suffix
NY.Parkway.link[abbr] = pkwy .. " " .. suffix
if abbrSuffix ~= "Parkway" then
NY.Parkway.abbr[abbr] = abbr .. " " .. abbrSuffix
end
end
end
end
for _,pkwy in ipairs(pkwyLIPkwys) do
NY.Parkway.bannersuffix[pkwy] = ""
end
for _,pkwy in ipairs(pkwyPIPPkwys) do
NY.Parkway.bannersuffix[pkwy] = "brown"
end  
NY.SBR = {
shield = "US Bike %route% (M1-8).svg",
name = "New York State Bicycle Route %route%",
link = "New York State Bicycle Route System#State Bicycle Route %route%",
abbr = "State Bicycle Route %route%",
orientation = "upright"
}  
NY.LSEX = {
shield = "LaSalle Expy.svg",
name = "LaSalle Expressway",
link = "LaSalle Expressway",
abbr = "LaSalle Expressway",
bannersuffix = "green"
}  
NY.STE = {
shield = "Southern Tier Expressway.svg",
name = "Southern Tier Expressway",
link = "Southern Tier Expressway",
abbr = "Southern Tier Expressway",
bannersuffix = "green"
}  
-- add new types above this line if you want it to have the state highway browse
for k, v in pairs(NY) do if k:find ("^%a") then
v.maint = "NYSDOT"
end
end  
for k, v in pairs(NY) do if k:find ("^%a+ %d") then
v.maint = "NYSDH"
end
end  
NY.NYST = {
shield = "NYS Thruway Sign.svg",
name = "New York State Thruway",