USGS - science for a changing world

REST Web Services

USGS Site Web Service URL Generation Tool

This tool provides a simple way to generate syntactically correct URLs to use with the USGS Site web service. Use it to get comfortable with the service before creating your own applications. Press the question mark icon for help with a particular field.

URL argument names and values are not case sensitive, ex: ?stateCd=ny, ?STATECD=ny, ?statecd=NY can all be used and are equivalent. See the full service description for details.

Simply enter the values you want in the fields below. Press Generate the URL button at the bottom to get the resulting URL. To see the results in your browser, next press the Run the Generated URL button.

You must have Javascript enabled for your browser to use this tool.

REQUIRED SITE-SELECTION FILTERS:

Major Filters:Show or hide major filter help

You must select one of the following major filters. A major filter is required to limit the list of sites and associated data that can be retrieved, ensuring fair access to the service.





Show or hide site help
You can use either site or sites for the URL argument name. sites corresponds to one or more site numbers. Separate sites with commas. There is no limit to the number of sites you can specify, however there may be limitations imposed by the HTTP GET protocol, your client application and the USGS application server. The site number may be optionally prefixed by the agency code followed by a colon, which ensures the site is unique. Examples: ?site=06306300 or ?sites=USGS:06306300. There is no default if this argument is used. Site numbers range from 8 to 15 characters. To find sites of interest, we suggest using the NWIS Mapper External Link.
Show or hide state help
URL argument name is stateCd. You may select no more than one state or territory. Example: ?stateCd=ny

URL argument name is huc. You can specify one major hydrologic unit code (2 digit code) and up to 10 minor hydrologic unit codes (8 digit codes). Separate HUCs with commas. For performance reasons, no more than one major HUC is allowed. Complete list of HUCs. External Link Note: not all sites have been associated with a hydrologic unit. As such those sites cannot be retrieved with this method. Example: ?huc=01,02070010

Show or hide Latitude/Longitude help

URL argument name is bBox for bounding box. The argument is a pair of four numbers separated by commas, beginning with the western longitude, then the southern latitude, then the eastern longitude, then the northern latitude. Note: to ensure fair access, the product of the range of latitude and longitude cannot exceed 25 degrees. Use decimal degrees rather than degrees, minutes and seconds. Decimals are not required, but only six decimals of precision will be used. Longitude is in the range of -180 to 180, latitude from -90 to 90. Remember, in the Western hemisphere, longitude is expressed in negative numbers. Example: ?bBox=-83,36.5,-81,38.5

Note: many sites outside the continental US do not have latitude and longitude referenced to NAD83 and therefore can not be found using these arguments. Certain sites are not associated with latitude and longitude due to homeland security concerns and cannot be found using this filter.






Show or hide county help
URL argument name is countyCd. Enter a list of county codes, separated by commas. There is no default. The county code is actually the state code External Link (digits 1-2) plus the associated county number (digits 3-5). For performance reasons, you may enter no more than 20 county codes. Example: ?countyCd=51059,51061 retrieves sites in Fairfax and Prince William counties in the state of Virginia. Reference External Link.



OPTIONAL SITE-SELECTION FILTERS:

Optional filters, if used, further reduce the list of sites returned.

Dates:

You can use this option to select sites that were/are serving the desired data types during the date range that you set.


Show or hide Start Date help
URL argument name is startDT. Use the ISO-8601 date format External Link. Examples: &startDT=1990-01-01. Specify a date only. Hours and timezone arguments are not allowed. If startDt is specified but endDt is not, endDt is assumed to be today's date.
Show or hide End Date help
URL argument name is endDT. Use the ISO-8601 date format External Link. Examples: &endDT=1999-12-31. Specify a date only. Hours and timezone arguments are not allowed. If endDt is specified and startDt is not, all sites at or before the endDt are returned.
Show or hide End Date help
URL argument name is period. Use the ISO-8601 duration format External Link. Examples: &period=P10W.
Show or hide parameter code help
URL argument name is siteName. This filter allows you to find a site by its name, using either the exact site name or a partial site name. Note that a major filter is still required. String matches are case insensitive, so if you specify "Boulder" you will retrieve site names with "Boulder", "boulder", "BOULDER" as well as many other variants. To embed a space, you can substitute %20. Examaple: &siteName=Boulder%20Creek
Show or hide parameter code help
URL argument name is siteNameMatchOperator. If used, this must be used with siteName. It determines how the pattern matching for the site name behaves. Matches are case insensitive. The options are:
  • start = The string must be at the start of the site name (default)
  • any = The string must be contained somewhere in the site name
  • exact = The site name must exactly match the string supplied, with the exception that the match is not case sensitive
Example: &siteNameMatchOperator=any
Show or hide parameter code help
URL argument name is siteStatus. The site status indicates whether the site is active or inactive. A site is considered active if:
  • it has collected time-series (automated) data within the last 183 days (6 months)
  • it has collected discrete (manually collected) data within 397 days (13 months)

If it does not meet these criteria, it is considered inactive. Some exceptions apply. If a site is flagged by a USGS water science center as discontinued, it will show as inactive. A USGS science center can also flag a new site as active even if it has not collected any data.

Example: &siteStatus=active
Show or hide site type help
URL argument name is siteType. You can filter for sites with certain site types. If the siteType argument does not appear in the URL, then by default all site types will be shown. Hold down CTRL/CMD to select more than one site type. Note: if you select a major site type (like Stream) you will get its minor site types (canal, ditch and tidal stream) by default even if you do not select them.
Show or hide data type help

URL argument name is hasDataTypeCd. Default is all. Restricts results to those sites that collect certain kinds of data. Separate values with commas. Allowed values are:

all - default (see above for qualifications). This is equivalent to &seriesCatalogOutput=true.
iv - Instantaneous values (time-series measurements typically recorded by automated equipment at frequent intervals (e.g., hourly)
uv - Unit values (alias for iv)
rt - Real-time data (alias for iv). Unfortunately, using "rt" may retrieve sites that are not "real-time" because it is simply an alias, e.g. it may show discontinued sites. The closest approximation of a list of real-time sites is to use &siteStatus=active
dv - Daily values (once daily measurements or summarized information for a particular day, such as daily maximum, minimum and mean)
pk - Peaks measurements of water levels and streamflow for surface water sites (such as during floods, may be either an automated or a manual measurement)
sv - Site visits (irregular manual surface water measurements, excluding peak measurements)
gw - Groundwater levels measured at irregular, discrete intervals. For recorded, time series groundwater levels, use iv or id.
qw - Water-quality data from discrete sampling events and analyzed in the field or in a laboratory. For recorded time series water-quality data, use iv or id.
id - Historical instantaneous values (sites in the USGS Instantaneous Data Archive External Link)
aw - Sites monitored by the USGS Active Groundwater Level Network External Link
ad - Sites included in USGS Annual Water Data Reports External Link

Example: &hasDataTypeCd=dv,iv

Show or hide Modified Since help

URL argument name is modifiedSince. Returns only sites whose attributes or period of record data have changed during the requested period. The modifiedSince time period always begins with today and moves toward the past. Use the ISO-8601 duration format External Link. If the modifiedSince argument is not specified in the generated URL, it has no effect on the query.

If you request period of record data (&seriesCatalogOutput=true) or specific data types to be output (outputDataTypeCd), the period of record dates will be examined and, if newer, the newest date will be used to indicate if the site was modified. Otherwise, the date a site's attributes were last changed will be used.

Partial URL examples:

  • ?stateCd=NY&modifiedSince=P1M - NY sites are retrieved only if any of their site leel attributes were changed in the last month.
  • ?stateCd=NY&seriesCatalogOutput=true&modifiedSince=P1M NY sites are retrieved only if any of their site level attributes or period of record information were changed in the last month.
  • ?stateCd=NY&outputDataTypeCd=all&modifiedSince=P1M NY sites are retrieved only if any of their site level attributes or period of record information were changed in the last month.
  • ?stateCd=NY&outputDataTypeCd=iv,dv&modifiedSince=P1M NY sites are retrieved only if any of their site level attributes or period of record information for instantaneous values or daily values were changed in the last month.
  • ?stateCd=NY&outputDataTypeCd=iv,dv&hasDataTypeCd=pk&modifiedSince=P1M NY sites are retrieved only if any of their site level attributes or period of record information for instantaneous values or daily values were changed in the last month. However, since this query only shows sites where peaks were measured, the sites have to show peaks and also record instantaneous values and/or daily values. The period of record's last changed date for instantaneous and daily values for these sites are then factored into whether a site's information has changed.
Show or hide parameter code help
URL argument names are variable or parameterCd. In this case, parameterCd means a USGS parameter, and indicates some aspect of the site being measured or calculated, such as streamflow. Either parameterCd or variable can be used. If parameterCd or variable is specified in the generated URL, only sites serving those parameters are returned. To specify more than one parameter code, separate with commas, ex: &variable=00060,00065. Complete list of parameter codes External Link. There is no limit on the number of parameter codes allowed per request. The default is all, which can be specified if desired, ex: &variable=all.
Show or hide agency code help
URL argument name is agencyCd, which indicates the organization maintaining or funding the sites. You can filter to show only sites for a specific agency code. For example, ?stateCd=tx&agencyCd=USCE would return sites in Texas for the U.S. Army Corps of Engineers only. By default if agencyCd does not appear in the URL then sites with any agency code are returned. Agency codes are 3-5 characters long with most being 5 characters in length. List of agency codes External Link.
Show or hide altitude help

URL argument names are altMin and altMax. Enter the minimum and/or maximum altitude in feet for the sites you want retrieved. If both are specified, altitudes between the minimum and maximum altitudes are included. Maximum altitude must be greater than or equal to minimum altitude. Values are inclusive, so if you specify altMin at 1000 feet, you will get sites at exactly 1000 feet or more. Selecting sites based on a desired altitude datum is presently not possible. If you leave these arguments blank, site altitude is ignored. Example: ?altMin=1000&altMax=1500.
Show or hide aquifer help
Parameter name is aquiferCd. Use this to filter sites that exist in specified national aquifers. Note: not all sites have been associated with national aquifers. Enter one or more national aquifer codes, separated by commas. A national aquifer code is exactly 10 characters. A complete list of national aquifer codes can be found here. Example: &aquiferCd=S500EDRTRN,N100HGHPLN returns groundwater sites for the Edwards-Trinity aquifer system and the High Plains national aquifers. The default is all, which means the results are not filtered to exclude any aquifer codes. It can be specified if desired, however, if a list is provided you cannot exceed 1000 aquifer codes. ex: &aquiferCd=all.
Show or hide local aquifer help
Parameter name is localAquiferCd. Use this to filter sites that exist in specified local aquifers. Note: not all sites have been associated with local aquifers. Enter one or more local aquifer codes in the field, separated by commas. A local aquifer code is 10 characters, beginning with the state's abbreviation followed by a colon followed by the local aquifer code. A complete list of local aquifer codes can be found here. To translate the state code associated with the local aquifer, you may need this reference. Example: &localAquiferCd=AL:111RGLT,AL:111RSDM returns groundwater sites for the Regolith and Saprolite local aquifers in Alabama. The default is all, which means the results are not filtered to exclude any local aquifer codes. It can be specified if desired, however, if a list is provided you cannot exceed 1000 local aquifer codes. ex: &localAquiferCd=all.

Surface Water Site Attributes:
Show or hide drainage area help

URL argument names are drainAreaMin and drainAreaMax. The values should be in whole numbers only. These arguments allows you to select surface water sites where the associated sites' drainage areas (watersheds) are within a desired size, expressed in square miles. If neither are specified, drainage area is ignored. If both the minimum and maximum drainage area are specified, sites between the minimum and maximum drainage areas specified are returned. If only one is provided, then only sites at or above the minimum drainage area or at or below the maximum drainage area are returned. Caution: not all sites are associated with a drainage area. Since drainage area only applies to surface water sites, this should not be used with groundwater sites other than springs. Example: &drainAreaMin=1000&drainAreaMax=5000


Groundwater Site Attributes:
Show or hide well depth help
URL argument names are wellDepthMin and wellDepthMax. These arguments allows you to select finished wells with the desired depth from the land surface datum, expressed in feet. If neither are specified, well depth is ignored. If both the minimum and maximum well depths are specified, then sites between the minimum and maximum well depth are returned. If only one is provided, then only sites at or above the well depth or at or below the well depth are returned. Example: &wellDepthMin=500&wellDepthMax=1000
Show or hide well depth help
URL argument names are holeDepthMin and holeDepthMax. These arguments allows you to select sites where the hole was initially drilled within a given range, with the depth from the land surface expressed in feet. If neither are specified, hole depth is ignored. If both the minimum and maximum hole depths are specified, sites between the minimum and maximum hole depth are returned. If only one is provided, then only sites at or above the hole depth or at or below the hole depth are returned. Example: &holeDepthMin=500&holeDepthMax=1000


OUTPUT FORMATS:
Show or hide format help

URL argument name is format. Select the output format desired. If there is no format argument in the generated URL, the most currently supported version of USGS RDB format is returned. Example: &format=rdb. Note: GML will become the default output format once it is available. Formats available:

  • rdb - a self-describing tab-delimited format used widely by the USGS, documented in a PDF file here External Link (Adobe Acrobat Reader External Link). Version is 1.0
  • ge - Google Earth format (KML). Version is 1.0. (USGS version 1.0 of a KML 2.2 schema)
  • gm - Google Maps format (KML). Version is 1.0. (USGS version 1.0 of a KML 2.2 schema)
  • mapper - a simple XML format used by the USGS National Water Information System Mapper External Link. Version is 1.0

Future formats not yet available:

  • gml - Geography Markup Language. Version is 3.2.1.
  • json - The most currently supported version of GML translated into Javascript Object Notation External Link. The current version of GML will be rendered in a JSON structure as a set of name/value pairs. Note: JSON is returned with an application/json MIME type. Version is 1.0.

Note on usage with Google Earth: the generated URL can be copied and pasted into Google Earth as follows: Add > Network Link

Note on usage with Google Maps: When on the Google Maps site External Link paste the generated URL into the search field, then press Search Maps.

Google Earth and Google Maps output may work in other applications and mapping services, as Keyhole Markup LanguageExternal Link (KML) is used to express the data.

The version of the format wanted, if available, can be appended using the syntax: &format=<format_type>,<version_number>. The version number is optional but its use is encouraged because it means your application is less likely to break. If you do not specify the version number in your syntax, the most recently implemented version in that format will be returned instead. In some cases, if there is no known version of a format, 1.0 is used to distinguish it.

Show or hide site output help

URL argument name is siteOutput. If you would like to see expanded site information, check this box. This argument is ignored for visually oriented output formats like Mapper, Google Earth and Google Maps. The default is basic. Use expanded to get expanded site information. Example: &siteOutput=expanded. Note: for performance reasons, &siteOutput=expanded cannot be used if seriesCatalogOutput=true or with any values for outputDataTypeCd.

Show or hide series catalog output help

URL argument name is seriesCatalogOutput. This argument is ignored for visually oriented output formats like Mapper, Google Earth and Google Maps. If you would like to see all the period of record information for the sites selected, check this box. You will see detailed information, such as a continuous range of dates served by a site for one or more data types, for example, the begin and end dates that streamflow (parameter 00060) was recorded at a site. Note: if you select any data types for output (see below) the period of record data will also appear. In that case specifying this argument is unnecessary. The default is false. The only legal values for this argument are true and false. Example: &seriesCatalogOutput=true. &seriesCatalogOutput=true is equivalent to &outputDataTypeCd=all. Note: for performance reasons, &siteOutput=expanded cannot be used if seriesCatalogOutput=true.

Show period of record information about these data types:Show or hide period of record output help

URL argument name is outputDataTypeCd. This will add period of record information to certain output formats (GML, RDB and JSON) that summarize information about the data types requested. The default is all data types. Some output formats are designed for visual use (Google Earth, Google Maps and Mapper). Consequently with these formats you will not see data type code information.

Default information: If seriesCatalogOutput is true, all period of record information is shown by default. If seriesCatalogOutput is false, unless you override it using one of the values below, no period of record information is shown.

Note: for performance reasons, &siteOutput=expanded cannot be used if with any values for outputDataTypeCd.

Here are the various output data type codes available. These can be selected individually or can be added as comma separated values if desired. Example: &outputDataTypeCd=iv,dv

all - default (see above for qualifications). This is equivalent to &seriesCatalogOutput=true.
iv - Instantaneous values (time-series measurements typically recorded by automated equipment at frequent intervals (e.g., hourly)
uv - Unit values (alias for iv)
rt - Real-time data (alias for iv)
dv - Daily values (once daily measurements or summarized information for a particular day, such as daily maximum, minimum and mean)
pk - Peaks measurements of water levels and streamflow for surface water sites (such as during floods, may be either an automated or a manual measurement)
sv - Site visits (irregular manual surface water measurements, excluding peak measurements)
gw - Groundwater levels measured at irregular, discrete intervals. For recorded, time series groundwater levels, use iv or id.
qw - Water-quality data from discrete sampling events and analyzed in the field or in a laboratory. For recorded time series water-quality data, use iv or id.
id - Historical instantaneous values (sites in the USGS Instantaneous Data Archive External Link)
aw - Sites monitored by the USGS Active Groundwater Level Network External Link
ad - Sites included in USGS Annual Water Data Reports External Link

Caution: queries that return large sets of data may cause your browser to slow down or lock as it attempts to download and format large sets of data for display. When testing services in a browser, it is suggested that you create queries that should return relatively small sets of data. When creating an application you will typically use a program like curl , wget or the Windows task scheduler to retrieve data, which should acquire data more quickly than a browser.

(Note: if you do not see the XML in the output, please View Source.)