Dynamic Page of TNM Services List
http://viewer.nationalmap.gov/example/services.html
This simple code makes it easy for a another user to see all the exact service URLs grouped logically as laid out in The National Map viewer for another developer to copy to use to embed in their application.
This page uses the DOJO Javascript framework to call the JSON configuration file in use by the viewer or any instance of the viewer. The JSON Configuration file, much like the XML OGC Context Profile, is the heart of the TNM Viewer configuration. It contains what services will show in the viewer, how they are setup, etc. for that viewer context.
For example:
By default, it just calls the default TNM Viewer JSON file:
http://viewer.nationalmap.gov/viewer/js/config/default.json
Or for the new NHD Viewer, add ?nhd
http://viewer.nationalmap.gov/example/services.html?nhd
to call the nhd.json file
http://viewer.nationalmap.gov/viewer/js/config/nhd.json
which has a slightly different URL configuration
viewer.nationalmap.gov/nhd or viewer.nationalmap.gov/viewer?p=nhd
You know which JSON to call as it is the p parameter in the URI for instance, p=nhd
It parses the JSON, first looking at the basemap buttons for the background maps, then the overlays sections for the different data layer groups. It reads the Name, type of service, service URL, counts the layers, and reads the legend URL. (View the source of the code to see the JSON reader).
This JSON reader code also could be copied to be used as a JSON file reader for any Viewer to use to bring in these list of services into their Google Maps, Bing Maps, OpenLayers Viewer. Copy the file if want to use the javascript or enhance it.
Florin Alexandrescu (falex@usgs.gov), ATA Contractor to TNM/USGS
David Hughes (drhughes@usgs.gov), TNM Government Manager
Voting
