looking for Lat/Long plotting software

JBP-PA

.
Apr 29, 2022
616
Jeanneau Tonic 23 Erie, PA
I have data files that have lat/long and other data recorded every 5 minutes. I'd like to process this data to get various interesting data, such as total mileage, mileage per day, avg speed, etc. I've tried google maps, but it doesn't do any of the analysis. I've tried GPX Viewer and Record (Windows), but meh.

Any suggestions as to other software? This is just for fun, so free is good.

I have several years worth of this data. Eventually I might try turning it into a set of Polars that would exactly match my boat/sails/style, etc.

Here is a screenshot of the type of data sets I have.
Screenshot 2024-09-10 20.34.26.png
 

dLj

.
Mar 23, 2017
4,409
Belliure 41 Back in the Chesapeake
Did you try OpenCPN? I don't know how many data points you have in that set - I'm only seeing 41. I'm sure there are a number more... I'd think actually setting up macros in Excel might be your best bet.

dj
 
Last edited:

jssailem

SBO Weather and Forecasting Forum Jim & John
Oct 22, 2014
23,137
CAL 35 Cruiser #21 moored EVERETT WA
Here is a link

Here is the formula.
Obtaining the distance between two points on Earth – distance between coordinates.
If we apply the haversine formula for a central angle (i.e., the angle between two points along a great circle on a sphere with radius R) and solve for distance, we obtain:
d = 2R × sin⁻¹(√[sin²((θ₂ - θ₁)/2) + cosθ₁ × cosθ₂ × sin²((φ₂ - φ₁)/2)])
where:
  • θ₁, φ₁ – First point latitude and longitude coordinates;
  • θ₂, φ₂ – Second point latitude and longitude coordinates;
  • R – Earth's radius (R = 6371 km); and
  • d – Distance between them along Earth's surface.
Keep in mind that the angles θ₁ and θ₂ are not the same as those used in the spherical coordinate system introduced above. They denote latitude in this formula.

Using this haversine distance formula, you can translate latitude and longitude to distance, given the coordinates of two points on Earth, although with a minor setback. It can result in an error of up to 0.5% because the Earth is not a perfect sphere.
 
  • Like
Likes: JBP-PA
May 17, 2004
5,676
Beneteau Oceanis 37 Havre de Grace
It sounds like your goals are mostly about analyzing the data and not viewing the route, so I’d be inclined to script it in Python. That would be infinitely customizable to whatever kind of analysis you’d like, and there are available Python libraries for tons of stuff. A quick Google search shows a Geopy library that would probably do most of the distance calculations you need.

This is actually the kind of boat project that GenAI like ChatGPT can be pretty helpful for. I like doing that kind of thing over the winter after the boat is covered up.
 
  • Like
Likes: JBP-PA
Apr 25, 2024
519
Fuji 32 Bellingham
I will say that using GPT is not a good fit for this sort of problem. I work intensively with machine learning in general and with OpenAI (ChatGPT's company) specifically. To perform data analysis, OpenAI would invoke what they call the "Code Interpreter", which does a pretty good job of making general and insightful observations about the data. But, it is not dependable for doing accurate calculations. In fact, it is worth than undependable because, what the underlying GPT technology is good at is sounding convincing.

That is, ChatGPT is not designed to produce true and accurate answers. It is designed to produce convincing answers that are satisfying to humans. The fact that a convincing/satisfying answer is also often true and accurate is a by-product of the design of the LLM (large language model) upon which the technology is based. In fact, even though it seems like ChatGPT has a deep understanding of the conversation, it actually does not understand what you are saying, nor does it even understand the response it gives. (I understand this is hard to wrap one's mind around, but it is true.)

With that said, I can offer two solutions. One is a spreadsheet. If you have reasonable spreadsheet skills, you can answer any question you want answerd. The second is to send me a private message with a sample of the data and a description of the kinds of questions you want answered. I could probably program something in an afternoon.

Giving David's post about ChatGPT a second look, it might be that he is saying that ChatGPT would be useful in writing a Python script to do the analysis, and not having ChatGPT do the analysis for you. If that was the intent, then I completely agree. These days, most programmers use GPTs to assist in writing code. It has really changed the way developers work. But, you still need to be pretty comfortable with programming and the math involved, otherwise there is no way to tell is the script actually does what it looks like it is doing. It rarely produces code that really does exactly what you want without needing any modification.
 
May 17, 2004
5,676
Beneteau Oceanis 37 Havre de Grace
Giving David's post about ChatGPT a second look, it might be that he is saying that ChatGPT would be useful in writing a Python script to do the analysis, and not having ChatGPT do the analysis for you. If that was the intent, then I completely agree. These days, most programmers use GPTs to assist in writing code. It has really changed the way developers work. But, you still need to be pretty comfortable with programming and the math involved, otherwise there is no way to tell is the script actually does what it looks like it is doing. It rarely produces code that really does exactly what you want without needing any modification.
Yes, that’s exactly what I had in mind, not using ChatGPT to actually parse the data itself. Thanks for pointing out my lack of clarity - I agree that using ChatGPT to do the actual calculations would almost certainly give the wrong answers.

Just for grins I asked it to help and here’s what I got:
Here's the modified version of the Python module that uses the `geopy.distance` library instead of the Haversine formula to calculate the distance between successive rows:

```python
import pandas as pd
from geopy.distance import geodesic

def calculate_distances(df):
distances = [0] # First entry has no previous point, so distance is 0
for i in range(1, len(df)):
# Get coordinates for the current and previous points
coord1 = (df.loc[i-1, 'latitude'], df.loc[i-1, 'longitude'])
coord2 = (df.loc[i, 'latitude'], df.loc[i, 'longitude'])

# Calculate the geodesic distance in kilometers
distance_km = geodesic(coord1, coord2).kilometers
distances.append(distance_km)

return distances

def add_distance_to_csv(input_csv, output_csv):
# Read the CSV file
df = pd.read_csv(input_csv)

# Calculate distances and add as a new column
df['distance_km'] = calculate_distances(df)

# Save the updated DataFrame to a new CSV file
df.to_csv(output_csv, index=False)

# Example usage:
# add_distance_to_csv('input_data.csv', 'output_data_with_distances.csv')
```

### Explanation of Changes:

1. **Using `geopy.distance.geodesic`**: This library simplifies the distance calculation. It uses the WGS-84 ellipsoid model of the Earth to calculate the geodesic distance between two points.
- The `geodesic` function takes two tuples of coordinates (latitude, longitude) and returns the distance between them. The `.kilometers` attribute returns the result in kilometers.

2. **`calculate_distances` Function**:
- For each row in the DataFrame, it retrieves the coordinates of the current and previous rows.
- It then calculates the geodesic distance between them using `geodesic`.

### How to Install `geopy`:

If you haven't already installed `geopy`, you can do so using pip:

```bash
pip install geopy
```

### Example:

For a CSV file with the following content:
```csv
latitude,longitude
34.052235,-118.243683
34.052500,-118.244000
34.052800,-118.244300
```

The output will include an additional `distance_km` column, for example:

```csv
latitude,longitude,distance_km
34.052235,-118.243683,0
34.052500,-118.244000,0.034
34.052800,-118.244300,0.037
```
At first blush that doesn’t look bad, though it certainly needs a close review, testing, and probably some tweaking.
 
  • Helpful
Likes: jssailem

ShawnL

.
Jul 29, 2020
152
Catalina 22 3603 Calumet Mi
You should also be able to import it into Google Earth, though I don't know if it will do all of the calculations you want.
 

JBP-PA

.
Apr 29, 2022
616
Jeanneau Tonic 23 Erie, PA
I can write the code to analyze it, but I would have thought it was a pretty common thing so there would already be software out there to do it. I can map it, but that doesn't give me much info, just a billion points.
Screenshot 2024-09-16 10.06.21.png