Place data comes from an XML file maintained by Facilities located at http://web.mit.edu/campus-map/search-data/bldg_data.xml. It’s about 1 MB, so I recommend not opening that link in your browser.
The URL to bldg_data.xml isn’t guaranteed to stay the same, so instead of pulling it live from the campus-map Athena locker it should be included in this project’s resources and manually updated and deployed as needed.
Symfony code for getting the file from where we keep it:
$filename = $this->get('kernel')->locateResource("@MITMobileBundle/Resources/data/xml/bldg_data.xml");
Searching should happen locally on the mobile server using bldg_data.xml rather than depending on whereis.mit.edu for searches. It may need to be converted to some intermediate format if parsing and searching 1 MB of XML for each query ends up being slow or resource intensive.
Searches should find case insensitive, whole word matches (e.g. “building” but not “uilding”) in:
/object/bldgnum
(e.g. “W20”)/object/name
(e.g. “Stratton”)/object/category
(e.g. “building”)/object/contents/name
(e.g. “Taqueria”)/object/contents/category
(e.g. “food”)And not find matches in the XML file’s other elements.
The contents of the XML file can mostly be converted as is into JSON. The only differences are:
<object id="foo">
into "id": "foo"
.bldgnum
is output as a string.lat_wgs84
and long_wgs84
are output as numbers.category
and contents/*/category
are output as arrays of strings.<contents>
elements into a single "contents": []
array.<floorplans>
or <poly>
elements.{
"id": "object-6",
"name": "Eastman Laboratories",
"lat_wgs84": 42.35953993,
"long_wgs84": -71.09045076,
"bldgnum": "6",
"bldgimg": "http://web.mit.edu/campus-map/objimgs/object-6.jpg",
"category": [
"building"
],
"street": "182 Memorial Drive (Rear)",
"mailing": "77 Massachusetts Avenue",
"viewangle": "north side",
"architect": "Coolidge & Carlson",
"contents": [
{
"name": "6-120",
"category": [
"room"
]
},
{
"name": "Materials Science and Engineering, Dept. of",
"url": "http://dmse.mit.edu/"
},
{
"name": "Spectroscopy Laboratory",
"url": "http://web.mit.edu/spectroscopy/"
},
{
"name": "Science, School of",
"url": "http://web.mit.edu/science/"
},
{
"name": "Chipman Room (6-104)"
},
{
"name": "Lactation Room (6-236)",
"url": "http://hrweb.mit.edu/worklife/child-care-parenting/breastfeeding-support/lactation-rooms/campus"
},
{
"name": "Lactation Room (6C-247)",
"url": "http://hrweb.mit.edu/worklife/child-care-parenting/breastfeeding-support/lactation-rooms/campus"
}
]
}