1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "forward",
12 "query": "Eiffel Tower, Paris, France",
13 "street": "5th Avenue",
14 "city": "New York",
15 "state": "New York",
16 "country": "United States",
17 "postalcode": "10001",
18 "limit": 5,
19 "latitude": 48.8584,
20 "longitude": 2.2945,
21 "zoom": 18,
22 "osmIds": "5013364",
23 "osmType": "W",
24 "addresses": [
25 "Times Square, New York, USA",
26 "Big Ben, London, UK",
27 "Colosseum, Rome, Italy"
28 ],
29 "coordinates": [
30 {
31 "lat": 40.758,
32 "lon": -73.9855
33 },
34 {
35 "lat": 51.5007,
36 "lon": -0.1246
37 },
38 {
39 "lat": 41.8902,
40 "lon": 12.4922
41 }
42 ]
43};
44
45
46const run = await client.actor("agenscrape/openstreetmap-address-geocoder").call(input);
47
48
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53 console.dir(item);
54});
55
56