[GRASS-dev] PROJ csv files sync GDAL -> GRASS?

Hi,

while checking if the .csv files in lib/proj/ need their regular sync
with GDAL, Frank and me wondered if we do need these files at all
(still) being present in GRASS.

Changelog of lib/proj/gcs.csv says:
2004-01-26 15:37 paul:
* : Updates for proj library and g.proj to read projection
information from various sources

But apparently nothing reads these files? Or yes?

[neteler@host550 proj]$ grep csv *.c
convert.c:#include <cpl_csv.h>
convert.c:#define CSVDIR "/etc/ogr_csv"
convert.c: /* Set finder function for locating OGR csv co-ordinate
system tables */
convert.c: SetCSVFilenameHook(GPJ_set_csv_loc);
convert.c: /* Set finder function for locating OGR csv
co-ordinate system tables */
convert.c: SetCSVFilenameHook(GPJ_set_csv_loc);
convert.c:/* GPJ_set_csv_loc()
convert.c:const char *GPJ_set_csv_loc(const char *name)

mhh:

convert.c:#define CSVDIR "/etc/ogr_csv"
convert.c: G_asprintf(&buf, "%s%s/%s", gisbase, CSVDIR, name);

and convert.c:
/* GRASS relative location of OGR co-ordinate system lookup tables */
#define CSVDIR "/etc/ogr_csv"

At this point I am unsure... also which files are really needed (there are
new CSV files in GDAL now, data/ directory; we always omitted S57).

Ideally we would just use those from GDAL. Asking Frank in IRC how to
obtain the related GDAL directory, he suggested:

"There is a function (CPLFindFile()) to find particular files.
If you really need a directory, you could likely search for a GDAL only
file, and strip the result down to a directory path"

I.e.,
const char * CPLFindFile (const char *pszClass, const char *pszBasename)
http://www.gdal.org/cpl__conv_8h.html

I presume that we could seek for "gcs.csv" and then dirname() it.

What do you think?

Markus

On Mon, Apr 13, 2009 at 8:55 PM, Markus Neteler <neteler@osgeo.org> wrote:

Frank,

from time to time I sync the csv files in lib/proj/ in GRASS to
GDAL-trunk. I did so today and found a couple of new files:

[neteler@host550 proj]$ svn status
? coordinate_axis.csv
? gt_datum.csv
? gt_ellips.csv
M pcs.csv
M projop_wparm.csv
M unit_of_measure.csv
M gcs.csv
M ellipsoid.csv

besides the expected changed files. Should I add the three new
files? Any compatibility issues if folks link GRASS to older GDAL
versions?

I'll document that then in lib/proj/README.txt for the future.

thanks
Markus

Markus Neteler pisze:

Ideally we would just use those from GDAL. Asking Frank in IRC how to
obtain the related GDAL directory, he suggested:

"There is a function (CPLFindFile()) to find particular files.
If you really need a directory, you could likely search for a GDAL only
file, and strip the result down to a directory path"

I.e.,
const char * CPLFindFile (const char *pszClass, const char *pszBasename)
http://www.gdal.org/cpl__conv_8h.html

I presume that we could seek for "gcs.csv" and then dirname() it.

How about gdal-config --datadir?

$ ls `gdal-config --datadir`/*.csv

/usr/local/share/gdal/coordinate_axis.csv
/usr/local/share/gdal/ellipsoid.csv
/usr/local/share/gdal/gcs.csv
/usr/local/share/gdal/gcs.override.csv
/usr/local/share/gdal/gdal_datum.csv
/usr/local/share/gdal/gt_datum.csv
/usr/local/share/gdal/gt_ellips.csv
/usr/local/share/gdal/pcs.csv
/usr/local/share/gdal/pcs.override.csv
/usr/local/share/gdal/prime_meridian.csv
/usr/local/share/gdal/projop_wparm.csv
/usr/local/share/gdal/s57agencies.csv
/usr/local/share/gdal/s57attributes_aml.csv
/usr/local/share/gdal/s57attributes.csv
/usr/local/share/gdal/s57attributes_iw.csv
/usr/local/share/gdal/s57expectedinput.csv
/usr/local/share/gdal/s57objectclasses_aml.csv
/usr/local/share/gdal/s57objectclasses.csv
/usr/local/share/gdal/s57objectclasses_iw.csv
/usr/local/share/gdal/stateplane.csv
/usr/local/share/gdal/unit_of_measure.csv

Maciek

--
Maciej Sieczka
http://www.sieczka.org