295introduction to lidar - gis courses · espm4295/5295 11-oct-16 1 introduction to lidar our goals...

10
ESPM4295/5295 11-Oct-16 1 Introduction to LiDAR Our goals here are to introduce you to LiDAR data, to show you how to download it for an area of interest, and to better understand the data and uses through some simple manipulations. In our project we’ll be calculating building and tree heights for your project area. The state on Minnesota has flown LiDAR for the entire state. Data may be interactively downloaded via the MN DNR MNTopo viewer (http://dnr.state.mn.us/maps/mntopo/index.html), or for larger areas via the MNGEO ftp site (ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/). Raster DEMs, hillshades, contours, and the “raw” data or “point cloud” data may be downloaded, in ESRI geodatabases or in commonly supported formats. We will download LiDAR data and derived layers and prepare them for inclusion in our Campus GIS. We will first work with the processed layers, and later the raw data, primarily for building heights. Since the data are very detailed we often need to merge together several tiles to obtain the complete St. Paul Campus. This is common when working with LiDAR. The data is so detailed that 16 tiles of LiDAR data fit within a typical USGS 1:24,000 scale topo map. Our individual study areas are small, so we shouldn’t have that problem here. Open the MnTOPO website, and familiarize yourself with the tools near the upper right. Use the default display and the zoom button in the upper left, and click-hold-drag to pan, to get the approximate Campus area displayed. You may select different basemaps with one of the tools in the upper right, the image basemap is perhaps most useful. You may also turn off the contours via the stacked layers icon. Use the download data tool (disk drive with arrow icon, in the toolbar row, upper/left), specify a polygon that is centered on your individual project area, but about 1.5 to double the height and width you need to include your entire area. Download the 1 m dem, 1m hillshade the raw lidar point cloud data (these will be .las or .laz (a compressed form) You’ll see the DEM and hillshade are rasters, and the raw lidar point data are in files with strange codes and a .laz extension. The codes are tile number, las datasets are typically large, and so are usually tiled, and the laz is a compressed format that typically reduces the file size by about 90%. You should copy the DEM and hillshade, and the relevant laz/las files from your download directory to a new directory, in this example we’ll call it \LASData. Note that you don’t need all the .laz/.las point files that MnTOPO downloaded in the tile. You should refer to the image below, and only copy the files you need for your project area. The boundaries correspond to the tile borders, and the labels the .laz/.las file names. The files are large, will multiply through processing, slow things down, and clutter your workspace.

Upload: phamtram

Post on 26-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

ESPM4295/5295 11-Oct-16

1

IntroductiontoLiDAROurgoalsherearetointroduceyoutoLiDARdata,toshowyouhowtodownloaditforanareaofinterest,andtobetterunderstandthedataandusesthroughsomesimplemanipulations.Inourprojectwe’llbecalculatingbuildingandtreeheightsforyourprojectarea.ThestateonMinnesotahasflownLiDARfortheentirestate.DatamaybeinteractivelydownloadedviatheMNDNRMNTopoviewer(http://dnr.state.mn.us/maps/mntopo/index.html),orforlargerareasviatheMNGEOftpsite(ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/).RasterDEMs,hillshades,contours,andthe“raw”dataor“pointcloud”datamaybedownloaded,inESRIgeodatabasesorincommonlysupportedformats. WewilldownloadLiDARdataandderivedlayersandpreparethemforinclusioninourCampusGIS.Wewillfirstworkwiththeprocessedlayers,andlatertherawdata,primarilyforbuildingheights.SincethedataareverydetailedweoftenneedtomergetogetherseveraltilestoobtainthecompleteSt.PaulCampus. ThisiscommonwhenworkingwithLiDAR. Thedataissodetailedthat16tilesofLiDAR datafitwithinatypicalUSGS1:24,000scaletopomap.Ourindividualstudyareasaresmall,soweshouldn’thavethatproblemhere.OpentheMnTOPOwebsite,andfamiliarizeyourselfwiththetoolsneartheupperright.Usethedefaultdisplayandthezoombuttonintheupperleft,andclick-hold-dragtopan,togettheapproximateCampusareadisplayed.Youmayselectdifferentbasemapswithoneofthetoolsintheupperright,theimagebasemapisperhapsmostuseful.Youmayalsoturnoffthecontoursviathestackedlayersicon.Usethedownloaddatatool(diskdrivewitharrowicon,inthetoolbarrow,upper/left),specifyapolygonthatiscenteredonyourindividualprojectarea,butabout1.5todoubletheheightandwidthyouneedtoincludeyourentirearea.Downloadthe

• 1mdem,• 1mhillshade• therawlidarpointclouddata(thesewillbe.lasor.laz(acompressedform)

You’llseetheDEMandhillshadearerasters,andtherawlidarpointdataareinfileswithstrangecodesanda.lazextension.Thecodesaretilenumber,lasdatasetsaretypicallylarge,andsoareusuallytiled,andthelazisacompressedformatthattypicallyreducesthefilesizebyabout90%.YoushouldcopytheDEMandhillshade,andtherelevantlaz/lasfilesfromyourdownloaddirectorytoanewdirectory,inthisexamplewe’llcallit\LASData.Notethatyoudon’tneedallthe.laz/.laspointfilesthatMnTOPOdownloadedinthetile.Youshouldrefertotheimagebelow,andonlycopythefilesyouneedforyourprojectarea.Theboundariescorrespondtothetileborders,andthelabelsthe.laz/.lasfilenames.Thefilesarelarge,willmultiplythroughprocessing,slowthingsdown,andclutteryourworkspace.

ESPM4295/5295 11-Oct-16

2

DisplaytheDEMandhillshadesurfaces.Thesearelargelyfromanautomatedprocessthatfirsttriestoidentifythe“bareearth,”orgroundonlyreturns,andthenbuildaDEMandahillshade.Noticetheoddshapes,sometimesliketriangles,onthehillshadesurfacewithinthebuildingfootprints.Theseareartifactsoflidardataprocessing.Thealgorithmshaveahardtimeidentifyingthegroundnearbuildingsperfectly,sothereareoftentriangularshapesonornearbuildings.Youalsoseearoughnessandoccasionalsmallbumpsovergrassorforestareas,thesearealsoartifactsoftheprocessing.

AlsonoticetheDEMrastersareinUTM15NAD83(1986).YouwillneedtotransformthemtoCORS96ifyouwishtoavoidthewarningsaboutdatumconflictswhendisplayedwithyourotherprojectdata.

YoucandoallthefollowingstepsinArcGIS,wewillbeusingLASTools,awidely-used,generalpurposelidarprocessingtoolboxthatismuchfasterthanprocessinginArc,andquiteflexible.TheUMNhasasitelicenceforLASTools,sowe’llbeusingitforthissmallexercise.

Beforewestartprocessing,youshouldcopytheLASToolssoftwaretothedirectorycontainingyourdata.TheLASToolsexecutablefilesareonthelabdriveunder4295W\LASTools\bindirectoryYoushouldcopythelas2las.exeandlas2shp.exefromthe\bindirectorytoyourlasdatadirectory(\LASDatainourexample)andthe_README.txtfilesalso,ifyouwishtoreadalltheoptionsavailable.Ifyouusedthesetoolsfrequently,thenwe’daddthe\bintothepath,soprogramswouldlookthereautomatically,butforlabmanagementpurposes,wehaven’tdonethat.Youshouldalsomaketwosub-directorieswithinyour\LasDatadirectory,onenamedbuildings,andonenamedtallveg,intowhichwe’llbesubsettingthelasdata.

ESPM4295/5295 11-Oct-16

3

Whenyou’redone,yourdirectoryshouldlooksomethinglikethiswindowbelow.

Younoticewehavethelazfiles,theexecutabletoolslas2lasandlas2shp,theReadmefiles,andthebuildingsandtallvegdirectories.I’vealsoconvertedcopiesofthe.lazto.lasfiles.Youdon’tneedto,butnoticethe.lazfilesaremuchsmallerthanthe.las.Becauselidardataareoftensolarge,thereisusuallyatradeoffbetweensavingspaceandprocessingspeed.We’reworkingwithasmallarea,soitdoesn’tmuchmatter,butinmanyrealprojectsitdoes.YoushouldknowafewmorethingsaboutLiDARdata.Remember,theseLiDARarefrompulsesoflightsentdownfromaplane,thenreflectedbackfromatarget.Precisegeometryallowsoperatorstodeterminethex,y,andzcoordinatestowithinafewinchesofeachobjectthatreflectsbackapulse.Therecanbemanyreturnsmeasuredfromeachpulse,althoughwe’remostofteninterestedinthefirstreturns,tomeasureobjectheights,andthelastreturns,tomeasuregroundelevation.Thedataareprocessedbeforethey’redelivered,andthecollectingorganizationusuallyappliesalgorithmstotrytodetectgroundhits(notalllastreturnsarefromtheground),objectheights(notallfirstreturnsarefromthetopsofobjects),andtoprovideotherinformationabouteachdatapoint.Mosttimeseachreturnpointcontainsinformationonthereturnnumber(first,last,orinbetween),thefeatureclassification(2=ground,4=mid-heightvegetation,5=highvegetation,6=building,9=water,0=unclassified),aswellasthescanangle,thestrengthofthereturnsignal,andotherinformationaboutthepoint.LASTools,andmostotherlidarprocessingtools,allowustoaccessthesedata.

ESPM4295/5295 11-Oct-16

4

We’llusethecommandprompttorunLAStools.ThecommandpromptisfoundviatheWindowsStartbutton(pinkarrow,right),thenintheAccessoriesfolder–>CommandPrompt(greenarrowandcircled,atright)Thiswillopenasmallwindowthatonlyallowsonlytextentry(seebelow).

Thepromptshowsthecurrentpathstring.Wanttosetthepathtoyourdatalocation.Firsttypeinthedriveletter,inmycasetheYdrive,soItypeinthedriveletterandthenhitreturntochangetothatdrive:Y:Thepromptshouldnowshowthedrive,inmycase:Y:\IthenusetheCD(ChangeDirectory)commandtochangetheactivedirectory,typingin:CDdownloads\lasdataSothepromptnowbecomes:Y:\downloads\lasdataIcantypeDIR(fordirectory)andthenhitreturn,itshouldlistthedirectorycontents.Icancheckit

ESPM4295/5295 11-Oct-16

5

againsttheWindowsExplorerviewofthedirectory,showatthebottomofpage2,toverifyI’matthecorrectsubdirectory.Now,ontoprocessing.LASToolsisabitoldschool,youdon’thaveaccesstoaGUI,youspecifyoptionsthrough“flags”onacommandline.EachflaginLASToolsstartswithadash,e.g.,“-i”meansthefollowingtextspecifiestheinputfile(s).Thisisabitcumbersomeforsinglefileprocessing,butitisgreatforwritingsmallprogramstodorepetitivetasks.Anotherkeybitofinformationisthattheasterisk*standsfor“matcheverything,”andhelpswhenspecifyingmultiplefilesThefirstcommandwe’lltypeis:Las2las–i*.laz–odirbuildings–keep_class6Thisusesthelas2lastoolto:

• Readallthe.lazfilesasinput(-imeansinput,the*.lazusesthewildcardsymbol*tomatchanythingthatcomesbeforea.lazextension).NOTEHERE:IFI’vealreadyuncompressedmy.lazfilesto.lasfiles,IHAVETOSPECIFY-i*.lasastheinput

• Outputthemtothedirectorynamedbuildings(-odirbuildings),and• Onlykeeptheclasslabeled6(-keep_class6),inthiscasethepointsclassifiedasbuilding

pointsYoumaygetacommentsayingtheuseofLasToolsisunauthorized,ignoreit.Wedohavealicense,butsettingituprequiresafewmoresteps,andthechangestheymightwarnaboutareminor,anddon’tchangeouroutcome.WecanuseCDchangetothatbuildingsdirectoryafterthecommandruns,andverifythecommandworked:

ESPM4295/5295 11-Oct-16

6

Noticethefileshavethesamenameastheoriginals(that’swhyweputtheminaclearlylabeledsub-directory),butthatthey’remuchsmaller,thesubsetbuildingfileis16,337,316bytes(16.3Mb),whilethefulldatasetwasalmost166Mb;we’vesampledoutonlythebuildingreturns,andthefileislessthan10%oftheoriginalsize.Wecanapplyasimilarcommandtospecifykeepingonlythevegetationclasses(3,lowveg,4,mediumtrees,and5,hightrees):Las2las–i*.laz–odirtallveg–keep_class345Notetheoutputdirectoryissettotallveghere.Youshouldcheckyourselftomakesurethecommandworked,andnotethedecreaseinsize.IconverttheselaspointstoESRIshapefileswiththelas2shpcommand.First,changedirectoriestothebuildingssub-directoryyoucreated(withcdandthepath)Verifyfromtheprompt(typeinDIR)thatyouareintherightlocation.Wheninthecorrectdirectory,typein:..\las2shp–i*.las–single_pointsandhitreturn.Again,youmaygetawarningthatyou’reunauthorized,andthey’readdingsmallerrorstothedata,youcanignorethemhere.Thecommandaccessesthelas2shpcommandinthe“parent”directory“above”thecurrentdirectory(the..\las2shp),tellsittouseall.lasfilesasinput(–i*.las),andtooutputsingle-pointshapefiles(-single_points),notmultipointfiles,whichclusterpointsinblocks,reducingfilesize,butencumberingaccess.

ESPM4295/5295 11-Oct-16

7

Verifytheabovecommandworked,firstbylookinginthebuildingsdirectoryandcheckingthatshapefile(s)appeared,andthenbydisplayingthedatainanArcMapview:Youcanseethepoints,hereinyellow,moreorlessmatchthebuildinglocations.Theslightmismatchisbecauseofbuildingleanintheaerialphotographs.Youmightrememberthatorthophotoscorrectalllocationsasiftheywereontheground,andthetopsofbuildingsaren’t.Thus,thetopsgetdisplaced,usuallyoutwardfromtheimagingcenterrelativetothecameraposition.That’swhyskyscrapersseemtoleaninmost“vertical”orthophotos.Nowweshouldlookatheights.Openthetableforyourpointshapefile,andaddanewfieldnamedzHeight,doubleorfloat,precision12,scale1(itmaytakeawhile).Whenitisdone,calculatethezvalue(remember,rightclickoncolumn,calculategeometry,z-coordinateofpoint.Again,thismaytakeawhile,therearemanypoints).Whentheprocessisfinished,usetheidentifybuttontoqueryafewbuildingheights.Remember,thevaluesareinmeters.Dothesevaluesmakesense?Arethebuildingsover200meters(650ft)tall?Whydoyouthinkyou’regettingthesevalues?TheZvaluerepresentstheorthometricheightofthetopofthebuilding.Thisistheheightrelativetoourstandardsurface,nearsealevel,andnotrelativetothelocalgroundsurface.Weneedtosubtractthelocalgroundsurfacefromthebuildingzvaluetogetbuildingheight.Onewayistoquerytherasterbeloweachpoint,andaddittothetablerecordforeachpoint.WecanthensubtracttheDEMheightfromthezHeight,andgetabuildingheight.TheExtractValuestoPointstool,foundatArcToolbox->SpatialAnalystTools->Extractiondoesjustthis.Specifyingtheinputandoutputswillqueryeachcellbeloweachpoint,andaddacolumntothenewdatalayerspecified.Thismaytakequitealongtime,sobepatient.

ESPM4295/5295 11-Oct-16

8

ThisgeneratesanewcolumnnamedRASTEVALthatcontainsthegroundelevationsnearateachpoint:Nowyoucancalculatethebuildingheightsforeachpoint.DothisusingwhatyouknowabouttablecalculationsusingArcMap,creatinganewvariablecalledsomethinglikebuild_hghtfortheheightabove-groundsampledateachpoint.Youshouldhaveatablethatlookssomethingliketheonetotheright:Now,calculatetheaverageheight

ESPM4295/5295 11-Oct-16

9

frompointsamplesforoneofyourbuildings.Thereareseveralwaystodothis.Perhapstheeasiestisaspatialjoin.First,createapolygonthatrepresentsthebuildingyou’vechosen.YoumayhavetodisplayboththeLiDARpointsandanimageofthestudyareawithyourbuilding,andadjustthebuildingfootprintpolygonabittoaccountforbuildinglean.Afterdigitizingandsavingthebuilding,useSelectByLocationinthemainArcMapscreentoselectpointsfromyourlayerwithheights(figureatleft).Thiswillonlyselectpointsthatintersectthebuildingfootprintpolygon.Youmaythenopenthetablefortheoutputpointfile(pointheightshere),thenrightclickonthebuild_hghtcolumn,andspecifyStatistics:

anditwilldisplaythemeanoftheselectedpoints,amongotherstatistics.

ESPM4295/5295 11-Oct-16

10

Thereareabitmorecomplicatedwaystosummarizestatisticstomultiplepolygons,butsincethisisjusttogiveyoushortintroductiontoLiDAR,thismanualmethodwillsuffice.YouwouldneedtodoquiteabitofadditionalprocessingtocleanupthedeliveredLiDARdatapriortoextractingaccurateaveragebuildingheightsformultiplebuildings,andonebuildinggivesyouanideaofthedatastructureanduse.TurninamapofshowingyoursubsetLiDARdataforyourprojectarea,yourbuildingpolygon,andyourcalculatedaveragebuildingheight.Useanimageforthebackground,eithertheHiRezimagesontheclassdrive,oroneoftheWMSlayers.Includetheusualtitle,legend,scale,andotherstandardmapelements.Dothissameexerciseforasinglelargetreeorpatchoftreesinyourprojectarea.Again,createandturninasecondmapofyourresults,withanimagebackground,thetreepolygon,yourLiDARvegetationpoints,themeasuredaverageheightforoneofthetrees.