fix #2430: waypoints not loaded from website

A recent fix for #2341 broke the fresh store of waypoints. Comparing
with "< 0" to check if a waypoint id is invalid implies setting the
uninitialized value to a negative number.
The waypoint id must be kept when merging data

If we want to keep the id stable, then it must be copied over.
Part of fix for #2430.
Do not use a N² algorithm when merging waypoints sets

The prefix of a waypoint must be unique for a given cache, so use that
instead of the name for merging (the name needs not be unique).

Also, it won't break if we have duplicate prefixes in the old waypoints
list, those will be kept as well in the new list.