Years ago, CS50 had an API (application programming interface) for Harvard’s map, so that students could integrate maps of campus into their own final projects. The API eventually fell by the wayside as CS50’s infrastructure evolved, but, now, that API is back!

Via a simple HTTP-based API can students now search for buildings like Wigglesworth Hall via simple GET requests. For instance, https://cs50.readthedocs.io/api/map/ will return JSON like:

[
  {
    "address": "6 Harvard Yard", 
    "city": "Cambridge", 
    "geometry": {
      "point": [
        -71.1162317399999, 
        42.3728310430001
      ], 
      "polygons": [
        [
          [
            -71.11589956799997, 
            42.37279049500006
          ], 
          [
            -71.11594347499994, 
            42.372702323000055
          ], 
          [
            -71.11600147799999, 
            42.37271820400008
          ], 
          [
            -71.11600269399997, 
            42.37271576400008
          ], 
          [
            -71.11610170199998, 
            42.37274287200006
          ], 
          [
            -71.11610013999996, 
            42.37274601000007
          ], 
          [
            -71.11640570199995, 
            42.372829671000034
          ], 
          [
            -71.11640749999998, 
            42.37282606200006
          ], 
          [
            -71.11650843499996, 
            42.37285369800003
          ], 
          [
            -71.11650663799998, 
            42.37285730600007
          ], 
          [
            -71.11656312399998, 
            42.37287277200005
          ], 
          [
            -71.11652030599998, 
            42.37296030500005
          ], 
          [
            -71.11589956799997, 
            42.37279049500006
          ]
        ]
      ]
    }, 
    "id": 997, 
    "image": "https://devsmap.cadm.harvard.edu/images/root_images/03323.jpg", 
    "name": "Wigglesworth Hall, Entries A,B,C+D"
  }, 
  {
    "address": "6 Harvard Yard", 
    "city": "Cambridge", 
    "geometry": {
      "point": [
        -71.117157489, 
        42.373083326
      ], 
      "polygons": [
        [
          [
            -71.11674415099998, 
            42.37302187700004
          ], 
          [
            -71.11676889299997, 
            42.37297193200004
          ], 
          [
            -71.11678784399999, 
            42.37293177000004
          ], 
          [
            -71.11679359399994, 
            42.37293354600007
          ], 
          [
            -71.11684414499996, 
            42.37294797100003
          ], 
          [
            -71.11684574399999, 
            42.37294474200007
          ], 
          [
            -71.11694710199998, 
            42.37297234700003
          ], 
          [
            -71.11694550299995, 
            42.372975576000044
          ], 
          [
            -71.11740777999995, 
            42.37310117900006
          ], 
          [
            -71.11741015999996, 
            42.37309832700004
          ], 
          [
            -71.11750781999996, 
            42.37312492400008
          ], 
          [
            -71.11750300299997, 
            42.37312714900003
          ], 
          [
            -71.11757062399994, 
            42.37314577600006
          ], 
          [
            -71.11752645499996, 
            42.37323494200007
          ], 
          [
            -71.11674415099998, 
            42.37302187700004
          ]
        ]
      ]
    }, 
    "id": 1159, 
    "image": "https://devsmap.cadm.harvard.edu/images/root_images/03322.jpg", 
    "name": "Wigglesworth Hall, Entries E,F,G,H+I"
  }, 
  {
    "address": "6 Harvard Yard", 
    "city": "Cambridge", 
    "geometry": {
      "point": [
        -71.117856715, 
        42.3732810010001
      ], 
      "polygons": [
        [
          [
            -71.11770292099999, 
            42.37328923700005
          ], 
          [
            -71.11774775899994, 
            42.37320090400004
          ], 
          [
            -71.11800155099996, 
            42.37327055600008
          ], 
          [
            -71.11801092199994, 
            42.37327307900006
          ], 
          [
            -71.11796559599998, 
            42.373360913000056
          ], 
          [
            -71.11770292099999, 
            42.37328923700005
          ]
        ]
      ]
    }, 
    "id": 1449, 
    "image": "https://devsmap.cadm.harvard.edu/images/root_images/03321.jpg", 
    "name": "Wigglesworth Hall, Entries J+K"
  }
]

In addition to providing students’ with each building’s address, city, id, image, and name, the API also provides a building’s geometry, the value of which includes a point for that building (e.g., its centroid) and also one or more polygons, which collectively describe the building’s footprint.