Search code examples
openstreetmapoverpass-apixapiopenseamap

How to fetch seamarks with Overpass API?


I have currently managed to fetch seamarks:type=harbours with XAPI but I found out that XAPI is outdated now and it is better to use Overpass API.

My problem is I have no idea how to convert my search from XAPI to Overpass API.

This is my XAPI search:

http://www.overpass-api.de/api/xapi?node[seamark%3Atype=harbour][bbox=4.04297,51.63984,5.09216,51.87106]

This is the Overpass API request I have tried and it does not work. Nothing is received back. No exceptions are shown:

   [out:json][timeout:25];
(
  node["seamark:type=harbour"](4.04297,51.63984,5.09216,51.87106);
 
);

out body;
>;
out skel qt;

Could you help me out with what is my issue here?

Thanks in advance.


Solution

  • Your bounding box is wrong. XAPI uses minlon,minlat,maxlon,maxlat while Overpass API uses minlat,minlon,maxlat,maxlon.

    Try this query instead: https://overpass-turbo.eu/s/14R8

    [out:json][timeout:25];
    (
      node["seamark:type=harbour"](4.04297,51.63984,5.09216,51.87106);
    );
    
    out body;
    >;
    out skel qt;