public static void dumpLasFolderOverview ( String folder , CoordinateReferenceSystem crs ) throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder ( ) ; b . setName ( "overview" ) ; b . setCRS ( crs ) ; b . add ( "the_geom" , Polygon . class ) ; b . add ( "name" , String . class ) ; SimpleFeatureType type = b . buildFeatureType ( ) ; SimpleFeatureBuilder builder = new SimpleFeatureBuilder ( type ) ; DefaultFeatureCollection newCollection = new DefaultFeatureCollection ( ) ; OmsFileIterator iter = new OmsFileIterator ( ) ; iter . inFolder = folder ; iter . fileFilter = new FileFilter ( ) { public boolean accept ( File pathname ) { return pathname . getName ( ) . endsWith ( ".las" ) ; } } ; iter . process ( ) ; List < File > filesList = iter . filesList ; for ( File file : filesList ) { try ( ALasReader r = new LasReaderBuffered ( file , crs ) ) { r . open ( ) ; ReferencedEnvelope3D envelope = r . getHeader ( ) . getDataEnvelope ( ) ; Polygon polygon = GeometryUtilities . createPolygonFromEnvelope ( envelope ) ; Object [ ] objs = new Object [ ] { polygon , r . getLasFile ( ) . getName ( ) } ; builder . addAll ( objs ) ; SimpleFeature feature = builder . buildFeature ( null ) ; newCollection . add ( feature ) ; } } File folderFile = new File ( folder ) ; File outFile = new File ( folder , "overview_" + folderFile . getName ( ) + ".shp" ) ; OmsVectorWriter . writeVector ( outFile . getAbsolutePath ( ) , newCollection ) ; }
Dump an overview shapefile for a las folder .