After reading this, I found that Mathematica could be a useful tool to analyse GPS data from a navigating vessel at sea. But this example is for land-based fixed positions, i.e. the position of a lake on the globe.

Suppose a computer is on a ship, and we want to import the GPS position of the ship into the computer. Then Mathematica has this tool:


This attempts to find the current geo location of the computer. But to my knowledge, this position includes only latitude and longitude.

If it does include height-estimation, it may also be that FindGeolocation is inaccurate on height-estimation.

Does Mathematica have a program that can import GPS data from a navigating vessel with both latitude, longitude and height over sea level?

I would like to import data from a GPS readout into Mathematica in real-time, and wonder therefore if there are specific functionalities in Mathematica to receive data from a GPS and directly feed it into a command line, ie. particular codes that automatize the conversion of GPS data into a regular dataset in the format

{{time_1,height over sea level_1}, {t_2,h_2},....{t_n,h_n}}


  • 1
    $\begingroup$ Ok, tried to add some more. $\endgroup$
    – Vangsnes
    Dec 8, 2022 at 10:39
  • 1
    $\begingroup$ The docs say: "FindGeoLocation returns a GeoPosition object containing {latitude,longitude} or {latitude,longitude,elevation} or containing Missing["NotAvailable"] if it cannot find an explicit geodetic location.". So if a GPS is available, and not just a location guessed from IP or address, elevation should be available. Otherwise, if the GPS can be addressed via a system call, USB or serial interfaces, it will depend on the nature of the calls available and the format they are returned. Do you have a more specific example? $\endgroup$
    – rhermans
    Dec 8, 2022 at 11:17
  • $\begingroup$ Yes, consider the ship navigating on a rough sea. Then the elevation of the ship (with the computer with Mathematica installed on board) is oscillating over the sea according to the wave-train. Then take the height-coordinates in real time and prepare them as a set of points on a 2D plot, where x is the time dimension, and y is the amplitude. $\endgroup$
    – Vangsnes
    Dec 8, 2022 at 11:41
  • 2
    $\begingroup$ Many GPS devices will export NMEA data to a serial interface. (See, e.g.,: learn.sparkfun.com/tutorials/gps-basics/reading-gps-data). A solution is to open a serial connection (reference.wolfram.com/language/ref/device/Serial.html) and then to write your own function that parses the NMEA string into the input for a GeoPosition reference.wolfram.com/language/ref/GeoPosition.html $\endgroup$ Dec 8, 2022 at 18:56

1 Answer 1


The best way to extract the height from a GPS position is via the command:


This gives the output of the height where the computer is located:

Out12: 10.0 m

Alternatively of the height where the IP address is routed from:


Out13: 82 m


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.