Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-01-2022, 08:48   #1
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Housekeeping waypoints and routes

Your OpenCPN probably includes your waypoints and routes.
From my experience, these are not always what they seem.

I have developed a script Housekeeper for the JavaSCript plugin that examines your waypoints and routes and reports on what it finds.
Further, it offers to fix any issues it finds.

If you run a very clean and tight ship, it may find nothing - as was the case when Mike (Rasbats) tested an early version for me.
In my case it found 173 issues. Clearly my use is messier than Mike's

In what follows I use the term waypoint (WP) to refer to a free-standing waypoint which is included in the Waypoints tab of the Route & mark manager.
A waypoint may be used in any number of routes or none at all.
I use the term routepoint (RP) to refer to a point in a route which is not a waypoint.
Routepoints exist only in routes and when a route is deleted, its routepoints are also deleted unless the are in use by another route. Routepoints are not listed in the Route & mark manager. By default, routepoints are given mark names 001, 002, 003 etc. although you can rename them to anything you wish.
I will use the term point when this may be a waypoint or routepoint.

When Housekeeper is run, it first looks for and details:

(1) Waypoints and routes with no name
It offers to give them default names so you can distinguish between them.
(2) Waypoints and routes with duplicate names
It offers to make them unique by appending suffixes.
(3) Waypoints not used in any route and with a mark name like 001, 002.
These are likely routepoints that have been removed from a route. OpenCPN converts these into waypoints. Housekeeper offers to delete them.
(4) One-legged routes with names starting with Goto...
These are left over from when you activated a Goto which was not a route.
Housekeeper can delete these.
(5) Routes with repeated legs, such as Mark A; Mark B; Mark B; Mark C
Yes this can happen - it found one in my routes. Housekeeper can remove senseless legs.

Housekeeper then looks for multiple points at the same location. You may find, like me, you have more of these than you realise.

When I started to use OpenCPN, I transferred my extensive library of waypoints and routes from my previous application MacENC.
I exported my waypoints into GPX files and imported some of them into OpenCPN.
I then exported my routes and loaded some of these too.
I expected OpenCPN to create the routes by linking up my waypoints.
OpenCPN does not work like that. For each route imported, it creates routepoints for each leg.
This was not apparent at first because the waypoint and routepoints exactly overlay each other. But when I move one of these points it may reveal the other co-located points left behind.

I will illustrate this with what Housekeeper displayed for my point UK-S:P-ENT marking the entrance to my home port Poole Harbour.

Code:
At 50 40.860'N 001 56.840'W
 1 WP UK-S:P-ENT  432f3..acb36  leg 8  in Warbarrow Trout to Poole
 2 RP UK-S:P-ENT  4759a..9f80c  leg 8  in UK-S:Salcome-PooleO
 3 RP UK-S:P-ENT  1de5e..b3ff5  leg 9  in UK-S:Lyme Regis-Poole (O)
 4 RP UK-S:P-ENT  72f3f..06530  leg 9  in UK-S:West Bay - Poole (O)
 5 RP UK-S:P-ENT  18864..c1048  leg 18 in Christchurch S C to Frome mooring
                    shared with leg 0  in UK-S:Brownsea to Frome mooring
 6 RP UK-S:P-ENT  37f87..d122c  leg 0  in UK-S:Poole-Yealm
 7 RP UK-S:P-ENT  210f0..4f769  leg 7  in UK-S:Weymouth - Poole I
 8 RP UK-S:P-ENT  085c2..10576  leg 0  in UK-S:Poole-Weymouth O
 9 RP UK-S:P-ENT  63c04..103b3  leg 0  in Poole-Lulworth (I)
10 RP UK-S:P-ENT  5a9f6..d5414  leg 8  in UK-S:Dart-PooleO
11 RP UK-S:P-ENT  7bc24..2a635  leg 0  in UK-S:Poole-Lulworth O
The first point is the original waypoint I imported.
2-11 are extra routepoints created by OpenCPN when I imported my routes, as evidenced by the different (abbreviated) GUIDs.

This season I created two new routes.
For the route Warbarrow Trout to Poole, I chose to use the nearby waypoint for the entrance to the harbour.
For Christchurch SC to Frome mooring I also chose to use the nearby mark offered - but I now see that was not the waypoint but the routepoint of the same name in the route UK-S:Brownsea to Frome mooring.

In my opinion, having multiple marks overlaying each other is bad practice and even dangerous. Suppose the entrance moves or an obstruction is discovered and a mark has to be repositioned. In the above case, I would have to move all 11 marks. Routes hidden at the time would likely be missed and I might end up sailing them later believing the mark had been moved when it had not been.

For the example above, Housekeeper determines that the first mark is the true waypoint and offers to use it to replace the routemarks in the 11 routes not using it. I now have a single waypoint shared by the 12 routes.

Fuller details of what Housekeeper does are available in its description here.

I will be interested to learn if others discover things about their waypoints and routes they were unaware of.
Antipole is offline   Reply With Quote
Old 11-01-2022, 09:29   #2
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
PS Hint for those not familiar with the JavaScript plugin

If you are not familiar with the JavaScript plugin, you need to
  1. Install the plugin from through this page
  2. Download the Housekeeper script from here
  3. Load the script into the script window
  4. Use the Run button to run the script
Antipole is offline   Reply With Quote
Old 12-01-2022, 13:50   #3
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Housekeeper updated to v1.1

Script was leaving removed unused routepoints in OpenCPN. Now fixed.
Also had wrong default separation of nearby points.

If you downloaded previous version, please update.
Antipole is offline   Reply With Quote
Old 13-01-2022, 07:30   #4
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Housekeeping script updated to v1.2

Successive repeating routepoints in a route now identified by separation being less than the nearby distance rather than by GUID.
Thus it identifies different consecutive points at same location.

Resolving this before analysing for co-located points avoids these points being matched at that stage.

Please re-download script from here.
Antipole is offline   Reply With Quote
Old 13-01-2022, 08:24   #5
Registered User

Join Date: Nov 2012
Location: Steinhatchee, FL
Posts: 316
Re: Housekeeping waypoints and routes

This looks like a very useful tool. I look forward to trying it. Thank you for sharing it.
Be Free is offline   Reply With Quote
Old 24-01-2022, 02:49   #6
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,509
Re: Housekeeping waypoints and routes

@Antipole
Thank you for your JavaScript plugin and especially the Housekeeper script. I have always looked for a better solution to handle the navobj files of OCPN.
So I used your sources for my own OCPN version.
Can you please configure your git not to upload the macOS files called ".DS_Store" ? Git knows about a config file called ".gitignore_global" where you can enter a line with ".DS_Store". The ".DS_Store" files are only useful for the macOS operating system, nothing else.
CarCode is offline   Reply With Quote
Old 24-01-2022, 03:13   #7
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by CarCode View Post
Can you please configure your git not to upload the macOS files called ".DS_Store" ?
I am keeping these shared scripts in a git repository so I can update them and keep track of changes, so do not want to remove the . files used to manage this.

When you want to use a script, use the copy button, which will copy the plain text, which you can then paste into the script window.
Antipole is offline   Reply With Quote
Old 24-01-2022, 11:11   #8
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,509
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by Antipole View Post
I am keeping these shared scripts in a git repository so I can update them and keep track of changes, so do not want to remove the . files used to manage this.

When you want to use a script, use the copy button, which will copy the plain text, which you can then paste into the script window.
I don't talk about the scripts but about the source files. ".DS_Store" are not needed. You may read about these files here:
https://eclecticlight.co/2021/11/27/...s_store-files/
Any developer hates them.
CarCode is offline   Reply With Quote
Old 10-02-2022, 09:37   #9
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Housekeeping script updated to v1.4

I have discovered numerous waypoints with no icon assigned.
Perhaps they were imported with no icon given.
OpenCPN displays them with a circle, so it is not obvious.
However, this can cause problems with any procedure that references the icon.

Housekeeper v1.4 now spots points with no icon name and offers to add one - Circle by default but this can be configured.

There are also many small improvements.
The order in which the various issues are addressed has been changed so that things are fixed before later steps that depend on them.

If you are using this script, you should re-download it.
Antipole is offline   Reply With Quote
Old 12-02-2022, 10:51   #10
Registered User
 
Ivanm's Avatar

Join Date: Jan 2015
Posts: 264
Re: Housekeeping waypoints and routes

Hi Antipole

Can the Javascript be "tweeked" that only waypoits between certain latitudes be exported and saved in separate Layers? Also the paths made by Draw , I have quite a few waypoints and paths and I find that not so much the waypoints but the Draw paths especially slow things down on OpenCpn. If I could split this layer of Draw paths into areas I think it would help allot as I can make visible only the area I'm working in.

On Olex plotter one can select a area and export only the Marks and Waypoints in the area selected.

Ivan
Ivanm is offline   Reply With Quote
Old 13-02-2022, 06:15   #11
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by Ivanm View Post
Hi Antipole
Can the Javascript be "tweeked" that only waypoits between certain latitudes be exported and saved in separate Layers? Also the paths made by Draw , I have quite a few waypoints and paths and I find that not so much the waypoints but the Draw paths especially slow things down on OpenCpn. If I could split this layer of Draw paths into areas I think it would help allot as I can make visible only the area I'm working in.
Ivan
You could set the waypoint visibility by location. For example, you could stop displaying those outside your area of interest. Or you could select by location and make just those visible the export that selection and move them to a layer.

In the shared scripts library is SetWaypointScale.js, which sets the display scale according to the icon name
Code:
guids = OCPNgetWaypointGUIDs();
for (w = 0; w < guids.length; w++){	// for each waypoint
	waypoint = OCPNgetSingleWaypoint(guids[w]);
	if (!waypoint.isFreeStanding) continue;	// ignore routepoints
	if (waypoint.iconName == "cicle") waypoint.useMinScale = false;
	else {
		waypoint.useMinScale = true;
		waypoint.minScale = 52000;
		}
	OCPNupdateSingleWaypoint(waypoint);
	}
You could adopt this to select waypoints by location and then set, say, the visibility with the
waypoint.isVisible attribute. See the user guide for details.

You would need to define your area with, say,
Code:
latN = 60; latS = 50;
lonW = -6; lonE = 2;
and then test whether each waypoint is inside the area.

To make it more automatic, you could create two special waypoints at the top left and bottom right corners of your area. You can then read them by their GUIDs to extract your boundaries and then loop through to process those inside or outside your area. This way you could just drag the corner waypoints to set a new area and re-run the script.

Regarding OpenDraw, in theory it should be possible to access this since the JavaScript plugin can read and write JSON messages. However, it needs some pioneering work to make use realistic. I am looking into this but doubt that I will have enough time before next (northern) winter as I will be away cruising during the up-coming sailing season.
Antipole is offline   Reply With Quote
Old 13-02-2022, 11:15   #12
Registered User
 
Ivanm's Avatar

Join Date: Jan 2015
Posts: 264
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by Antipole View Post
You could set the waypoint visibility by location. For example, you could stop displaying those outside your area of interest. Or you could select by location and make just those visible the export that selection and move them to a layer.



In the shared scripts library is SetWaypointScale.js, which sets the display scale according to the icon name

Code:
guids = OCPNgetWaypointGUIDs();

for (w = 0; w &lt; guids.length; w++){// for each waypoint

waypoint = OCPNgetSingleWaypoint(guids[w]);

if (!waypoint.isFreeStanding) continue;// ignore routepoints

if (waypoint.iconName == "cicle") waypoint.useMinScale = false;

else {

waypoint.useMinScale = true;

waypoint.minScale = 52000;

}

OCPNupdateSingleWaypoint(waypoint);

}


You could adopt this to select waypoints by location and then set, say, the visibility with the

waypoint.isVisible attribute. See the user guide for details.



You would need to define your area with, say,

Code:
latN = 60; latS = 50;

lonW = -6; lonE = 2;
and then test whether each waypoint is inside the area.



To make it more automatic, you could create two special waypoints at the top left and bottom right corners of your area. You can then read them by their GUIDs to extract your boundaries and then loop through to process those inside or outside your area. This way you could just drag the corner waypoints to set a new area and re-run the script.



Regarding OpenDraw, in theory it should be possible to access this since the JavaScript plugin can read and write JSON messages. However, it needs some pioneering work to make use realistic. I am looking into this but doubt that I will have enough time before next (northern) winter as I will be away cruising during the up-coming sailing season.
Thanks for reply , only problem is I understand what you mean but to do this I don't now how , I am willing to learn but at moment don't now how to do this.

Ivan
Ivanm is offline   Reply With Quote
Old 14-02-2022, 00:50   #13
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by Ivanm View Post
Thanks for reply , only problem is I understand what you mean but to do this I don't now how , I am willing to learn but at moment don't now how to do this.
Ivan
I have created a script for you and put it in the shared scripts library here.

Create two waypoints with the exact names 'TopLeft' and 'BottomRight' and place BottomRight southeast of TopLeft.

Now run the script. After checks, it will set as visible all waypoints within the selected rectangle and will hide all others.

You can drag the corner markers where you will and run the script again.

Have a look at how the script works. You can then modify it to your needs.

If you want to discuss further, please start a separate thread as this one is supposed to be about the Housekeeper script.
Antipole is offline   Reply With Quote
Old 16-02-2022, 06:15   #14
Registered User
 
Ivanm's Avatar

Join Date: Jan 2015
Posts: 264
Re: Housekeeping waypoints and routes

When I run the HouseKeeper script sometime it show.... duplicate guids I restarted but still the same how else can fix duplicate guids
Ivanm is offline   Reply With Quote
Old 16-02-2022, 10:00   #15
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 213
Re: Housekeeping waypoints and routes

Quote:
Originally Posted by Ivanm View Post
When I run the HouseKeeper script sometime it show.... duplicate guids I restarted but still the same how else can fix duplicate guids
I have noted this as an OpenCPN issue which may not have previously been recognised. I have reported it on FlySpray.

I have updated the HouseKeeper script to include an option to ignore the duplicates. The error message now points you to that setting. You will need to re-download it, of course.

Whilst at it, I have arranged that extra time is allocated according to the number of GUIDs. That should help with you time-outs.
Antipole is offline   Reply With Quote
Reply

Tags
route

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Housekeeping contribution cruising in Japan Isabella Jane Provisioning: Food & Drink 15 10-01-2018 06:21
Fall Housekeeping JanetGroene Liveaboard's Forum 3 07-07-2016 05:45
Sync Waypoints, Routes and Tracks with Dropbox timohara OpenCPN 2 21-10-2013 17:55
Garmin and Uploading Waypoints / Routes unbusted67 Marine Electronics 5 04-05-2011 11:35
Housekeeping Pads or Chainplate Islands GordMay Deck hardware: Rigging, Sails & Hoisting 1 18-02-2009 15:29

Advertise Here


All times are GMT -7. The time now is 11:22.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2023, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2023, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.