problem to convert gshhs to shapefile with R
On Thu, 16 Oct 2008, Yvan Le Bras wrote:
Good afternoon. Excuse I for getting bored. I need to work with shapefile and I thank that was easy to convert gshhs to shapefile but since 2 weeks I tried without any success. Can you help me? I'd success to import gshhs file with importGSHHS from PBSmapping and Rgshhs from maptools but I don't succeed to convert gshhs to a shapefile. The problem seems to be that my gshhs object is a List object with Rgshhs,
... so it would make sense to read the documentation (and/or the code) of Rgshhs(). There you find that the function returns a list, with a component called SP. Look in the examples to see exactly how this works. All the other components are intermediate objects possibly needed for debugging the running of the function, which is vulerable to changes in versions of GSHHS. The output objects are either SpatialPolygons or SpatialLines objects, which need to be complemented with a data frame with at least one variable, and with row.names identical to the Lines or Polygons objects' ID slots, to make Spatial*DataFrame objects, which can then be exported as shapefiles. It is always a good idea not to "think" too much, but rather to read the documentation and in particular study the examples provided. Roger
so I can't convert this file in Map object or anything else, and with importGSHHS, an error appeared (in validityMethod (object) : Geographical CRS given to non-conformant data) when I try to convert this file in Spatial Polygons. In fact I thank use Rgshhs to convert my gshhs file in SP object, then SP2MAP to convert SP in Map object, then MAP2POLY to convert in polylist object to endly use WRITEPOLYLISTSHAPE to convert in shapefile my map object and my polylist.... Can you help me to convert my gshhs in shapefile? When I saw the pdf for maptools tuto, I thank to have found the manner to make this because of th texte write for the Rgshhs function who said this function was use to convert SP to shapefile for example. I whisper you can help me, and am sorry for the approximative english and the disturbance. In wishing you a good end of week. Best regards, Yvan Le Bras
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no