<resource schema="cross">

	<meta name="title">GAVO DC Custom Uploading Crossmatcher</meta>

	<meta name="description">A plain positional crossmatch service that allows file and
	URL uploads to be crossmatched to DC-internal tables.  In general, you
	want to use TAP for this kind of thing when it is available, but in a
	pinch it might come in handy.  Larger catalogues that can be matched
	against include 2MASS, USNO-B, PPMX, CARS, and more.</meta>

	<meta name="creationDate">2009-06-30T10:32:00Z</meta>
	<meta name="subject">catalogs</meta>

	<meta name="_intro" format="rst">This service lets you upload VOTables and crossmatch
	them against various tables in the DC.  The selection below corresponds to
	the \RSTservicelink{__system__/dc_tables/list/form}{Tables available for
	ADQL} (see there for explanations what the tables are).

	See the \RSTservicelink{cross/q/match/info}{service info} for more
	information on what input the service expects.
	</meta>

	<meta name="_longdoc" format="rst"><![CDATA[
	This service lets you run simple positional crossmatches against all
	tables available for ADQL querying in GAVO's data center by simple
	file uploads or URL referrals.  Tables you can match against include
	2MASS, USNO-B, UCAC3, PPMX,
	and PPMXL (we recommend the latter for adding proper motions).

	To find out more about the tables given, consult the list of
	\RSTservicelink{__system__/dc_tables/list/form}{tables available for ADQL}.
	Not all tables given there are suitable for cross matches (if you complain,
	we will restrict the selection in the form to those that are, but so
	far no one has complained).  If you think we should have additional
	catalogs you can crossmatch against, let us know and we'll see what we
	can do.

	Upload Format
	-------------

	The uploaded VOTables must have exactly one pair of columns with UCDs of
	either pos.eq.[ra|dec];meta.main or POS_EQ_[RA|DEC]_MAIN.  The results of VO
	cone searches work well.
	
	If you have tables of your own, you will first have to bring them to the
	VOTable format.  A good tool to do that is `Topcat <http://www.star.bristol.ac.uk/~mbt/topcat/>`_ .  It allows you to convert
	almost arbitrary data to VOTables.

	You *must*, however, mark up what columns are the positions you want to
	match agains; this is what the jargon with "UCDs" above means.  To
	do this, in Topcat select "Views/Column Info".  The table in the window
	that pops up has a column UCD, the contents of which are editable
	by clicking into the field.  Enter ``pos.eq.ra;meta.main`` in the column
	of the relevant right ascension, and ``pos.eq.dec;meta.main`` in the column
	of the relevant declination.

	We currently do not support transformation of your coordinates, so you
	have to make sure that the input coordinates match the system used
	in the table (for basically all of our tables, this means ICRS or
	FK5 J2000 to an accuracy sufficient for matching).

	If you need fancier facilities, use our \RSTservicelink{adql}{ADQL service}.
	]]></meta>

	<customCore id="crosscore" module="bin/crossmatchcore">
		<outputTable id="foo"/>
	</customCore>
	<service id="match" core="crosscore">
		<meta name="shortName">gavo_crossmatch</meta>
		<publish render="form" sets="local,ivo_managed"/>
	</service>

	<regSuite title="cross regressions">
		<regTest title="Crossmatch service returns some data">
			<url parSet="form"
				urlSrc="/ppmx/res/ppmx/scs/scs.xml?RA=19.9971686111&amp;DEC=19.4701083333&amp;SR=0.0001"
				tableName="ppmx.data" SR="0.001">match/form</url>
			<code>
				self.assertHasStrings("-167.2", "RA", "Alphafloat", "0.322418")
			</code>
		</regTest>

		<regTest title="File upload to crossmatch works">
			<url parSet="form" SR="0.001" tableName="ppmx.data" httpMethod="POST">
				<httpUpload name="fileSrc" fileName="zw.vot.gz"
					source="res/zw.vot.gz"/>
			match/form</url>
			<code><![CDATA[
				self.assertHasStrings('="Field04">Field04<', '<td>0.0119',
					"Id-number")
			]]></code>
		</regTest>
	</regSuite>
</resource>
