1

Re: GridMapRequest performance

I'm building species account pages which need to show a distribution map for the UK as well as at a vice county level. Using the GridMapRequest via a soap call from PHP, it is taking about 5-6 seconds for each service call to respond. This means 10+ seconds are being added to the page load times.

Is this the usual sort of performance I should expect or is there a faster method of getting the maps?

John van Breda
Biodiverse IT

2

Re: GridMapRequest performance

The performance of GridMapRequest is dependant on the number of datasets used, the area queried, any date banding requested, and the amount of data the NBN Gateway holds for the species. 6-8 seconds is the top end for extremely well recorded species over many datasets.

We are reviewing the whole mapping area after the 3.5 release.

Can you please contact me by email with a couple of sample requests and I can see if there is anything we can do to help?

Paul Gilbertson,
NBN Gateway Developer

3

Re: GridMapRequest performance

Hi Paul
Here's the array I am sending to a GetGridMap soap call:

Array
(
    [GridMapRequest] => Array
        (
            [TaxonVersionKey] => NBNSYS0000005060
            [Resolution] => _10km
            [GridMapSettings] => Array
                (
                    [Width] => 340
                    [Height] => 478
                )

        )

)

This example takes about 4-5 seconds from my machine, and 5-6 seconds from a hosted server though that extra second is presumably nothing to do with the Gateway. Thanks for looking at it.

John van Breda
Biodiverse IT

4

Re: GridMapRequest performance

In case anyone is interested, the solution I have adopted is to cache the image file locally and only update if the image file is greater than a certain age. Another approach could be using iframes based on the EasyMaps idea by Jim Bacon which means the main page content would load before the webservice calls.

John van Breda
Biodiverse IT

5

Re: GridMapRequest performance

Just in case it helps someone....

In my dabblings with web-services I have used AJAX calls to selectively modify parts of the web-page after loading. Using selectors on the web-page users can request different info from the gateway via an XMLHttpRequest, after which various "div"s are re-written using the data returned.  I've only used the synchronous form of XMLHttpRequest so far (below), but truly background requests should be possible by selecting asynchronous operation. The web-page is only loaded just the once.

If it helps anyone to get started, this is the key AJAX bit. The url is the address of the php containing the request, which in turn uses soap...

function loadXMLDoc(url)
  {
    if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
        xmlhttp.open("GET",url,false);
        xmlhttp.send(null);
        }
    else
        {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.open("GET",url,false);
        xmlhttp.send(); // Do not send null for ActiveX
        }
    return xmlhttp.responseXML;
    }

It doesn't help with gateway response time of course, but at least the user has the rest of the web-page to read while waiting.

Regards, Keith

6

Re: GridMapRequest performance

Thanks Keith. I guess the next trick is getting the format of the request right. In my own dabblings I had thought about this using jQuery's AJAX methods before I settled on the caching idea.

Best Wishes

John van Breda
Biodiverse IT