Consumption Of The Place Dictionary And Knowledge Maps Apis

THL Toolbox > Developers' Zone > Gis Development > Consumption Of The Place Dictionary And Knowledge Maps Apis

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.

Place Dictionary API

The map uses the Place Dictionary API in the following tasks:

Populating the Feature List on a Location Click

Once the GetFeature response is returned, external link: 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.

Adding a Feature by FID

Once the feature is added, its layer must be given an appropriate name. To do this, external link: http://places.thlib.org/feature/[fid].js is called, and the layer's name is set to the .header attribute of the result.

Knowledge Maps API

The map uses the Knowledge Maps API in the following tasks:

Creating the Feature Types Tree

The data that forms the basis for the feature types tree is located at external link: 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.

Provided for unrestricted use by the external link: Tibetan and Himalayan Library