Skip to main content

GeoBlacklight Plugin for Omeka: Finding the correct URIs for U.S. states from the GeoNames API

Technology:

The GeoBlacklight plugin for Omeka includes a very handy feature in the Spatial Coverage field. A user can type in a place term, which will query GeoNames, and produce a dropdown list of options.  The user selects a value from the list, and this will pull in the GeoNames URI as well as the bounding box coordinates.

Issue:

The dropdown list will only display the first 12 items returned for any given term.  Occasionally, this list will not include the desired value.  Searching for several different U.S. states will trigger this problem.  The screenshots below show a search for Florida.




Typing in “Florida” will not return the GeoNames URI for the state in the selectable list.




Typing in “State of Florida” does return the desired value at the top of the list.


A Discovery:
All of the states in the U.S. have two possible formatting options that may (or may not) show up in the dropdown list in Omeka. One will say "State of Florida" and one will just say the "Florida". Both have identical URIs.  However, the preferred format for the GeoBlacklight Plugin for Omeka is:

NumericCode: StateName (country, state, region,...), StateName, United States


Example:
4829764: Alabama (country, state, region,...), Alabama, United States


What’s Going On in the GeoBlacklight / GeoNames Plugin:


There are multiple functions that we are performing when we use the GeoNames plugin:

1. An API that actually queries the GeoNames database.  

2. A JQuery script that produces a dropdown list of selectable options.
  • I don't really understand how the results are prioritized in the list
  • Some states won't appear on the first page of the dropdowns if you type in as "California"
  • All states will appear as the first result in the dropdown if you type in as "State of California"

3. A PHP script that writes the bounding box coordinates to the GeoRSS Box field in the exported GeoBlacklight JSON
  • This only happens if the GeoRSS box is empty (no coordinates were entered manually)
  • The script only looks for the numeric code in the Spatial Coverage field.  It will work even if you only enter "4829764:" in the field.

4. A PHP script that reformats the entry and writes a simpler text string to the Spatial Coverage field in the exported GeoBlacklight JSON

  • "4829764: Alabama (country, state, region,...), Alabama, United States" becomes "Alabama, United States" (preferred)
  • 4829764: State of Alabama (country, state, region,...), Alabama, United States becomes "State of Alabama, Alabama, United States"
  • "4829764: Alabama” becomes “,bm” (not good)
===========

Best method for entry when adding U.S. STATES


Use this spreadsheet.  Copy and paste the full string into your own metadata, spreadsheet, or editor.  



--
Thanks to task force members and student workers at the University of Michigan for discovering this issue!