Accessing Services
Geospatial services are generated automatically for each ScienceBase item and follow a standard naming convention. The service end-point is generated at https://www.sciencebase.gov/catalogMaps/mapping/ows/[id]. WMS, WFS, and WCS can each be accessed through this URL, using the standard parameters.
Example
Consider a ScienceBase item with the identifier 4f4e4ad5e4b07f02db683919, which can be found at https://www.sciencebase.gov/catalog/item/4f4e4ad5e4b07f02db683919. When viewing this item in the ScienceBase user interface, one sees a map overview of the contents of the shape file facet contained by this item. Further, this item has a footprint.
To find the underlying spatial services provided by the system, select the Advanced Services link in the menu shown above the map. A dialog box will appear that contains links to the services provided for this item. In this case, ScienceBase provides WMS and WFS services for two layers: the shape file layer, named Fault_Poly. The links direct the user to the GetCapabilities documents for each of these services. These are standard XML documents described by the OGC specifications that enumerate the capabilities of each service. It is possible, from this XML, to determine what layers are available and in what projections.
WMS Services
The OGC Web Mapping Service endpoint provides rendered images of geospatial products. Typically, you will generate an image in PNG or JPEG format, but others are supported, as described in this snippet from the GetCapabilities XML. This service is supported for vector and raster spatial types.
<Format>image/png</Format> <Format>application/atom+xml</Format> <Format>application/pdf</Format> <Format>application/vnd.google-earth.kml+xml</Format> <Format>application/vnd.google-earth.kmz</Format> <Format>image/gif</Format> <Format>image/jpeg</Format> <Format>image/svg+xml</Format> <Format>image/tiff</Format>
The most useful capability supported by a WMS service is called GetMap. A GetMap request has a variety of parameters:
Parameter | Required? | Description |
---|---|---|
service | Yes | Service name. Value is WMS. |
version | Yes | Service version. Value is one of 1.0.0, 1.1.0, 1.1.1, 1.3 |
request | Yes | Operation name. Value is GetMap. |
layers | Yes | Layers to display on map. Value is a comma-separated list of layer names. Read below for more on the various available layers. |
styles | Yes | Styles in which layers are to be rendered. Value is a comma-separated list of style names, or empty if default styling is required. Style names may be empty in the list. |
srs or crs | Yes | Spatial Reference System for map output. Value is in formEPSG:nnn. crs is the parameter key used in WMS 1.3.0. |
bbox | Yes | Bounding box for map extent. Value is minx,miny,maxx,maxy in units of the SRS. |
width | Yes | Width of map output, in pixels. |
height | Yes | Height of map output, in pixels. |
format | Yes | Format for the map output. See the list above or the capabilities XML document for supported values. |
transparent | No | Whether the map background should be transparent. Values aretrue or false. Default is false |
bgcolor | No | Background color for the map image. Value is in the form RRGGBB. Default is FFFFFF (white). |
exceptions | No | Format in which to report exceptions. Default value isapplication/vnd.ogc.se_xml. Other valid values areapplication/vnd.ogc.inimage and application/vnd.ogc.se_blank. |
Here is an example of a GetMap request that returns a transparent 680x350 PNG file for the example item above. It uses the EPSG:900913 projection, which is web mercator.
Much more is possible with this and other features of the WMS service. Please reference the GeoServer WMS documentation or the WMS specification for more information.
WFS Services
This service provides access to geospatial vector data in various formats. As such, it is only supported for vector sources of data. Our services will export in the following formats:
<ResultFormat> <GML2/> <GML3/> <SHAPE-ZIP/> <CSV/> <GEOJSON/> </ResultFormat>
Excellent help on using WFS is available at http://docs.geoserver.org/stable/en/user/services/wfs/index.html.
WCS Services
WCS is the Web Coverage Service standard that provides access to raster data. Excellent information on using a WCS service is again available from GeoServer at http://docs.geoserver.org/stable/en/user/services/wcs/index.html.
KML Reflector
The KML reflector provides a short-hand way to get KML output without having to construct a complicated WMS string.
More information is available at http://docs.geoserver.org/stable/en/user/googleearth/features/kmlreflector.html?highlight=kml.
ScienceBase Layer Types
Footprint
Each ScienceBase item may have a "footprint," which is basic spatial data to communicate the spatial context of an item. This may take the form of a single representational point or more complex points, lines, and polygons.
This layer is available through WMS and WFS services for items that have footprints.
Children
This layer provides point data showing where all of the child items of this item are located. Each representational point for underlying items is available.
This layer is available through WMS and WFS services for items that have children with footprints.
Extensions
ScienceBase items may have extensions that contain further geospatial data, like GeoTIFF files or ESRI Shapefiles. These are available as additional layers in the spatial services. Each layer has the same name as the associated extension on the ScienceBase item. Most often, this is the filename.
Rasters
Raster types, like GeoTIFF files, are made available through WMS and WCS services.
Shapefiles
Shapefiles, which contain vector data, are made available through WMS and WFS services.
SLD Styling
It is possible to control the styling of raster and shapefile extension services by attaching an SLD (styled layer descriptor) file to the extension's list of files, as illustrated by the image below. Notice that the extension contains both a GeoTIFF and an SLD file for coloring it.
Before:
After:
Here is the simple example SLD file used above that creates a two-color ramp between values, as well as transparency for the rest of the map.
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NamedLayer> <Name>Two color gradient</Name> <UserStyle> <Title>Two color gradient</Title> <FeatureTypeStyle> <Rule> <RasterSymbolizer> <ChannelSelection> <GrayChannel> <SourceChannelName>1</SourceChannelName> </GrayChannel> </ChannelSelection> <ColorMap> <ColorMapEntry color="#0000ff" opacity="0" quantity="-3.4028234663852886E38"/> <ColorMapEntry color="#191970" quantity="0.0"/> <ColorMapEntry color="#87cefa" quantity="1.0"/> </ColorMap> </RasterSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
Map Packages
Map packages are an ESRI format that packages a complete ESRI map into a compressed file. Once uploaded to ScienceBase, an automated process creates a service for each map package on an ArcGIS Server platform. The URL to the associated service can be obtained by concatenating the servicePath value from the extension JSON with the following url: http://www.sciencebase.gov/catalogMaps/services/Catalog/.
{ "facets": [ {"files": [ { "name": "New File Geodatabase (23).gdb.7z", "contentType": "x-gis/x-mpk", "contentEncoding": null, "pathOnDisk": "__disk__39/56/4d/39564df57f4ed0a51a91d67c3dbb3f6730121648", "url": "https://www.sciencebase.gov/catalog/file/get/4fbebeace4b0cd41ada3819c?f=__disk__39%2F56%2F4d%2F39564df57f4ed0a51a91d67c3dbb3f6730121648", "size": 13632282 } ], "processingMessage": "", "servicePath": "4fbebeace4b0cd41ada3819c", "processingState": "success", "name": "New File Geodatabase (23).gdb.7z", "className": "gov.sciencebase.catalog.item.facet.MapPackageFacet" }] }
External Links
- OGC WMS Specification: http://www.opengeospatial.org/standards/wms/
- OGC WFS Specification: http://www.opengeospatial.org/standards/wfs/
- OGC WCS Specification: http://www.opengeospatial.org/standards/wcs/
- Geoserver Documentation: http://docs.geoserver.org/