Batch geocoding in one request?

  • I have a list of addresses that I want to geocode. Is there a way to geocode multiple addresses in a single API request? I didn't find anything in the documentation.

  • That is absoluetly a feature that we plan on adding soon, but unfortunately for now API.Wikiocity doesn't support batch geocoding directly. You'll need to send separate requests for each address. However, you can use asynchronous requests to improve the performance and reduce the overall processing time.

    In JavaScript, you can use Promise.all() to send multiple geocoding requests concurrently:

    const addresses = ['address1', 'address2', 'address3'];

    const apiKey = 'your_api_key';

    Promise.all(

    addresses.map(address =>

    fetch(`https://api.wikiocity.com/r/search?key=${apiKey}&country=us&search=${encodeURIComponent(address)}`)

    .then(response => response.json()) ) )

    .then(results => {

    console.log(results);

    });

Register or Login to Post