How does tremor sense help earth elementals navigate underground?

So tremor sense allows you to feel vibrations through connected liquid or solid matter.

Earth elementals have earth glide which allows them to freely travel through earth (stone, dirt, ... (even lava if they have resistance or immunity to fire)).

How does it know what kind of substance it is about to travel through? How does it detect voids (not tunnels which you could rule feeling the vibration of air flow in the tunnel) or that there is a buried chest its about to run into? Or some other hazard that is in its path that it might want to avoid but "doesnt know about" because its not moving.

Tremorsense: A creature with tremorsense is sensitive to vibrations in the ground and can automatically pinpoint the location of anything that is in contact with the ground. Aquatic creatures with tremorsense can also sense the location of creatures moving through water. The ability’s range is specified in the creature’s descriptive text.

Supposing vibrations in the ground work at all like they do in our world (a necessary base assumption to make sense of the fictional world at all), they are reflected at interfaces where the speed of sound changes sharply. Hence, if there are any vibrations around, the tremorsensing creature can detect at least the close boundaries where the density of the material changes sharply (for example, from rock to air or water or I guess magma or treasure chest), and probably also where the kind of rock changes.

The relevant field of study is inverse problems; especially inverse scattering and inverse problems for the Helmholtz equation. (Vibrations are sound/pressure waves.)

It seems that an earth gliding creature creates no vibrations (see quote below). Exactly how sensitive the creature is, and how much background vibrations there are in the medium, are completely up to the GM/referee.

From earth glide monster ability:

Its burrowing leaves behind no tunnel or hole, nor does it create any ripple or other sign of its presence.

• So like echolocation, but the creature doesn't create the vibration, it uses ambient ones? – Ifusaso Mar 24 '17 at 11:19
• Yes, like echolocation but the sound waves are travelling through earth rather than air. – Tommi Mar 26 '17 at 14:23
• Ask a drilling engineer about "seismic" sometime -- reflection seismology (basically, mechanical tremorsense) has become an invaluable part of oil and gas exploration. – Shalvenay Mar 26 '17 at 23:07

Tremor Sense allows Earth Elementals to sense (non-flying) creatures moving above them; it's not as much for objects in the ground.

How much they can interpret about the earth they Glide through is largely left to GM interpretation, but the ability does specify:

as easily as a fish swims through water

Does this mean that it acts per the Swim rules with a Swim speed (can take 10, +8 to checks) or was this just flavor text (as it appears to be)? Probably just flavor text, but this could indicate that an Earth Elemental's senses do allow it to sense differences and objects in earth, as a fish understands where currents and objects such as ships and reefs are. Following this example, fish generally aren't very aware of creatures above the level of their water. Yes, they could see, but it's not earth, is it? Hence, GM interpretation.