Using Overpass API Mirrors, CORS Errors and adding a loading message Using Overpass API Mirrors, CORS Errors and adding a loading message

January 19, 2022

laravel openstreetmap

I was investigating adding a loading block to the website and posted a number of messages like this online forum.openstreetmap.org/viewtopic.php?id=74656 where i wrote:

I am looking for help adding a loading message as the overpass API data takes a good few seconds to load. Basically, I am looking to add a box to the map that says loading data, refering to the load of the results from the /api/interpreter which you can see in the browser dev tools.

eg

Loading data ......
26kb received

OR 

Error - 426 - Server too busy - please try again

I am not sure if at the start of the page load, there is an idea to how much data will come in, The data seems to come in 'waves', but also errors if there is too many requests, I want to be able to display this as a layer in the map, and for it to reappear when the page is moved.

One of the replies pointed me to this list of mirrors of the data https://wiki.openstreetmap.org/wiki/Overpass_API#Public_Overpass_API_instances

Trying out the api from https://kumi.systems/ I got a CORS error, which complains about a Cross-Origin Request, so i added this php at the start to fix that.

<?php
    header('Access-Control-Allow-Origin: https://overpass.kumi.systems/');
?>

Have been in contact with the team at Kumi Systems and hope to find a solution to the loading issue and see if there API mirror is any faster.

Another reply suggested hosting your own overpass api, which is installed like so, https://wiki.openstreetmap.org/wiki/Overpass_API/Installation I may look at this solution in the future....


If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon