Main Content

Location Sensor

Measure GPS latitude, longitude, and altitude


Simulink Support Package for Android Devices / Sensors

  • Location Sensor block


Get the latitude, longitude, and altitude measurements from the GPS receiver on the Android™ device.

The Location Sensor block has three outputs: Lat, Lon, and Alt. Each port outputs a double-precision scalar value. The format of the measurements is decimal degrees, with six places to the right of the decimal point. This number of decimal places has greater accuracy than the GPS receiver provides. For example, at the equator, 0.000001 degrees is approximately 11.1 centimeters. GPS accuracy is typically measured in meters.

The GPS measurements reference the most recent revision of the World Geodetic System (WGS84).

If the GPS receiver on device does not support altitude measurement, then the output Alt returns zeros.


GPS must be enabled on the device. If

  • GPS is disabled on the device

  • Device does not contain a GPS sensor

  • Simulating without a device

this block outputs zeros. See Block Produces Zeros or Does Nothing in Simulation.


Sample time

Specify how often the block reads the sensor.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2014a