Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 v.in.ogr 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.

V.info 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... https://docs.google.com/leaf?id=0B93lksnTC7_cYWIxNTlmNzEtYTcwYi00YmZlLTlhZmEtZDViYmE1MmYxNDk2&hl=en_US

Screenshoy of hwp_p1 .... https://docs.google.com/leaf?id=0B93lksnTC7_cN2Q5YTNiMjEtZjY4OS00ZTYwLWIxMDAtYzBlNmY1M2U1MGRl&hl=en_US

And a close-up of a small Island - it forms a closed loop.. https://docs.google.com/leaf?id=0B93lksnTC7_cZjQ1ZDU4ZGQtMWNmMC00ZjNiLWFiZmEtM2MyMDE0MmYzODQ5&hl=en_US

Thanks.

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
1  
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

1 Answer 1

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

 
discard

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.