@@ -87,7 +87,7 @@ exports["test: get raster pixel from point"] = function() {
8787 assert . strictEqual ( 20 , pixel . y , "Value should be 20" ) ;
8888} ;
8989
90- exports [ "test: crop a raster" ] = function ( ) {
90+ exports [ "test: crop a raster with a bounds " ] = function ( ) {
9191 var format = new raster . Format ( { source : admin . raster . source } ) ;
9292 var tif = format . read ( { } ) ;
9393 var smallTif = tif . crop ( new geom . Bounds ( [ - 180 , - 90 , 0 , 0 ] ) )
@@ -96,4 +96,15 @@ exports["test: crop a raster"] = function() {
9696 assert . strictEqual ( - 90 , Math . round ( bounds . minY ) , "Min Y should be -90" ) ;
9797 assert . strictEqual ( 0 , Math . round ( bounds . maxX ) , "Max X should be 0" ) ;
9898 assert . strictEqual ( 0 , Math . round ( bounds . maxY ) , "Max Y should be 0" ) ;
99+ } ;
100+
101+ exports [ "test: crop a raster with a geometry" ] = function ( ) {
102+ var format = new raster . Format ( { source : admin . raster . source } ) ;
103+ var tif = format . read ( { } ) ;
104+ var smallTif = tif . crop ( new geom . Point ( [ 0 , 0 ] ) . buffer ( 4 ) )
105+ var bounds = smallTif . bounds ;
106+ assert . strictEqual ( - 4 , Math . round ( bounds . minX ) , "Min X should be -4" ) ;
107+ assert . strictEqual ( - 4 , Math . round ( bounds . minY ) , "Min Y should be -4" ) ;
108+ assert . strictEqual ( 4 , Math . round ( bounds . maxX ) , "Max X should be 4" ) ;
109+ assert . strictEqual ( 4 , Math . round ( bounds . maxY ) , "Max Y should be 4" ) ;
99110} ;
0 commit comments