g.region rast=elevation -p d.mon x0 d.erase d.slide.show mapsets=PERMANENT d.erase d.rast elevation d.his h_map=elevation i_map=elevation_shade # check the range of elevation values of the entire map: r.info -r elevation # display only categories 1 and 2 (developed) from the land use map: d.rast landuse96_28m cat=1,2 bg=black # display only elevation higher than 100 m over the geology map: d.rast geology_30m d.rast -o elevation val=100-160 # list land use categores r.cats landuse96_28m # compute areas for each category r.report landuse96_28m unit=c,h,p # compute %area for each category in each zipcode r.stats -pl zipcodes,landuse96_28m # generate different types of random surfaces g.region rast=elevation res=100 -p r.random.cells out=randomcells_200m distance=200 d.rast randomcells_200m r.info randomcells_200m r.random.surface out=rand_surf_100m r.random.surface out=rand_surf_100m_d1000 distance=1000 d.rast rand_surf_100m d.rast rand_surf_100m_d1000 # compute correlations between different elevation data g.region rast=elev_ned_30m -p r.covar -r elevation,elev_ned_30m,elev_srtm_30m r.regression.line elevation map2=elev_srtm_30m # find developed areas close to lakes r.buffer lakes out=lakes_buff dist=60,120,240,500 --o d.rast lakes_buff r.mapcalc "developed_lake=if(landuse96_28m==1 || landuse96_28m==2, lakes_buff, null())" d.rast developed_lake d.vect streets_wake co=grey d.rast -o lakes # compute cost surface from accident based on speed limits g.region res=30 -p v.info -c streets_wake v.to.rast streets_wake out=streets_speed use=attr col=SPEED r.info streets_speed d.rast streets_speed echo "634886 224328 1"|v.in.ascii out=fire_pt fs=space d.vect fire_pt co=red icon=basic/marker siz=20 r.mapcalc "streets_travtime=1./streets_speed" r.info streets_travtime d.rast streets_travtime d.vect fire_pt co=red icon=basic/marker siz=20 r.cost -kv streets_travtime out=streets_cost coord=634886,224328 d.rast streets_cost d.vect fire_pt co=red icon=basic/marker d.vect firestations co=red siz=10 d.vect firestations displ=attr attrcol=LOCATION #compute the optimal path r.drain -n in=streets_cost out=route_20Western coord=635933,225959 r.drain -n in=streets_cost out=route_52Holly coord=633186,221417 # display the results d.vect streets_wake col=grey d.vect fire_pt co=red icon=basic/marker size=20 d.vect firestations co=red icon=basic/box size=4 d.vect firestations displ=cat co=black xref=right lsize=15 lco=red d.rast -o route_20Western d.rast -o route_52Holly #print the length of the path in cells r.describe route_20Western r.describe route_52Holly #BETTER r.null streets_speed null=5 r.mapcalc "streets_travtime=1./streets_speed" r.cost -kv streets_travtime out=streets_cost coord=634886,224328 d.rast streets_cost v.out.ascii firestations r.what streets_cost east_north=630879.2,224876.5,635940.3,225912.8,637386.8,222569.2,633178.2,221353.0 d.vect firestations displ=attr attrcol=LOCATION r.drain -n in=streets_cost out=route_20Westernb coord=635940.3,225912.8 r.drain -n in=streets_cost out=route_52Hollyb coord=633178.2,221353.0 d.vect streets_wake d.vect fire_pt co=red icon=basic/marker size=20 d.rast -o route_20Westernb d.rast -o route_52Hollyb # run watershed analysis g.region rast=elev_ned_30m r.watershed elev_ned_30m thresh=50000 accum=accum_50K_30m \ drain=draindir_50K_30m basin=basin_50K_30m stream=rivers_30m #extract more detailed stream network than the output rivers r.mapcalc "streams_derived_30m=if(abs(accum_50K_30m)>1000,1,null())" #convert to vector format and display results r.to.vect basin_50K_30m out=basin_50K feature=area r.to.vect streams_derived_30m out=streams_derived d.his h_map=basin_50K_30m i_map=elevation_shade d.vect basin_50K type=boundary d.rast -o lakes d.vect streams_derived co=blue d.vect streams co=red # high resolution flow pattern in a small watershed g.region rural_1m d.erase r.flow elev_lid792_1m flout=flowlines lgout=flowlg_1m dsout=flowacc_1m r.flow -u elev_lid792_1m lgout=flowlgup_1m dsout=flowaccup_1m # display the maps along with contours to see the relation to terrain # downslope gets valleys d.rast flowacc_1m d.vect elev_lid792_cont1m # upslope gets ridges d.rast flowaccup_1m d.vect elev_lid792_cont1m r.lake dem=elev_lid792_1m wl=113.5 lake=flooded1 xy=638728,220278 d.rast elev_lid792_1m d.rast -o flooded1 # increase elevation r.lake dem=elev_lid792_1m wl=113.6 lake=flooded2 xy=638728,220278 d.rast -o flooded2 #landforms: entire region from 10m resolution DEM, 90m neighborhood g.region rast=elevation d.erase r.param.scale input=elevation output=feature9c_10m size=9 param=feature d.rast feature9c_10m d.legend -c feature9c_10m at=1,30,1,3 #small rural subregion at 1m resolution, 9m and 45m neighborhood g.region rural_1m d.erase r.param.scale elev_lid792_1m out=feature9c_1m size=9 param=feature r.param.scale elev_lid792_1m out=feature45c_1m size=45 param=feature d.rast feature9c_1m d.rast feature45c_1m #set the region and add the planned building to the DEM g.region rural_1m r.mapcalc "elevfacility_1m=if(isnull(facility),elev_lid792_1m,138)" r.colors elevfacility_1m rules=elevation #we use lower resolution to speed-up computation g.region res=3 r.sunmask -v elevfacility_1m out=shadow_3m year=2001 month=12 day=22 \ hour=14 minute=25 sec=0 timezone=-7 r.colors shadow_3m co=rules1 grey >end >EOF d.rast elevfacility_1m d.rast -o shadow_3m g.region rast=elev_ned_30m r.sun elev_ned_30m asp=aspect slo=slope lin=2.5 alb=0.2 beam=b356 \ diff=d356 refl=r356 insol_time=it356 lat=35.748589 day=356 d.rast d356 #visibility from a new 32 story tower being built in downtown g.region rast=elev_ned_30m echo 642212,224767,165 |v.in.ascii -z out=tower_165m fs=, z=3 r.los elev_ned_30m out=tower_165_los coord=642212,224767 obs=165 max=50000 d.his h_map=elev_ned_30m i_map=elevation_shade d.rast -o tower_165_los d.vect streets_wake #for comparison we can also do visibility from RedHat headquarters echo 638898,224528,25 |v.in.ascii -z out=redhat_25m fs=, z=3 r.los elev_ned_30m out=redhat_25_los coord=638898,224528 obs=25 max=50000 d.rast -o redhat_25_los d.vect redhat_25m siz=10 co=red icon=basic/marker d.barscale at=0,0 d.legend tower_165_los at=1,20,1,3 g.region rast=elevation -p r.resamp.interp landuse96_28m out=landuse96_10m_nn met=nearest r.resamp.interp elev_ned_30m out=elev_ned10m_nn method=nearest # check the resampled landuse map d.erase d.rast landuse96_10m_nn # check the resampled elevation surface using the aspect map r.slope.aspect elev_ned10m_nn aspect=aspect_ned10m_nn d.rast aspect_ned10m_nn g.region rast=elevation -p r.resamp.interp elev_ned_30m out=elev_ned10m_bil meth=bilinear r.resamp.interp elev_ned_30m out=elev_ned10m_bic meth=bicubic # check the interpolated elevation surface using aspect maps r.slope.aspect elev_ned10m_bil aspect=aspect_ned10m_bil r.slope.aspect elev_ned10m_bic aspect=aspect_ned10m_bic d.erase d.rast aspect_ned10m_bil d.rast aspect_ned10m_bic g.region rast=elev_ned_30m -p r.resamp.rst elev_ned_30m elev=elev_ned10m_rrst \ ew_res=10 ns_res=10 # first change the region to the resampled map # check the interpolated elevation surface using aspect map g.region rast=elev_ned10m_rrst -p r.slope.aspect elev_ned10m_rrst aspect=aspect_ned10m_rrst d.erase d.rast aspect_ned10m_rrst