• 啊喵喵喵喵喵
    了解作者
  • Java
    开发工具
  • 2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2021-03-17 18:14
    上传日期
通过GEE平台调用Landsat8影像数据对土地覆被进行分类,并且计算其总体精度
新建文件夹.zip
  • 新建文件夹
  • 新建文本文档.txt
    11.4KB
内容介绍
var visualParam = {bands: ['B4', 'B3', 'B2'], max: 0.3};//可视化参数1 var ndwiViz = {min: 0, max: 1, palette: ['00FFFF', '00FFFF']};//可视化参数2 var landsat_1 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(geometry) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_2 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi2) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_3 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi3) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_4 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi4) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_5 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi5) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_6 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi6) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_7 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi7) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi8) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_9 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi9) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_10 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi10) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_11 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi11) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_12 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi12) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_14 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi14) .filterDate("2019-01-01","2019-12-30") .sort('CLOUD_COVER') .first(); var landsat_15 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi15) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_13 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi13) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var landsat_16 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(roi16) .filterDate("2019-04-01","2019-09-30") .sort('CLOUD_COVER') .first(); var mosaic_1 = ee.ImageCollection.fromImages([landsat_16,landsat_15,landsat_14,landsat_13,landsat_12,landsat_11,landsat_10,landsat_9,landsat_8,landsat_7,landsat_6,landsat_5,landsat_4,landsat_3,landsat_2,landsat_1]).mosaic(); //clip by asset/roi var image = mosaic_1.clip(geometry); print(image) Map.addLayer(image,{bands:["B4","B3","B2"],min:0,max:0.3,gamme:1.4},"Geometry_2019"); //Map.addLayer(geometry,{},"geometry_mun"); var mndwi = image.normalizedDifference(['B3', 'B6']).rename('MNDWI');//计算MNDWI var ndbi = image.normalizedDifference(['B6', 'B5']).rename('NDBI');//计算NDBI var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');//计算NDVI image = image .addBands(ndvi) .addBands(ndbi) .addBands(mndwi) image = image.clip(geometry) var landcover = vegetation.merge(water_body).merge(building).merge(Arable); print(landcover); var bands = ["B2","B3","B4","B5","B6","B7","MNDWI","NDBI","NDVI"]; var training = image.select(bands).sampleRegions({ collection:landcover, properties:["landcover"], scale:30 }); var withRandom = training.randomColumn("random");//样本点随机的排列 // 我们想保留一些数据进行测试,以避免模型过度拟合。 var split = 0.7; var trainingPartition = withRandom.filter(ee.Filter.lt("random", split));//筛选70%的样本作为训练样本 var testingPartition = withRandom.filter(ee.Filter.gte("random", split));//筛选30%的样本作为测试样本 // 选择分类的属性 var classProperty = 'landcover'; var classifier = ee.Classifier.libsvm().train({ features:training, classProperty:"landcover", inputProperties:bands }); var classified = image.select(bands).classify(classifier); Map.centerObject(landcover, 11) var palette = [ "036a12",//vegetation(0)//green "06ffe3",//water_body(1) "fbe308",//building(2) "d408ff"//Arable (3) ]; print(classified) var test = testingPartition.classify(classifier);//运用测试样本分类,确定要进行函数运算的数据集以及函数 var confusionMatrix = test.errorMatrix('landcover', 'classification');//计算混淆矩阵 print('confusionMatrix2019',confusionMatrix);//面板上显示混淆矩阵 print('overall accuracy2019', confusionMatrix.accuracy());//面板上显示总体精度 print('kappa accuracy2019', confusionMatrix.kappa());//面板上显示kappa值 Map.addLayer(classified,{min:0,max:4,palette:palette},"LUCC_2019"); Export.image.toDrive({ image: classified,//分类结果 description: 'wuhan_2019',//文件名 folder: 'wuhan_2019', scale: 30,//分辨率 region: geometry,//区域 maxPixels:34e10//此处值设置大一些,防止溢出 }); //2009 var landsat_17 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(geometry) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_18 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi2) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_19 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi3) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_20 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi4) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_21 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi5) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_22 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi6) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_23 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi7) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_24 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi8) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_25 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi9) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_26 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi10) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_27 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi11) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_28 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi12) .filterDate("2001-04-01","2001-09-30") .sort('CLOUD_COVER') .first(); var landsat_29 = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA") .filterBounds(roi14) .filterDate("2001-04-01","2001-09-30
评论
    相关推荐
    • BBS_system_on_java.rar
      BBS论坛系统由JAVA和JSP实现,开发中涉及JavaBean,JSP和服务器Tomcat5.0.7的设置,数据库用SQL2000。有注册登陆,浏览,发帖 回帖,帖子管理,论坛设置,管理版块,用户管理等模块。
    • 30184342396.rar
      jsp图书管理系统,自己看了,感觉还不错,用的mysql的数据库
    • online.rar
      jsp 在线客服 源码 实现在线聊天的功能
    • oa_09.rar
      oa办公系统 java+tomcat+mySQL实现
    • LibraryManage.rar
      是一个用jsp做前台,java做后台的图书管理系统,可供毕业设计做参考
    • demo.zip
      extjs与Struts整合以及与后台数据库的交互 非常值得学习的一个案例,仅供学习
    • exam.rar
      STRUTS的在线考试系统 数据库MYSQL 超完整,超好用的!
    • JSP+Servlet+JavaBean(MVC).rar
      此项目以JSP、servlet、JavaBean实现MVC三层架构.
    • shop.zip
      网上商城开发源码:jsp+servlet+javabean+DAO设计模式+前台+后台+数据库设计文件(mysql)
    • S2.rar
      小组做的一个旅游网站,比较基础,处理器都是用servlet实现的,数据库是sql2005