I have a leaflet map on a html page I use to show certain geopositioned assets from my database.

One of the features uses nominatim reverse query for certain user actions. The actions that end in nominatim query are less than one per second, even less than one per minute.

It works perfectly when run on my localhost, and when run from a test server. But when I put my page on my sharepoint server all the nominatim queries end with a 429 Too Many Requests response.

The requests come from jQuery code executed on the browser, either firefox or chrome.

For simplifying and making the point, let's say that the code is run in a click handler of the map

  map.on('click', e=> {
    let popup = L.popup();
    popup
      .setLatLng(e.latlng)
      .setContent(`[${e.latlng.lat.toFixed(5)},${e.latlng.lng.toFixed(5)}]`)
      .openOn(map);
    reverseGeocode(e.latlng, res => {
      popup.setContent(`[${e.latlng.lat.toFixed(5)},${e.latlng.lng.toFixed(5)}]<br>${res.display_name}`);
     });
});

and the reverse geocoding function just invokes the url with a jsonp wrap

function reverseGeocode(latlng,callback) {
    let url=`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${latlng.lat}&lon=${latlng.lng}`;
    $.ajax({ url, 
      dataType:"jsonp",
      jsonp: "json_callback",
      success: callback
    });
  }
};

This code is in the page, and the page is in a private document library in my private sharepoint site hosted by microsoft office365 and accessed as xxxxxx.sharepoint.com

What can I do to solve this limitation?

asked 18 Dec '17, 10:19

P%20A's gravatar image

P A
26113
accept rate: 0%

edited 18 Dec '17, 12:23

So the Nominatim queries always originate from the user and not from the server?

(18 Dec '17, 11:35) scai ♦

I have updated my question with more information on the code

(18 Dec '17, 12:23) P A

In contrast to Firefox and Chrome, your sharepoint server likely does not send a HTTP referrer or user agent as requested by Nominatim's usage policy. You will need to consult the sharepoint documentation and/or contact your hoster to find out how to change that. Once a proper referrer/user agent is set, the error will go away.

permanent link

answered 03 Jan '18, 11:58

lonvia's gravatar image

lonvia
5.7k25381
accept rate: 41%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×616
×3

question asked: 18 Dec '17, 10:19

question was seen: 2,112 times

last updated: 03 Jan '18, 11:58

powered by OSQA