INCODE EPSGs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

INCODE EPSGs

Benjamin Adler
Hello,

I have built libgeotiff on windows (CMake, 64bit, msvc2012) and were
surprised about some EPSGs being includable INCODE, others not. So I
talked to Frank on IRC and thought I might come up with a patch to fix this.

In my mind, the following things could be improved:

  - in the csv/ subdir, a seemingly random subset of CSVs are converted
to .c using csv2c.py, others are not. So the releases contain redundant
data.

  - csv2c.py only takes one parameter (the .csv) and creates the
c-source right next to it, just with a different extension. This seems
to follow the old building-in-source-tree idea of automake, which I
don't consider very elegant.

  - csv2c.py fails to correctly convert *.override.csv files. This is
because the filename is part of the variable name in the resulting
c-source, e.g. converting "gcs.override.csv" results in "datafile_rows_t
gcs.override_row_1[]", and the dot doesn't make sense here. I suggest
naming those files without a dot, e.g. gcs_overrride.csv

What the attached patch tries to do:

  - change cvs2c.py so that it accepts an input and an output parameter.

  - change CMakeLists.txt to let the user choose which csv files to
include in code. It will add buildrules to autogenerate .c from .csv
files and add them to the library target. This requires python for
csv2c.py. It will also generate an include file that replaces the
epsg-incode definitions found in cpl_csv_incode.c.

  - change cpl_csv_incode.c to include the autogenerated include.

I have tested this on windows and linux (ubuntu 13.10 64bit, cmake
version 2.8.11.2) and was able to happily inflate libgeotif from less
than 1 to more than 16MB (windows) by including all EPSG data in code :)

I am not a cmake expert (in fact, BtbN from #cmake helped me a lot with
this, thank you!), not a c expert and not a geotiff expert. So please
have a thorough look at this before you commit.

Not quite sure if it makes sense to keep using automake when CMake also
works, but there's one problem if you do: I removed the old/static epsg
definitions from cpl_csv_incode.c and replaced them with the
cmake-generated include. When using automake, this include doesn't exist.

Frank, how can this be fixed? Maybe use -DAUTOMAKE and keep the old
definitios in cpl_csv_incode.c #ifdef'ed in? That's not really elegant,
and you'd still have to distribute those csv-c-sources, but I guess it
would work.

Also, the automakefile needs to be updated to invoke cvs2c.py with a
second argument.

Cheers,
ben

_______________________________________________
Geotiff mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/geotiff

epsg_incode.patch (7K) Download Attachment