首页 GDAL介绍

GDAL介绍

举报
开通vip

GDAL介绍IntroductiontoOpenSourceRS/GISprogrammingwithPythonChrisGarrardRS/GISLaboratoryUtahStateUniversityWhybotherwithFOSS?FreeandOpenSourceSoftware(FOSS) Affordable(free,asinfreebeer)Fitsthebudgetofsmallcompaniesorindividuals Open(asinfreespeech)Useitforwhateveryouw...

GDAL介绍
IntroductiontoOpenSourceRS/GISprogrammingwithPythonChrisGarrardRS/GISLaboratoryUtahStateUniversityWhybotherwithFOSS?FreeandOpenSourceSoftware(FOSS) Affordable(free,asinfreebeer)Fitsthebudgetofsmallcompaniesorindividuals Open(asinfreespeech)UseitforwhateveryouwantDistributeitifyouwantModifyitifyouwantWhybotherwithFOSS? HelpfulusercommunityIncludingthedevelopersthemselves Fastbugfixes NotlimitedtoWindows LightweightCons LightweightNottheESRIgeoprocessor SmallerusercommunitythansomeotherpackagesFree!=inferior Apache,MySQL,Linux,Firefox,etc. ESRIlikesPython GDALisusedbypopularcommercialpackagesArcGIS,ErdasImagine,ERMapperPython Free,evenforresale Powerfulandhasextensivelibraries Easytointegratewithothertools Runsonmanydifferentoperatingsystems EasytolearnGDALandOGRlibraries Free,evenforresale Availableformanydifferentoperatingsystems WritteninANSICandC++ BindingsexistforPython,C#,Perl,Java,Ruby,R,VB6OGR OGRSimpleFeaturesLibrary Vectordataaccess Software-specificformatsshapefiles,personalgeodatabases,ArcSDE,MapInfo,GRASS,Microstation OpenformatsTIGER/Line,SDTS,GML,KML DatabasesMySQL,PostgreSQL,OracleSpatial,Informix,ODBCGDAL GeospatialDataAbstractionLibrary Rasterdataaccess Supportsabout100differentformatsArcInfogrids,ArcSDEraster,Imagine,Idrisi,ENVI,GRASS,GeoTIFFHDF4,HDF5USGSDOQ,USGSDEMECW,MrSIDTIFF,JPEG,JPEG2000,PNG,GIF,BMPReal-worldexamples Drillthroughafewhundredrasterimagesandpulloutcellvaluesatseveralhundredpoints(~3.5millionvaluesinoutput) BatchcomputeNDWI(NormalizedDifferenceWaterIndex)forLandsatimagery BatchclipextraneousdatafromedgesofimagesReal-worldexamples Createdatextfilewithinfo(boundingcoordinates,dimensions,etc)aboutseveralhundredMSSimageswhichwasthenusedtoinputdataintoadatabase Createdpolygonsshowingboundingcoordinatesofactualdatainseveralhundredrasterimages LogisticregressionLocationCalculator*WebApplicationtoproject.CanenterUTM,PLS,Lat/Long,Stateplane.Usesdiv’stodisplayfromUnitsdropdownmenusubmitsformtocalculate.asp*ResultsPage,don’thavetowaitforargisscriptinglicense<%@Language=Python%>defgetdata(keys=''): '''possiblewaystocallthisfunction: value=getdata('key') dict=getdata(('key1','key2'))#getsubset dict=getdata()#returneverything Itassumesyoudon'thavethesamekeyfor GETandPOSTmethods ''' importtypes key_type=type(keys) d_data={}#initializedictionary ifkeys=='':#iftheydon'tsupplykeysthenreturneverything forkeyinRequest.Form: d_data[key]=Request.Form(key) forkeyinRequest.QueryString: d_data[key]=Request.QueryString(key) returnd_data elifkey_type==types.StringType:#iftheyprovideasinglestring value=Request.Form(keys) if(value!='None')and(str(value)=='None'): returnRequest.QueryString(keys) else: returnvalue #iftheyprovidealistthenreturnadictionarywithallthekey/values elifkey_type==types.TupleTypeorkey_type==types.ListType: forkeyinkeys: value=Request.Form(key) #nowcheckifthedatawasempty,ifsolookatQueryString if(value!='None')and(str(value)=='None'): value=Request.QueryString(key) data[key]=value returnd_dataifstr(key)=='utm':X_UTM=getdata('UTMx') Y_UTM=getdata('UTMy')datum=getdata('datumutm')*FormdatausingLanguage=Pythontaginasp.Defgetdata()retrievesvariablesfromform.Getdata()getsvariablesforuseinPythonUTMNAD27Zone12North420949.174513683.50Projectsto:*Project()transformsxyfromoneprojectiontoanotherwrittenwithResponse.WriteUTMNAD27Zone12North420949.174513683.50Projectsto:*PLSSusespyodbcshowsabilitytoqueryMicrosoftSQLdatabaseandreturnresultsUTMNAD27Zone12North420949.174513683.50Projectsto:*Shapefile()usesspatialqueriestoreturndatafromdbfGeocoding*GeocodingServiceShapefilefromSQL*CreateshapefileandwriteprjfileEx.1:Readingvectordata Openapointshapefile Foreachpoint:Getthe“id”and“cover”attributesGetthex,ycoordinatesforthepointPrint“idxycover”Ex.2:Extractingvectordata Extractall“Quackingaspenwoodlandalliance”SWReGAPfieldsitesinWasatchcountyfromthestatewidedataset OpenapointshapefilewithSWReGAPsamplesites OpenaUtahcountiespolygonshapefile Createanewpointshapefile UsethecountyfiletolimittheSWReGAPshapefiletoWasatchCountyEx.2:Extractingvectordata LimitSWReGAPto“Quakingaspenwoodlandalliance” ForeachpointinSWReGAP(rememberitisnowfilteredspatiallyandbyattribute):Copythefeatureintothenewshapefile CloseallofthefilesEx.3:GenerateNearTabletool Givenapointshapefile(SWReGAPfieldsites)andalineshapefile(roads),calculatethedistancefromeachpointtothenearestroad Openbothshapefiles Foreachpoint: LimitthesearchtotheprovidedradiusbybufferingthepointandusingthattosetaspatialfilterontheroadsEx.3:GenerateNearTabletool Foreachpoint,continued: GetthedistancetothefirstlineanditsFID Loopthroughtherestofthelinesandifthedistanceislessthanthe“remembered”distance,thenrememberthenewdistanceandFID WriteoutthepointFIDandtherememberedlineFIDanddistancetoatextfile Closetheshapefilesandthetextfile NeedsanArcInfolicenseinArcMap(canprobablywriteyourownscript,though)Ex.4:Extractpixelvalues Openapointshapefile Opena3-bandrasterfile Foreachpointintheshapefile:Printoutthepixelvaluesatthatlocationforallthreebands “Sample”toolrequiresSpatialAnalyst(tobefair,IthinkImayhavedonethiswiththearcgisscriptingmodulewithoutSA)Ex.5:ComputeNDVI CreateaNormalizedDifferenceVegetationIndexforanASTERimage Opentheimage Gettheimagedimensionsandblocksize Usethisinfotocreateanewimage Readinoneblockatatimefromtheimage ComputetheNDVI:(band3-band2)/(band3+band2) Writetheblocktothenewimage ComputethestatisticsforthenewimageEx.5:ComputeNDVI Setthegeoreferencingandprojectionforthenewimage Buildpyramidsforthenewimage NeedstheSpatialAnalystextension,andIdon’tknowifyoucoulddoitwithanythinginthegeoprocessorwithoutSA–I’msureyoucoulddoitwithArcObjectsEx.6:NDVIinArcMap RuntheNDVIscriptinArcMap Changethescripttoacceptparameters Changethescripttosenderrormessagestothegeoprocessor AddthescripttoatoolboxThanks! Coursematerialsatwww.gis.usu.edu/~chrisg/python Icanbecontactedatchrisg@gis.usu.edu*WebApplicationtoproject.CanenterUTM,PLS,Lat/Long,Stateplane.Usesdiv’stodisplayfromUnitsdropdownmenusubmitsformtocalculate.asp*ResultsPage,don’thavetowaitforargisscriptinglicense*FormdatausingLanguage=Pythontaginasp.Defgetdata()retrievesvariablesfromform.Getdata()getsvariablesforuseinPython*Project()transformsxyfromoneprojectiontoanotherwrittenwithResponse.Write*PLSSusespyodbcshowsabilitytoqueryMicrosoftSQLdatabaseandreturnresults*Shapefile()usesspatialqueriestoreturndatafromdbf*GeocodingService*Createshapefileandwriteprjfile
本文档为【GDAL介绍】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
会人会语
暂无简介~
格式:ppt
大小:1MB
软件:PowerPoint
页数:0
分类:工学
上传时间:2020-01-03
浏览量:3