EarthTools Webservices has three services - sunrise/sunset times, timezone and local time, and elevation. This example shows how to use sunrise/sunset service.

The overall work flow is the same as in most web services, but here we show one particular transformer that may be required for complying with some web services restrictions. EarthTools service requires that a client sends no more than one request per second. FME is capable to send more requests in one second - I tested how fast we can send requests to Yahoo GeoPlanet and get something back - and this of course, depends on the service, not on FME. With the Creator, I made 10,000 features with an attribute containing url, and submitted them to the service. The result was 3 features per second. 140 features (1.4%) returned an error code.

Locally, I was able to send and get response with average rate of 8.5 features per second (with Windows IIS). FME is smart enough not to send anything to the service, if nothing is connected to HTTPFetcher (otherwise I would be banned from a few sites after my experiments).

So, sometimes we have to force FME to be slower. For this purpose we created a Decelerator transformer, the role of which is to "push the brake pedal", that is, to tell FME how fast (or slow) it can release the features to the next transformer that makes the request to a service.

User-added image

There are two methods of slowing down - per feature (how long should it take to send a feature), or per second (how many features can be sent per second).

Sometimes, the service may have no restrictions on the number of requests per second, but still be unable to handle them with the speed the users send their requests (as in the example above with Yahoo GeoPlanet). Use Tester to check the status code on features, and if you see failures every few features, the service may be too slow. This is another case when Decelerator is a useful tool. Experiment with the parameters to find an optimal combination between the speed of the translation and the number of successful requests.

To see Decelerator at work, check the following example - SunriseSunset.zip (See attachment: SunriseSunset.zip) contains the workspace and dataset. SunriseSunsetExtractor.fmx (See attachment: SunriseSunsetExtractor.fmx) is a separate custom transformer.

Note that the EarthTools service has two more usage restrictions, please make sure you follow them when using this example