Issues with PortalMapChannel - version 1.0.4
When a query is submitted, it is used to search a Yale buildings xml file to see if there is a match on building name, abbreviation, street address, or alternate name. If one or more matches are found, the Google client geocoder is called for each match, through ajax to retrieve the latitude and longitude, and the marker is placed on the map. A separate call to google maps is made with the original query to see if any other matches are found. There are several issues with this approach.
- The search of the Yale buildings xml is slow and inefficient. Since the latitude and longitude will not change for a given address it is inefficient to look it up for each search.
- The goal is to have the Yale buildings appear first in the list of markers, but this does not happen if the call to google maps completes first. While the javascript that attempts to sequence the ajax calls appears to work properly in Firefox, in other browsers, the call to google maps generally completes before the Yale building search is completed.
- The current approach loads a copy of the spreadsheet used for the Yale Map and transforms it to a format used by the PortalMapChannel. This occurs for each search request. Once again this is inefficient since the spreadsheet rarely changes.
Modifications made
- Created new service YaleBuildingService that automatically loads geocoded buildings on startup. The file is /usr/local/external_resources/geocodedBuildings.xml. The format is the same as the original with the following additional attributes: latitude, longitude, searchText. Sample:
<buildings> <building abbreviation="ARG" accuracy="6" address="North Frontage Road" alternateName="" latitude="41.3070233" longitude="-72.9387918" name="Air Rights Garage" searchText="arg~air rights garage~north frontage road~" zip="06511"/> ... </buildings>
- The Office of the University Printer (Lesley Baier - primary contact) maintains the buildings.xml file for the Yale Map web site. He is notified -about new Yale buildings/changed names/ etc., by Beth Anderson (elizabeth.j.anderson@yale.edu) in Facilities, who maintains Yale's buildings/space inventory master list. We have requested that Beth notify susan.bramhall@yale.edu, roger.despres@yale.edu, and mary.hunt@yale.edu when changes are made. The copy for the Yale Map website resides on jose as /fs01/campus_map/map_assets/spreadsheets/buildings.xml. Unix Systems has set up a nightly process to scp this file to /usr/local/external_resources/buildings.xml on the portal development server.
- The source file for the buildings is in /usr/local/external_resources/buildings.xml which is copied nightly from jose/ to jerry (portal development server).
- When the file changes, a member of the portal team will copy it down to a desktop folder located at /usr/local/external_resources, and run an ant task to regenerate geocodedBuidings.xml. In order to run the ant task, the PortalMapChannel must be built locally. The ant commands are described below.

As of 10/30/2009, the ant tasks do not complete properly - they hang once the cernunnos scripts are complete. This does not affect the process described below, but means that you need to CTL-C to exit the task. ant -buildfile geocode-buildings.build.xml geocodeBuildings
This task reads the buildings.xml, geocodes each building, and writes out geocodedBuildings.xml. Note that some buildings may not be geocoded for a number of reasons. If the address is not specific enough, the google geocoding service will return either an Unknown Address or Unavailable Address return code. If the service determines that too many requests are submitted, it may reject some records. When the process is complete, it displays the counts. If there are any counts under "Too Many Queries" or "Other Errors", run the next ant process to see if the errors can get resolved. Records for Unavailable Address (error=603) or Unknown Address(error=602) could be corrected if Beth or Lesley can provide additional information.
ant -buildfile geocode-buildings.build.xml updateMissingLocations
This task reads the geocodedBuildings.xml file, attempt to code any buildings that are missing a longitude and latitude, and rewrite the geocodedBuildings.xml. As with the geocodeBuildings task, a set of counts display. This process can be run multiple times if necessary, but will not correct Unknown/Unavailable address issues unless the underlying data is corrected.
- After generating the new file, upload it to development.portal.yale.edu on jerry into the /usr/local/external_resources directory.
- Run the ReloadYaleBuildings portlet to reload the geocodedBuildings.xml into memory. This is a cernunnos portlet deployed as part of the PortalMapChannel app.
- When a search is initiated from the PortalMapChannel, the GoogleMapSearchFrameController, searches the gecodedBuildings xml using xpath expressions and returns xml containing the matching buildings back to the view. The javascript parses this file, adding points on the map prior to performing a regular google map search on the query string. This causes Yale buildings to always show up first.