THL Toolbox > Developers' Zone > Gis Development > Consumption Of The Place Dictionary And Knowledge Maps Apis
Contributor(s): Tom Benner
The THL interactive map uses data from both the Place Dictionary and Knowledge Maps by calling their APIs. General documentation for these APIs can be found on these pages: Using RoR Knowledge Maps Web Services and Using RoR Place Dictionary Web Services.
The map uses the Place Dictionary API in the following tasks:
Once the GetFeature response is returned, http://places.thlib.org/feature/[fid].js is called for each of the response's FIDs. Attributes like .header and .types.type of each of these responses are used to create the text of the feature list.
Once the feature is added, its layer must be given an appropriate name. To do this, http://places.thlib.org/feature/[fid].js is called, and the layer's name is set to the .header attribute of the result.
The map uses the Knowledge Maps API in the following tasks:
The data that forms the basis for the feature types tree is located at http://tmb.thlib.org/categories/20/children/with_features.js. On page load, this JSON is used to create a hierarchical unordered list, formatted with a structure appropriate for the jQuery CheckTree plugin to transform it into a check tree.
NB: Since a great deal of computation is required to create the JSON at the API address above, the result takes some time to be returned. Consequently, a saved version of the JSON is currently being used on the interactive map, but we are planning to add caching functionality which will make this extra step unnecessary.