API to access CDS cross-match service

Thomas Boch thomas.boch at astro.unistra.fr
Thu Jan 31 23:08:08 PST 2013


Dear Juande,

Options "colRA[12]" and "colDec[12]" are compulsory if you perform a 
xmatch with an uploaded file or a URL pointing to a table.
For VizieR tables, the columns RAJ2000 and DEJ2000 (computed by VizieR) 
are used and cannot be changed (a matter of indexation of large tables).
Although we could simply ignore "colRA[12]" and "colDec[12]" options 
with VizieR tables, we prefer to generated an error, preventing the user 
from obtaining an unexpected result.
So you will have to remove options "colRA[12]" from "xmatchParamDict".
We will improve the documentation and the error message for this case.

Another difficulty is that, so far, the names of the columns for large 
VizieR tables in the xmatch service differ from the one in VizieR (which 
I realize is really not user-friendly and will be changed).
Finally, the columns currently available in the service are limited to 
the ones selected by default in VizieR.

The following Python code should perform what you expect:

import requests

baseXmatchUrl = "http://cdsxmatch.u-strasbg.fr/xmatch/api/v1/sync"
xmatchParamsDict = {
   'REQUEST': 'xmatch',
   'RESPONSEFORMAT': 'votable',           # votable, json, csv, or tsv
   'cat1': 'vizier:II/306/sdss8',         # SDSS DR8
   'cat2': 'vizier:J/A+A/411/391/table1', # AMIGA revised positions
   # columns from cat1 to keep
   'cols1': 'ra,dec,objID',
   'cols2': 'RAJ2000,DEJ2000,CIG',        # columns from cat2 to keep
   'distMaxArcsec': 30.0,                 # matching tolerance (arcsecs)
   'selection': 'best'                    # either "all" or "best" match(es)
}

xmatchQuery = requests.post(
   url=baseXmatchUrl,
   data=xmatchParamsDict
)

print xmatchQuery.text

Thank you for your feedback, it brings to light the points we have to 
improve.
Cheers,

Thomas & François-Xavier

Le 30/01/13 21:07, Juande Santander Vela a écrit :
> Dear Thomas, thanks for the service!
>
> I'm trying to see if I can crossmatch with the AMIGA catalogue already 
> in VizieR, with the following Python code:
>
> import requests
>
> baseXmatchUrl = "http://cdsxmatch.u-strasbg.fr/xmatch/api/v1/sync"
> xmatchParamsDict = {
> 'REQUEST': 'xmatch',
> 'RESPONSEFORMAT': 'votable',           # votable, json, csv, or tsv
> 'cat1': 'vizier:II/306/sdss8',         # SDSS DR8
> 'cat2': 'vizier:J/A+A/411/391/table1', # AMIGA revised positions
> 'colRA1':  'RAJ2000',                  # RA and
> 'colDec1': 'DEJ2000',                  # Dec columns for cat1,
> 'colRA2':  'RAJ2000',                  # RA and
> 'colDec2': 'DEJ2000', # Dec columns for cat2
> # columns from cat1 to keep
>   'cols1': 'RAJ2000,DEJ2000,objID,SpObjID',
>   'cols2': 'RAJ2000,DEJ2000,CIG',        # columns from cat2 to keep
> 'distMaxArcsec': 30.0,                 # matching tolerance (arcsecs)
> 'selection': 'best'                  # either "all" or "best" match(es)
> }
>
> xmatchQuery = requests.post(
> url=baseXmatchUrl,
> data=xmatchParamsDict
> )
>
> print xmatchQuery.text
>
> and the error I get is:
>
> <INFO name="QUERY_STATUS" value="ERROR">
>  Message: colRA and colDec not compatible with VizieR catalogs!
>  Trace:
> java.lang.Exception: colRA and colDec not compatible with VizieR catalogs!
> at cds.xmatch.servlet.SyncXMatch.getXMatchDataSet(SyncXMatch.java:297)
> at cds.xmatch.servlet.SyncXMatch.exec(SyncXMatch.java:587)
> at cds.xmatch.servlet.SyncXMatch.doPost(SyncXMatch.java:398)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
> at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
> at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
> at 
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
> at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
> at 
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
> at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
> at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:301)
> at 
> org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:183)
> at 
> org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:169)
> at 
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722)
> </INFO>
>
> It is not clear whose table is at fault, but I'd guess is the 
> vizier:J/A+A/411/391/table1 , which as h:m:s RA and d:m:s Dec. Is that 
> a current limitation of the API? Thanks!
>
> El 30/01/2013, a las 11:11, Thomas Boch <thomas.boch at astro.unistra.fr 
> <mailto:thomas.boch at astro.unistra.fr>> escribió:
>
>> Dear all,
>>
>> The CDS has released today the first version of an API allowing one 
>> to programmatically access its cross-match service. Through HTTP 
>> calls, any script or program can submit a list of positions (up to 2 
>> million positions) and look for counterparts in one of the 10,000+ 
>> VizieR tables. The result can be retrieved in different formats, 
>> including VOTable.
>>
>> Full documentation is available at 
>> http://cdsxmatch.u-strasbg.fr/xmatch/doc/cross-match-API.html , along 
>> with some usage examples in several languages (shell script, Python, 
>> Ruby, Java).
>> Your comments, questions or feedback are welcome and can be sent to 
>> cds-question at unistra.fr
>>
>> Cheers,
>> Thomas
>
> --
> Juande Santander Vela
> VIA-SKA Project Manager
> Instituto de Astrofísica de Andalucía (IAA-CSIC)
> Glorieta de la Astronomía s/n, E-18008, Granada, Spain
>
> Felix Klein: Todo el mundo sabe lo que es una curva, hasta que estudia 
> suficientes matemáticas como para confundirse con la innumerable 
> cantidad de excepciones posibles.
>


-- 
Thomas Boch
Ingénieur de Recherche

   CDS/Observatoire Astronomique   Phone  : 33 (0)3 68 85 24 42
   11, rue de l'Universite         Fax    : 33 (0)3 68 85 24 17
   F-67000 Strasbourg              Email  : thomas.boch at astro.unistra.fr
   France                          http://cdsweb.u-strasbg.fr/~boch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ivoa.net/pipermail/apps/attachments/20130201/e43af8b4/attachment.html>


More information about the apps mailing list