def bufferPoints(): Unit ={
val extent:Extent = Extent(0, 0, 80, 80)
val re =RasterExtent(extent, 100, 100)
val points = Seq(
Point(30,30).buffer(3),
Point(20,20).buffer(3),
Point(24,25).buffer(3),
Point(15,20).buffer(3))
val rpts:Tile = Rasterizer.rasterizeWithValue(points,re, 0x55)
rpts.renderPng(colorMap1).write("D:\\IdeaProjects\\ScalaDemo\\data\\buffer\\buffer_point.tif")
}
先栅格化之后再对栅格数据进行buffer:
def bufferTiles(): Unit ={
val featureRDD :RDD[Geometry]= sc.parallelize(points)
val extent:Extent = Extent(0, 0, 80, 80)
val tl = TileLayout(10,10,10,10)
val layout = LayoutDefinition(extent, tl)
val celltype:CellType=IntCellType
val tilesRDD : RDD[(SpatialKey, Tile)] with Metadata[LayoutDefinition] = featureRDD.rasterize(35, celltype, layout)
val neighborhood = Square(3)
tilesRDD.bufferTiles(neighborhood.extent)
val tileResult = tilesRDD.collect()
for(tile <- tileResult){
}
val stitched = TileLayoutStitcher.stitch(tileResult)._1
stitched.renderPng(colorMap1).write("D:\\IdeaProjects\\ScalaDemo\\data\\buffer\\buffer_tile.tif")
}