marcelrv / OpenCPN-Waypoints

GPX Files for OpenCPN
GNU Affero General Public License v3.0
6 stars 1 forks source link

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

Open FestinaLenteNL opened 3 days ago

FestinaLenteNL commented 3 days ago

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_waypointsgenerator.py", line 400, in readJson with open(filename) as f: ^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'lastPublication.json'

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

marcelrv commented 2 days ago

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 commented 2 days ago

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:

Have fun!

marcelrv commented 1 day ago

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.