1

GeoServer will throw an error (parserError Error: getJson was not called) for cca 8 out of 14 AJAX requests if I use AJAX in for loop. I have to call AJAX with 500ms interval - then it works without errors. My problematic AJAX:

for (var i = 1; i <= 14; i++) {
      $.ajax({
        url: url,
        dataType: 'jsonp',
        jsonpCallback: 'getJson',
        success: function(result) {
            console.log(result)
        }

    });
}

When I use Python I get all responses right:

import requests
i = 1
while i <= 14:
    r = requests.get("http://localhost:8080/geoserver/d99/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=d99:day_time_" + str(i) + "&sortBy=time&outputFormat=text/javascript&format_options=callback:getJson")
    i += 1
    print(r.text)

I run GeoServer on my notebook (localhost) and GeoServer is not installed as service (I run it manually). Does GeoServer have any limit for WFS requests per second?

1
  • 1
    How does it behave with the default GML output format?
    – user30184
    Feb 27 '17 at 7:19
2

GeoServer out of the box does not have a request rate limit, but with the "control-flow" module it can be configured to have one.

If it is, you'll get headers in the response telling you how many requests you're still allowed to issue in the reference unit of time:

http://docs.geoserver.org/stable/en/user/extensions/controlflow/#per-user-rate-control

1
  • OK, I have no request rate limit. No idea why GeoServer cannot handle multiple request at the same time then.
    – Jihlavanka
    Feb 27 '17 at 11:35
0

I had to use the callback function inside WFS request to handle the JSONP response because (for some reason?) the AJAX alone (success / complete options) could not handle it.

function addData(data) {
     console.log(data)
    }

url1 = "http://localhost:8080/geoserver/d2/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=d2:den_1&sortBy=usek&outputFormat=text/javascript&format_options=callback:addData"

for (var i = 1; i <= 14; i++) {
        $.ajax({
            url: url1,
            dataType: 'jsonp'
        });
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.