Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project still alife and supported? & Firsttime run issue 'vwi_waypoints_generator.py' script #6

Open
FestinaLenteNL opened this issue Oct 22, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@FestinaLenteNL
Copy link

FestinaLenteNL commented Oct 22, 2024

Hi,
for boat owners and OpenCPN users this project is a great find.

Marcel are you still supporting this project?
If yes: I have an issue with first run of the 'vwi_waypoints_generator.py' script in a fresh install of OpenCPN 5.10.2 installed on Raspberry using the OpenPlotter provided image (openmarine.org).

I assume the script performs a file check to a non existing file or something like that. My programming skills are to limited to adjust this. (below I used the -force option though there is no difference not using this option)
>>>>>>>>>>>start>>>>>>>>>
pi@openplotter:~/Documents/Test $ python3 vwi_waypoints_generator.py -force
Latest geoinfomation: {
"GeoType": "geogeneration",
"GeoGeneration": 3408,
"PublicationDate": "2024-10-21T14:24:07.575Z",
"Active": true
}
Traceback (most recent call last):
File "/home/pi/Documents/Test/vwi_waypoints_generator.py", line 431, in
if readJson(last_publication_filename).get('GeoGeneration') == geoInfo.get('GeoGeneration'):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/Documents/Test/vwi_waypoints_generator.py", line 400, in readJson
with open(filename) as f:
^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'lastPublication.json'

<<<<<<<<<<end<<<<<<<<<<<<<

@FestinaLenteNL FestinaLenteNL changed the title Project still alife and supported? & First run issue Project still alife and supported? & Firsttime run issue 'vwi_waypoints_generator.py' script Oct 22, 2024
@marcelrv
Copy link
Owner

I can't check right now, but the error is about missing lastPublication.json file.
Don't know why it is missing, but possibly download it from the GitHub or create the file and paste { "GeoType": "geogeneration", "GeoGeneration": 3408, "PublicationDate": "2024-10-21T14:24:07.575Z", "Active": true }

In it

@FestinaLenteNL
Copy link
Author

Hi Marcel and all followers,
It's now working.

What I did so others can benefit from it:
I'm running OpenCPN on a Raspberry Model 4b (8GB RAM and 32GB SD) that is loaded with the OpenPlotter image (see openmarine.net for more info on that topic when you interested). As I have my Raspberry mounted to a 7"touchscreen DSI screen I used the image 'OpenPlotter Touchscreen'
This image gives me a a clean OpenCPN 5.10.2 installation.

The required python3 module is not present in this OpenPlotter image so I had to install that using the command 'sudo apt install python3-gpxpy' in the CLI command screen. Which can be opened via the shortcut 'LXTerminal' from the menu for those not familiar with command line and so on.

To test this script I first created a directory 'Test' in the './Documents' directory to see what would happen and not created all kind of directories and files throughout my working OpenCPN application (command: 'mkdir Test').

In that directory I had to copy the files 'vwi_waypoints_generator.py' and 'lastPublication.json' It turned out I also had to create a sub-directory './working' in the './Test' directory.

Now I can run the command 'python3 vwi_waypoints_generator.py' having the './Test' directory as my active directory.
A download will start filling up files with downloaded data to the working directory followed by processing the downloaded data into GPX files stored in the current './Test' directory.
All off this took about 4 minutes and created: 12 files, about 25MB in the ./Test/working directory and 30 GPX files, 14MB in the ./Test directory.
The downloading was done using my onboard Huawei MIFI 4G router and took estimated 50% of the total time.

The next step would be to import the GPX of your choise and needs in OpenCPN

My next actions is to make up my mind whether:

  • I can modify the script in such a way that only the GPX files are created in which I'm interested.
  • I can add some lines to cleanup the contents of the working directory after completing the GPX files and if that is usefull
  • I can find a way to import GPX files into OpenCPN automatically after these have been updated via this script and decide if this is desired or that some human interaction in this makes sense.

Have fun!

@marcelrv
Copy link
Owner

Happy that it works for you.

Based on your notes, I guess you copied the specific python files, rather than cloning the whole project (as in that case the working directory & lastPublication.json should have been already available for you.

If you want to limit the files created, you can play around e.g. with editing this section:
https://github.com/marcelrv/OpenCPN-Waypoints/blob/main/vwi_waypoints_generator.py#L479-L485
and below that line you see sections for each of the types, you can simply disable the section you are not interested in.

Note: I don't cleanup the working directory as some of the files may not be updated, and it would require you to download these files each time again. So the script first checks how old are the files and creates newer files only when required.

Wrt automaticllty updating in OpenCPN, I found no great way.
but.. If I recall right, you can override the gpx file and it will automatically pick up the new waypoints when OpenCPN is restarted.

@marcelrv marcelrv added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants