ERDDAP Easier access to scientific data
|
Brought to you by
NOAA
NMFS
SFSC
ERD
|
ERDDAP > Computer Programs
Accessing ERDDAP as a Web Service
In addition to ERDDAP's methods for requesting data from remote data sources
(griddap for gridded data and
tabledap for tabular data),
and for requesting maps via Make A Graph and
WMS.
ERDDAP lets computer programs access features in ERDDAP's interface (for example, the Full Text Search for Datasets).
These features can be used to build another web service on top of ERDDAP (making ERDDAP do all the work!).
So if you don't like ERDDAP's interface, we encourage you to build your own, and use ERDDAP as the foundation.
Your program can get data from our ERDDAP server, or you can
set up your own ERDDAP server.
Requests
Requests for interface information from ERDDAP (for example, search results) use the web's universal standard for requests:
HTTP GET.
This is the same mechanism that your browser uses when you fill out a form on a web page and click on Submit.
To use HTTP GET, you generate a specially formed URL (perhaps with a query) and send it to the web with HTTP GET.
You can form these URLs by hand and enter them in the address textfield of your browser
(for example, http://coastwatch.pfeg.noaa.gov/erddap/search/index.htmlTable?searchFor=all),
or a computer program can be written to create the URLs, submit them, and get the responses.
Often, the computer program will need to
percent encode the URL (for example, replace "[" with "%5B").
Programming languages have tools to do this (for example, see
java.net.URLEncoder).
HTTP GET was chosen because it is simple, it works, it is universally supported, and it is a foundation of
REST and
ROA.
These URLs are great because they completely define a given request,
and you can bookmark them in your browser, write them in your notes, email them to a friend, ...
Requesting Compressed Files
ERDDAP doesn't offer results stored in compressed (e.g., .zip or .gzip) files.
Instead, ERDDAP looks for
accept-encoding
in the HTTP GET request header sent by the client.
If a supported compression type ("gzip", "x-gzip", or "deflate") is found in the accept-encoding list,
ERDDAP includes "content-encoding" in the HTTP response header
and compresses the data as it transmits it.
It is up to the client program to look for "content-encoding" and decompress the data.
Browsers and OPeNDAP clients do this by default. They request compressed data and decompress the returned data automatically.
Other clients (e.g., Java programs) have to do this explicitly.
Responses
Although humans using browsers want to receive interface results (for example, search results) as HTML documents,
computer programs often prefer to get results in simple, easily parsed, less verbose documents.
ERDDAP can return interface results as a table of data in these common, computer-program friendly, file types:
- .csv - Download the data as comma-separated ASCII text table (missing value = 'NaN'; times are ISO 8601 strings). (more info)
- .htmlTable - View an HTML file with the data in a table (times are ISO 8601 strings). (more info)
- .json - Download the data as a JSON table (missing value = 'null'; times are ISO 8601 strings). (more info)
- .mat - Download a MATLAB binary file. (more info)
- .tsv - Download the data as tab-separated ASCII text table (missing value = 'NaN'; times are ISO 8601 strings). (more info)
- .xhtml - View an XHTML file with the data in a table (times are ISO 8601 strings). (more info)
The first row of the table has the column names.
In some types of files, the second row has the column's Java-style data type (e.g., "String" or "float").
Subsequent rows of the table have the results.
.csv and .tsv issues:
- If a datum in a .csv file has internal double quotes or commas, ERDDAP follows the .csv specification strictly: it puts double quotes around the datum and doubles the internal double quotes.
- If a datum in a .csv or .tsv file has internal newline characters, ERDDAP converts the newline characters to character #166 (¦). This is non-standard.
Remember that these are the file types ERDDAP can use to respond to user-interface types of requests (for example, search requests).
ERDDAP supports a different set of file types for the actual data (for example, satellite and buoy data) requests (see
griddap and
tabledap).
Access URLs
ERDDAP has these URL access points for computer programs:
- The list of the main resource access URLs can be returned as a
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The current list of all datasets can be returned as a .csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- Info about a specific data set (the list of variables and their attributes) is returned by a call to
http://coastwatch.pfeg.noaa.gov/erddap/info/<datasetID>/index<fileType> ,
for example, a .csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The results of full text searches for datasets can be returned as a (for example)
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
(Replace "all" in the example with your
percent-encoded search words.)
- The list of categoryAttributes can be returned as a
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The list of categories for a specific categoryAttribute can be returned as a (for example)
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The list of datasets in a specific category can be returned as a (for example)
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The current list of datasets which can be accessed by the various protocols can be returned as
- For griddap: a
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- For tabledap: a
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- For WMS: a
.csv,
.htmlTable,
.json,
.mat,
.tsv, or
.xhtml document.
- The Data Access Forms are just simple web pages to generate URLs which request data (e.g., satellite and buoy data).
The Make A Graph pages are just simple web pages to generate URLs which request graphs of a subset of the data.
Your program can generate these URLs directly. For more information, read about
griddap,
tabledap, and
WMS.
griddap and tabledap can return data in many common file formats. See their documentation for details.
Note that griddap and tabledap can return
.dds
files with the dataset's structure, including variable names.
Note that griddap and tabledap can return
.das
files with all of the dataset's
metadata.
- Need other types of information?
The links above are just the first batch of links to provide access to information from ERDDAP.
If you have suggestions for additional links,
contact bob.simons@noaa.gov.
Using ERDDAP as a Data Source within Your Java Program
As described above, since Java programs can access data available on the web,
you can write a Java program that accesses data from any publicly accessible ERDDAP installation.
Or, since ERDDAP is an all-open source program, you can also set up your own copy of ERDDAP
on your own server (internal or public) to serve your own data.
Any Java programs that you write can get data from that copy of ERDDAP.
Or, since ERDDAP is an all-open source, all-Java program,
you can also set up your own copy of ERDDAP on your own computer within your Java program.
Then you can access ERDDAP's services from within your program
(for example, doing full-text searches for datasources or creating data files from remote data sources) .
See Set Up Your Own ERDDAP,
especially the JavaDocs for the gov.noaa.pfel.erddap.Erddap class.
ERDDAP Version 1.12
Questions, comments, suggestions? Contact bob dot simons at noaa dot gov.
ERDDAP is a brought to you by
NOAA
NMFS
SFSC
ERD.
Disclaimers |
Privacy Policy
Usage Limitations - The SeaWiFS images and data from this site may be used for free, but not redistributed;
all other images and data from this site may be used and redistributed for free.