SkyServer: Application Programmer's Interface
 
API: Programmer's Interface
DR7 Help
 Site News
 Introduction
 Cooking with Sloan
 FAQ
 
 Search Form Guide
 SQL Tutorial
 SQL in SkyServer
 Sample SQL Queries
 Graphing
 Query Limits
 Searching Advice
 
 Archive Intro
 Table Descriptions
 Schema Browser
 Glossary
 Algorithms
 Web Browsers
 
 Download
 Data Publications
 API
 SkyServer Sites
 
 Contact Help Desk

Many of the tools on this site may be called programatically or may be included in your own website or tutorial pages. A URL may be constructed for the ASP pages passing parameters in the query string. Examples are provided below.

Image access

Get Frame

http://cas.sdss.org/dr7/en/get/frameByRCFZ.asp?R=1140&C=1&F=120&Z=1 
where R is the Run, C is the CamCol and Z is the Zoom level, or
 http://cas.sdss.org/dr7/en/get/frameById.asp?id=582093452159090688&zoom=10 
where id is the fieldId.


Get Spectra

http://cas.sdss.org/dr7/en/get/specByPF.asp?P=75094092966526976&F=25  
where P is the Plate and F is the Fiber, or
http://cas.sdss.org/dr7/en/get/specById.asp?ID=75657058065580032 
where ID is the SpecObjId.


Get Scrolling Sky image

http://cas.sdss.org/dr7/en/tools/scroll/camcol.asp?R=1140&C=1&Z=2 
Where R is the Run number , C is the CamCol and Z is the Zoom level.


Full Spectral Access

There is a comprehensive web site to access the details of spectra from the SDSS and other surveys (2dF). You can also upload your own spectra.

http://www.voservices.net/spectrum/

This site also has a Filter Profile service and a SOAP interface to the spectrum service described in its documentation page .

Searching

Radial

http://cas.sdss.org/dr7/en/tools/search/x_radial.asp?
ra=180&dec=-0.2&radius=3&format=csv&topnum=20 
where ra is Right Ascension in degrees, dec is Declination in degrees, radius is search radius in arcminutes, format is the format to return, which may be csv, html, or xml, topnum is the number of rows to return. If you want all rows, put entries=all instead.

Additional parameters may be passed for restricting its range. For each band (x one of r,i,u,g,z) check_x,min_x and max_x may be specified. Hence adding to the above we may restrict the result to rows with u between 20 and 22 as follows:

http://cas.sdss.org/dr7/en/tools/search/x_radial.asp?
ra=180&dec=-0.2&radius=3&format=xml&topnum=20&check_u=u&min_u=20&max_u=22 

The same parameters can be also sent using POST. The names forms are the same as the GET parameter names.


Rectangular

http://cas.sdss.org/dr7/en/tools/search/x_rect.asp?
min_ra=180.1&max_ra=180.2&min_dec=-0.1&max_dec=0.01&format=xml&topnum=20 
where min_ra,min_dec in degrees form one corner, max_ra,max_dec form the other corner, format is the format to return which may be csv, html, or xml, topnum is the number of rows to return. If you want all rows, put entries=all instead.

The same parameters can be also sent using POST. The names forms are the same as the GET parameter names.


SQL

http://cas.sdss.org/dr7/en/tools/search/x_sql.asp?
format=xml&cmd=select top 10 * from galaxy  
Where cmd is the sql command to execute and format is the format to return which may be csv, html, or xml. The command should be preferably URL-encoded, like
    &cmd=SELECT+TOP+10+*+FROM+Galaxy+WHERE+r%3C17

The same parameters can be also sent using POST. The POST parameter values can be in plain text, they do not need to be encoded. The names forms are the same as the GET parameter names.


CasAccess

CASAccess provides a Web Service interface for querying SDSS Data. Example clients and information may be found at
http://skyservice.pha.jhu.edu/develop/vo/casclient.aspx An example query through http GET would be like
http://www.voservices.net/CasService/ws_v1_0/CasService.asmx/GetVoTable?
sqlcmd=select+top+10+ra%2Cdec%2Cr%2Ci%2Cu%2Cg%2Cz+from+galaxy

Visualization Tools

Image Cutout

This is a Web Service that returns a JPEG image centered on (ra,dec), of size (height x width) where the image is scaled to an arbitrary scale (scale). Various drawing options can be specified (opt). The image cutout may be called using SOAP or through a HTTP interface, using either GET or POST. It can be also included in a page through the URL in an IMG tag.

For information on writing a Java SOAP client see ImgCutOut DIME page.
The ImgCutout page itself contains information on building url's but here is an example also:

http://skyservice.pha.jhu.edu/DR7/ImgCutout/getjpeg.aspx
ra=224.5941&dec=-1.09&width=512&height=512&opt=OG 
where ra is Right Ascension in degrees, dec is declination in degrees,
scale is the scale of the image in arcsec per pixel, 0.4 is default
opt is a string of charectors for overlays on the image codes are :
    Code Effect on image
    GGrid
    LLabel
    PPhotoObjs
    SSpecObjs
    TTargetObjs
    OOutline
    BBoundingBox
    FFields
    MMasks
    QPlates
    IInvertImage

Finding Chart

The page, built on top of the Cutout service, creates a Finding Chart, centered on the specified location at a specified scale. Properly formatted finding charts can be sent to the printer. The printed image is always inverted for better looking prints.

You may jump directly to a particular location with the navigation tool using:

http://cas.sdss.org/dr7/en/tools/chart/navi.asp?ra=184.9511&dec=-0.8754&opt=GO
where ra is Right Ascension in degrees, dec is Declination in degrees,
scale is the scale of the image in arcsec per pixel, 0.4 is default
opt is a string of characters, as listed above for the cutout service.


Navigate

This page, built from the Cutout service provides easy navigation in the vicinity of a given point on the sky. One can move around by clicking on the frame of the image, or on individual objects. A short list of the basic properties and a magnified thumbnail \ image of the object nearest to the selected point is then displayed.

You may jump directly to a particular location with the navigation tool using:

http://cas.sdss.org/dr7/en/tools/chart/navi.asp?ra=184.9511&dec=-0.8754&opt=GO
where ra is Right Ascension in degrees, dec is declination in degrees,
scale is the scale of the image in arcsec per pixel, 0.4 is default
opt is a string of characters, as seen above.


ImgList

This page, built from the Cutout service, can generate thumbnails of SDSS images based upon a user defined list of object positions. The images are linked to the other tools. The list can also be specified with a query. The page can be called via HTTP POST.
You will need a form such as the following :
<form action="http://cas.sdss.org/dr7/en/tools/chart/showlist.asp"
method="post">
<TEXTAREA name="paste">
    ra     dec  
159.815 -0.655
161.051  0.152
161.739  0.893
164.090 -0.889
</TEXTAREA>
<input type="submit">
</form>
Basically you must post to the server a field called "paste" which contains the list of thumbnails you require.


Explore

The Explore Tool contains a summary of an object, and interactive links to further detailed properties, like its spectrum or neighbors, etc.
http://cas.sdss.org/dr7/en/tools/explore/obj.asp?id=582377467576058089
where id is the objId, or
http://cas.sdss.org/dr7/en/tools/explore/obj.asp?ra=180.6&dec=0.2
where ra is Right Ascension in degrees, dec is declination in degrees, or
http://cas.sdss.org/dr7/en/tools/explore/obj.asp?sid=75094093008470016
where sid is the SpecObjId, or
http://cas.sdss.org/dr7/en/tools/explore/obj.asp?plate=266&fiber=100
where plate is the plate and fiber is the fiberid.

Density plots

You may request colour coded density plots for queries using this SOAP webservice. See
http://skyservice.pha.jhu.edu/devel/DensityMap

Cross-identification

Upload (New version for DR3)

You may POST or GET to this asp - the basic form is as follows:

 <form method="post" ENCTYPE="multipart/form-data" 
	action="http://cas.sdss.org/dr7/en/tools/crossid/x_upload.asp">
<input name="search" value="n"> 
<input name="radius" value="0.5"> 
<input name="firstcol" value="1"> 
<textarea name="paste">  name  ra   dec
  A1 180.0 -1.2
  A2 181.0 -0.5
  A3 179.2 +0.5
</textarea>
<textarea name="uquery"> SELECT 
   p.objID, p.ra, p.dec, 
   dbo.fPhotoTypeN(p.type) as type,
   p.modelMag_u, p.modelMag_g, p.modelMag_r, p.modelMag_i, p.modelMag_z 
FROM #x x, #upload u, PhotoTag p
WHERE u.up_id = x.up_id and x.objID=p.objID 
ORDER BY x.up_id
</textarea>
<input type="File" name="upload">
<input name="format" value="xml"> 
<input type="submit" >
</form>
	
Valid values for search are
  • 'a' for all nearby objects,
  • 'm' for nearby primary objects,
  • 'n' for the nearest object,
  • 'p' for the nearest primary object, and
  • 'i' to return the objects matching the 5-part SDSS IDs in the list.
The radius parameter is a float value specified in arcmin.
The firstcol parameter is the number of columns in the paste or upload file that precede the input (ra,dec or 5-part SDSS id) columns.
Valid values for format are csv,xml, or html.

This may also be submitted as a get (example for default crossid page):

http://cas.sdss.org/dr7/en/tools/crossid/x_upload.asp?search=p&radius=0.5&firstcol=1&paste=++name
+ra+dec%0D%0A+A1+195.0++2.5%0D%0A+A2+194.5+2.6%0D%0A+A3+193.964+%2B2.8%0D%0A+A4
+-90+-90%0D%0A%09%09&upload=&uquery=SELECT+%0D%0A+p.objID%2C+p.ra%2C+p.dec%2C+%0D%0A+
dbo.fPhotoTypeN%28p.type%29+as+type%2C%0D%0A++p.modelMag_u%2C+p.modelMag_g%2C
+p.modelMag_r%2C+p.modelMag_i%2C+p.modelMag_z+%0D%0AFROM+%23x+x%2C+%23upload+u
%2C+PhotoTag+p%0D%0AWHERE+u.up_id+%3D+x.up_id+and+x.objID%3Dp.objID+and+p.mode
%3D1+%0D%0AORDER+BY+x.up_id%0D%0A%09%09&format=html

Upload (old pre-DR3 version)

You may POST or GET to this asp - the basic form is as follows:

 <form method="post" ENCTYPE="multipart/form-data" 
	action="http://cas.sdss.org/dr7/en/tools/crossid/x_upload.asp">
<input name="search" value="n"> 
<input name="qclass" value="a"> 
<input name="radius" value="0.5"> 
<input name="qselect" value="t"> 
<input type="File" name="upload">
<textarea name="paste">  name  ra   dec
  A1 180.0 -1.2
  A2 181.0 -0.5
  A3 179.2 +0.5
</textarea>
<input name="format" value="xml"> 
<input type="submit" >
</form>
	
Valid values for search are 'a' for all or 'n' for nearest.
Valid values for qclass are 'a' for all of photoPrimary, 'g' for Galaxies and 's' for Stars .
Valid values for qselect are 'c' for count only, 'u' URL to obj, 't' tiny (ra,dec,id,type,url), 's' small (>10), 'm' medium (>20> and 'l' large (>300>.
Valid vlaues for format are csv,xml, or html.

This may also be submitted as a get :

http://cas.sdss.org/dr7/en/tools/crossid/x_upload.asp?
search=n&qclass=a&radius=0.5&qselect=t&
paste=name ra dec%0D%0AA1 180.0 -1.2%0D%0A A2 181.0 -0.5%0D%0A A3 179.2 0.5
&format=xml

SpecList

You may POST to this page as

<form method="post" enctype="multipart/form-data" 
	action="http://cas.sdss.org/dr7/en/tools/crossid/x_speclist.asp">
<TEXTAREA name="paste" >
 plate  mjd fiber
 272  51941 368
 287  52023 582
 288  52000 446
</TEXTAREA> 
<INPUT TYPE="File" NAME="upload">
<TEXTAREA name="uquery" >
	SELECT s.ra, s.dec FROM #upload u, SpecObj s
    WHERE u.up_plate=s.plate
      and u.up_mjd=s.mjd
      and u.up_fiber=s.fiberid
</TEXTAREA> 
<INPUT name="format" value="xml"> 
<INPUT type="submit" target="api">
</form>