Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shapefile of a map that is the outline of a number of islands. I would like to convert the lines into polygons (ie all islands filled in) using GRASS. I searched on how to do this with GRASS but just got some very brief and vague suggestions ... but I gave it a go anyway ....

use to import the shapefile into grass
And view the result (I'm using QGIS to do this): Looks good.
v.clean input=g_hwp_p1 output=g_hwp_p1_clean tool=break,snap thresh=10,10
v.type input=g_hwp_p1_clean output=g_hwp_p1_clean_type type=line,boundary
v.centroids input=g_hwp_p1_clean_type output=g_hwp_p1_clean_type_centroids 

This didnt work which is not surprising as I dont really understand what I'm doing. says that...

g_hwp_p1 has 892 lines
g_hwp_p1_clean has 892 lines
g_hwp_p1_clean_type has 892 boundaries
g_hwp_p1_clean_type_centroids has 892 boundaries (0 centroids, 0 areas, 0 islands)

Also v.type reports: 892 incorrect boundaries.
And v.centroids reports: 0 features modified.
The final output looks much like the input (just an outline).

Can anyone spot what I'm doing wrong? Does anyone know what the correct parameters should be?

I also tried this in QGIS using the lines-to-polygon fTool but this didnt do a very good job of it (it diddnt fill in the whole islands but just seemed to add little polygons round the edge).

Shapefile is here...

Screenshoy of hwp_p1 ....

And a close-up of a small Island - it forms a closed loop..


share|improve this question
could you post a screenshot? – Pablo May 28 '11 at 14:47
Have you checked if the lines really form closed circles? – underdark May 28 '11 at 14:47
@Pablo. screenshot link added above. – spiderplant0 May 28 '11 at 15:01
@underdark I've visually checked several of the smaller islands and they looks closed. The larger ones cant really be checked manually (and this is just a cut down test for a bigger map). Is there a GRASS tool to check all lines form closed loops? – spiderplant0 May 28 '11 at 15:04
thats a very complex shape, I had no success in cleaning it here. My suggestion is to manually draw a polygon over it. – Pablo May 30 '11 at 14:39

Lines to Polygon tries to create one polygon for every line. It does that well. The tiny islands along the cost are created correctly. What it cannot do is recognize that your big island is formed by multiple lines.

Same seems to be true for the GRASS tools you tried to use.

PostGIS ST_BuildArea would do the trick but I couldn't get it work for the whole dataset yet.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.