# How to declare coordinate system(s) in TAP metadata?

The TAP-1.0 standard does not define any way to convey the coordinate system used by coordinate columns. However, this is more and more required by recent catalogs using recent epoch (e.g. 2015 for Gaia-DR1) or coordinate systems not expected by default by most of the VO applications (e.g. something different from ICRS J2000).

In order to provide most accurate metadata as possible, the TAPLibrary gives a way to specify the coordinate system of your coordinates. Here is how to proceed in function of how you provide your TAP metadata:

### In `TAP_SCHEMA`

You must add a table in `TAP_SCHEMA`: `coosys`. This table must have the following columns:

- `id`: VARCHAR (ID of the coordinate system definition as it must be in the VOTable)
- `system`: VARCHAR (The coordinate system among: `ICRS`, `eq_FK5`, `eq_FK4`, `ecl_FK4`, `ecl_FK5`, `galactic`, `supergalactic`, `xy`, `barycentric`, `geo_app`)
- `equinox`: VARCHAR (Required to fix the equatorial or ecliptic systems (as e.g. `J2000` as the default for `eq_FK5` or `B1950` as the default for `eq_FK4`))
- `epoch`: VARCHAR (Epoch of the positions (if necessary))

Then, you need an additional column in `TAP_SCHEMA.columns`:

- `coosys_id`: VARCHAR (ID of the used coordinate systems (if any))

Now, all you have to do, is add any coordinate system you need in `TAP_SCHEMA.coosys` and set the appropriate coordinate system ID in the column `coosys_id` of all columns using one. Refresh the metadata of your TAP service and now a `COOSSYS` item should be in the metadata part of your VOTable results (only when there are coordinates with a specified coordinate system).

### In an XML file

Unfortunately, the XML definition of the node `column` does not provide any standard way to provide something as complex as a coordinate system. So, either you keep not providing coordinate systems in your TAP service, or you choose a different method of metadata declaration.

Tip: Starting your TAP service with an XML file as way to provide metadata will immediately create and initialize correctly the `TAP_SCHEMA` schema in your database. So, if you want to provide coordinate system information, all you have to do, is to switch the metadata declaration method in order to use this newly created `TAP_SCHEMA`. Then, just follow the steps listed above for this method.

### Programmatically

To add a coordinate system to a column, you just have to use the new function of `TAPColumn`: `setCoosys(TAPCoosys)`. As in the `TAP_SCHEMA` method, you can use the same `TAPCoosys` object for several columns.