Annelids have radiated into a number of niches. Some are parasitic, notably the leeches and myzostomarians; others filter-feed or prey on other invertebrates. However, probably the most significant ecological role played by annelids is reworking of soil and sediments. Many polychaetes and oligochaetes, and even a few leeches, are burrowers that constantly rework the sediment through which they burrow; in addition, they may ingest and excrete large quantities of sediments or soils. Robison (1987) notes that some sandy beaches may harbor 32,000 burrowing annelids per square meter, which collectively may ingest and excrete 3 metric tons of sand per year. The tubes sticking up from the sand in this picture, taken on a beach at Bahia de las Animas, Baja California, give some idea of how common polychaetes can be in such environments.
Soils may harbor 50 to 500 earthworms per square meter; they keep soils aerated, and their castings fertilize the soil.
Most earthworms and leeches are hermaphroditic with both male and female gonads. Polychaetes usually have separate sexes; many polychaetes hatch into a particular type of planktonic larva, the trochophore, which later metamorphoses into a juvenile annelid. Some polychaetes, however, can reproduce asexually, by budding.