The water closet for railroad cars was invented by Lewis Latimer and Charles W. Brown in 1874. It holds U.S. Patent 147,363.
Up until the invention of the water closet, railroad cars used an open hopper system, meaning there was no pan to hold the waste and it was immediately discharged on the tracks.
The new design incorporated a cover, or pan, that would slide into the bottom of the toilet when the lid was raised. The waste would discharge when the lid was closed.
The device was designed to coat the pan with a layer of earth or sand to absorb the waste before discharge.
Modern railcar water closets do actually use water and have holding tanks for waste which must be periodically pumped out.