[GRASS-SVN] r60022 - grass-addons/grass6/vector/v.in.gshhs

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 1 13:01:33 PDT 2014


Author: hamish
Date: 2014-05-01 13:01:32 -0700 (Thu, 01 May 2014)
New Revision: 60022

Modified:
   grass-addons/grass6/vector/v.in.gshhs/description.html
Log:
full processing example

Modified: grass-addons/grass6/vector/v.in.gshhs/description.html
===================================================================
--- grass-addons/grass6/vector/v.in.gshhs/description.html	2014-05-01 20:00:52 UTC (rev 60021)
+++ grass-addons/grass6/vector/v.in.gshhs/description.html	2014-05-01 20:01:32 UTC (rev 60022)
@@ -72,10 +72,59 @@
 and ponds on islands in lakes, so we'll exclude them as holes.
 
 <div class="code"><pre>
-v.in.gshhs in=gshhs_f.b out=gshhs_shoreline_full
-v.extract in=gshhs_shoreline_full out=gshhs_landlines_full list=1,3
-v.type in=gshhs_landlines_full out=gshhs_shoreboundary_full type=line,boundary
-v.centroids in=gshhs_shoreboundary_full out=gshhs_land_full op=add
+# Import the raw data
+v.in.gshhs in=gshhs_f.b out=gshhs_shoreline
+
+# Speed up future topology processing by splitting up massive boundaries
+#  into multiple connected polylines (the "Florida Coastline" problem)
+v.split in=gshhs_shoreline out=gshhs_shoreline_split1k vertices=1000
+
+# Separate out land features from water features
+v.extract in=gshhs_shoreline_split1k out=gshhs_landlines list=1
+v.extract in=gshhs_shoreline_split1k out=gshhs_lakelines list=2
+v.extract in=gshhs_shoreline_split1k out=gshhs_islandlines list=3
+v.extract in=gshhs_shoreline_split1k out=gshhs_pondlines list=4
+
+# Database of land and sea types no longer needed
+v.db.droptable -f gshhs_landlines
+v.db.droptable -f gshhs_lakelines
+v.db.droptable -f gshhs_islandlines
+v.db.droptable -f gshhs_pondlines
+
+# Convert lines to boundaries
+v.type in=gshhs_landlines out=gshhs_shoreboundary type=line,boundary
+v.type in=gshhs_lakelines out=gshhs_lakeboundary type=line,boundary
+v.type in=gshhs_islandlines out=gshhs_islandboundary type=line,boundary
+v.type in=gshhs_pondlines out=gshhs_pondboundary type=line,boundary
+
+# Convert boundaries to areas by adding centroids
+v.centroids in=gshhs_shoreboundary out=gshhs_land option=add
+v.centroids in=gshhs_lakeboundary out=gshhs_lakes option=add
+v.centroids in=gshhs_islandboundary out=gshhs_islands option=add
+v.centroids in=gshhs_pondboundary out=gshhs_ponds option=add
+
+# Combine the land and water coverages into a single map, may take a long time
+v.overlay ain=gshhs_land bin=gshhs_lakes atype=area btype=area \
+   out=gshhs_land_with_lakes operator=not
+
+v.overlay ain=gshhs_islands bin=gshhs_ponds atype=area btype=area \
+   out=gshhs_islands_with_ponds operator=not
+
+# Final step: add islands in lakes to mainlands
+v.patch in=gshhs_land_with_lakes,gshhs_islands_with_ponds out=gshhs_all_land
+
+# Cleanup temporary maps
+g.remove vect=gshhs_shoreline_split1k,gshhs_landlines,gshhs_lakelines,\
+gshhs_islandlines,gshhs_pondlines,gshhs_shoreboundary,gshhs_lakeboundary,\
+gshhs_islandboundary,gshhs_pondboundary,gshhs_land,gshhs_lakes,\
+gshhs_islands,gshhs_ponds,gshhs_land_with_lakes,gshhs_islands_with_ponds,\
+gshhs_shoreline
+
+
+# convert to raster, with each contiguous land mass as its own category
+g.region n=29N s=7N w=87W e=58W res=0:02
+v.to.rast in=gshhs_all_land out=gshhs.land type=area use=cat
+r.colors gshhs.land color=random
 </pre></div>
 
 At this point areas are categorized in order of shoreline length. Area cats



More information about the grass-commit mailing list