	EPSG Tables
	===========

The .csv files in this directory are an extract of tables from the EPSG 
projection database in CSV (comma separated value) format.  These same
files come with the source distribution in the libgeotiff/csv directory.

Detailed information on the EPSG database can be found at:

  http://www.epsg.org/

The current version of the EPSG database dumped is 6.17.

All EPSG tables have been dumped to csv.  Unlike earlier dumps (4.3) these
are intended to be "true" csv files.  In particular quotes within quoted
strings are doubled to escape them, rather than using backslash quoting.  
Newlines may appear within quoted field values (as real raw newline 
characters).  All table names are converted to lower case, and spaces replaced
with underscores to make them more easily worked with. 

In addition to the EPSG tables dumped to csv, the following additional items
are present:

 stateplane.csv: my own effort to related "USGS" state plane numbers with their
                 currently preferred EPSG coordinate reference system 
                 counterpart. 

 pcs.csv: An attempt to collect most information about a PCS, including the
          projection parameters into one fast access file. 
 gcs.csv: An attempt to collect most information about a GCS, including
          the WGS84 shift parameters (if there is only one path in EPSG).
 projop_wparm.csv: Projection operations with projection parameters.  
          Essentially the coordinate_operation.csv table with the parameters
          from coordinate_operation_parameter_values.csv appended to each 
          record.
 build_pcs.py: a python script to build pcs.csv and gcs.csv from the other
               EPSG files. 
 csv_tools.py: supportting python functions for build_pcs.py.
 csv.txt: A definition of the csv format.
 
Libgeotiff uses the following tables.  The rest are present for completeness.

 pcs.csv
 gcs.csv
 ellipsoid.csv
 prime_meridian.csv
 unit_of_measure.csv
 datum.csv
 projop_wparm.csv


Generating CSV Files
--------------------

The csv files are generated from the Postgres dump provided by EPSG.


1) Load epsg database into postgres instance named "epsg".

   insert a line "\encoding LATIN1" at start of the _Data_ sql file. 

   run "load_pg.sh" in the directory where the .sql files are found.

   There will be some errors, possible due to encoding issues?

2) Dump the database to .csv files.

   python pg_to_csv.py

   Puts the results in the out directory.  After some inspection move them
   into this directory (libgeotiff/csv).

3) Build the pcs and gcs csv files.

   python build_pcs.py

4) Commit the changes in libgeotiff repository.




