"Close to an Ocean" seems to be misleading as to what it actually means. Enemy spawns will count as in the Ocean only if the player is in an area which counts as an Ocean biome. You will only get the Pirate Map from enemies when you are in the Ocean biome.
The wiki does not state the Pirate Map as a drop from enemies in any biome except the Ocean. Therefore when it said "close to an Ocean" it most likely meant close to the Ocean itself, ie your character is not in the Ocean's water, but is still counted as being in the Ocean biome.
From the wiki page on biomes, to be counted by the game as in the Ocean biome, the following must be present within 50 tiles on either side and 42 below and 44 above your character:
The discussion of the area used for counting required blocks for the existence of biomes at a location appears to be 50 tiles to each side and approximately 42 below and 44 above.
At least 1,000 block spaces of water
[Location: ] Outer lateral edges of the world, above Cavern layer
"Outer lateral edges" are defined as the following, from the wiki page on the Ocean biome:
[T]he eastern 500ft (250 blocks) and the western 500ft for large maps (needs verification) and 676ft (338 blocks) for medium maps.
When these criteria are fulfilled, enemy spawns will be counted as in the ocean, and they will have the ability to drop the Pirate Map.