Second, the algorithm that included the ships needed to be improved, because the simple algorithm included the ships that were in the port, not their arrival per se. Thus, the ships that arrived a few days earlier, but which remained several days, were also counted these other days. In addition, the noisy nature of the AIS data led some ships to appear in port for a message, even if they were not really present. This noise also caused messages from ships to appear in the ports, just outside the port, and then again. To manage the noise in the data, which led to the location of the ship for an error far from its actual location, a filtering method was applied to latitude and longitude. Using an average 10-minute filter would not solve the problem, as noise points are far from actual sites and still lead to remote sites. As a result, a median filter was used for 10 minutes. Instead of simply checking that there was a ship in the port, the algorithm included the ships coming into the port. By dividing the ship`s route into locations outside the port (sea) and inside the port (port). The place where the place passed from the sea to the port was counted as the entrance. github.com/mputs/WP4/tree/master/Portvisit In its coastal sea, the coastal state may enact laws and regulations relating to innocent crossings (Article 21, paragraph 1), including: (a) maritime safety and the regulation of maritime traffic; … (f) the preservation of the coastal state`s environment and the prevention, reduction and control of its pollution.» These laws and regulations must comply with the provisions of the Convention and «other rules of international law.» The adoption of the aforementioned IMO conventions and their inclusion in national legislation, which follows, allow coastal states to force foreign vessels that innocently transit their seas through their seas to comply with the rules of these conventions, even if the flag state is not a party to the instrument concerned.

The agreement on port state measures to prevent, combat and eliminate illegal, unreported and unregulated fishing is a 2009 Food and Agriculture Organization (FAO) international treaty aimed at preventing and eradicating illegal, unreported and unregulated fishing.