[GRASS-dev] GSHHS data import

Hamish hamish_b at yahoo.com
Tue Oct 28 01:45:04 EDT 2008


Hi,

I was just updating the Global Datasets wiki page for vector coastlines,
  http://grass.osgeo.org/wiki/Global_datasets#GSHHS_World_Coastline

and wondering what efforts would be needed to port v.in.gshhs from GRASS
5.4 to GRASS 6. Then in the GSHHS v1.10 release notes I noticed "Version
1.10 May 1, 2008 ... Also, thanx to Markus Metz the gshhstograss.c has
been updated."
  ftp://ftp.soest.hawaii.edu/pwessel/gshhs/README.gshhs

Back in the day Bob Covill et al. created v.in.gshhs for GRASS 5 from
some old version of gshhstograss.c. It seems to have been kept up to
date as far as 2005 by Paul & Markus(N):
  http://freegis.org/cgi-bin/viewcvs.cgi/grass/src/mapdev/v.in.gshhs/

to GSHHS v1.5, but the header structure changed again in v1.6 May 2006,
but only minorly, so getting a working v.in.gshhs for GRASS 5 compatible
with newer versions of the data would probably be highly simple. (two
shorts became ints)


Markus(M), what's the situation? What's the easiest way to get the latest
version of this dataset into GRASS these days?

How much work do y'all think it would be to port v.in.gshhs to GRASS 6?
(re)start from your gshhstograss.c and wrap it in G_parser()?
  [apparently not, I see your version prepares a vector ascii file
   and a script to build & attach the database with v.db.* commands]

Paul, I notice a bit of grass-specific Proj stuff in the CVS history,
is that going to be a big pain?


I'd add a spatial= option like v.in.ogr instead of individual options for
each n,s,e,w (although I never liked the name "spatial" for that much);
retain the -a flag (import as areas not lines); and rename the -g flag
to -r to match v.in|out.ascii.


comments about MM's gshhstograss.c for GRASS 6 from gshhs_1.10_src.zip:

I notice gshhstograss.c from gshhs_1.10_src.zip is full of weird "Â"
characters (<C2><A0>). Perhaps Unicode stuff snuck in?

> *  lat lon swapped for output, was wrong

fyi between grass 5 and 6 we swapped the vector ascii format to be "x y"
instead of "y x".

> while { ...
>    .... "Inserting level labels, might take some time...\"\n"
>    fprintf(att2_fp,"v.db.update ... value=\'%d\' where=cat=%d

it is Much Much faster to write SQL commands to a single file then run
db.execute once, than it is to run v.db.update over and over again. See
the v.in.garmin script- it does a highly similar task: writes geodata to
a vect ascii file & imports it + builds and links to a DB with attributes.


The core of the import fits on one screen of C code, so I'd expect a
"proper" GRASS 6 v.in.gshhs C version to be fairly straight forward
for someone who knew the vector API, and less than a day's work for
someone who didn't but wanted to learn it based on cutting and pasting
from other v.* modules. ;)


free hi-res versions of this data can be hard to come by, and the NOAA
shoreline extractor + v.in.mapgen is a bit piecemeal, so thanks,


Hamish


ps- triva: apparently Gerald of PROJ4 fame was the author of Mapgen many
years ago.


More information about the grass-dev mailing list