class MapViewController { def index = { def rasterEntryIds = params.filenames?.split(',') def left = null def right = null def top = null def bottom = null rasterEntryIds.each { def rasterEntry = RasterEntry.get(it) if ( left == null || rasterEntry.groundGeom?.bounds?.minLon < left ) left = rasterEntry.groundGeom?.bounds?.minLon if ( bottom == null || rasterEntry.groundGeom?.bounds?.minLat < bottom) bottom = rasterEntry.groundGeom?.bounds?.minLat if ( right == null || rasterEntry.groundGeom?.bounds?.maxLon > right) right = rasterEntry.groundGeom?.bounds?.maxLon if ( top == null || rasterEntry.groundGeom?.bounds?.maxLat > top ) top = rasterEntry.groundGeom?.bounds?.maxLat } [filenames: params.filenames, left: left, top: top, right: right, bottom: bottom] } }