Borbin the 🐱

Nikon Lens Queries

03 July, 2023


http://www.photosynthesis.co.nz/nikon/lenses.html is an extensive list of all Nikon Lenses, but as a simple web page also limited to data queries.

I created a PowerShell script to download and convert the html page to a JSON file to allow lens data queries.

See https://github.com/jurgen178/NikonLenses for the PowerShell script.

(Permission granted from photosynthesis.co.nz)


Example queries:

# Filter the result for specific lens data.

# Get all 6/2.8 lenses with AI.
$ai = $allLensData.Where({ $_.Type.Contains("Ai") -and $_.Lens -eq "6/2.8" })

# Get all AI-S 6/2.8 lenses.
$ais = $allLensData.Where({ $_.Type -eq "Ai-S" -and $_.Lens -eq "6/2.8" })

# Get all 16mm Fisheye lenses.
$16mmFisheye = $allLensData.Where({ $_.Group -eq "Fisheye" -and $_.Lens.StartsWith("16/") })

# Get all AF lenses out of the 16mm Fisheye lenses.
$AF16mmFisheye = $16mmFisheye.Where({ $_.Type -match "AF" })

# Get all 24-85 lenses.
$24_85 = $allLensData.Where({ $_.Lens.StartsWith("24-85/") })

# Get all light lenses <200g.
$lightLenses = $allLensData.Where({ $_.Weight.Length -gt 0 -and [int](($_.Weight -replace '^(\d+).*$', '$1')) -lt 200 })

# Get all heavy lenses >2000g.
$heavyLenses = $allLensData.Where({ [int](($_.Weight -replace '^(\d+).*$', '$1')) -gt 2000 })

# Get the first 5 heaviest lenses.
$first5heavyLenses = $heavyLenses.GetEnumerator() | Sort-Object { [int]($_.Weight) } -Descending | Select-Object -First 5

# 1200-1700/5.6-8 IF-ED Ai-P (16000g)
# 1000/6.3 Reflex F (9900g)
# 50cm/5 T·C S, M39 (8500g)
# 360-1200/11 ED Ai-S (8250g)
# 2000/11 Reflex A,C (7500g)
foreach ($lens in $first5heavyLenses) {
    "$($lens.Lens) $($lens.Type) ($($lens.Weight)g)"
}

# Get all constant f/2.8 aperture lenses.
$aperture_2_8 = $allLensData.Where({ $_.Lens -match "/2.8(\s|$)" })

# Get all Z mount VR lenses.
$vr = $allLensData.Where({ $_.Type.Contains("Z") -and $_.Lens.Contains("VR") })

# Get all DX lenses out of the Z mount VR lenses.
$vrdx = $vr.Where({ $_.Type -eq "Z DX" })

# Print result.
# 12-28/3.5-5.6 PZ VR Z DX
# 16-50/3.5-6.3 VR Z DX
# 18-140/3.5-6.3 VR Z DX
# 50-250/4.5-6.3 VR Z DX
foreach ($lens in $vrdx) {
    "$($lens.Lens) $($lens.Type)"
}


Or print all lens data.

# Print all lens data by group.
foreach ($lensGroup in $lenses.PsObject.Properties) {
    "$($lensGroup.Name) ($($lensGroup.Value.count))"

    $lensGroup.Name
    foreach ($lens in $lensGroup.Value) {
        $lens
    }
}