Compare Addresses avatar

Compare Addresses

Try for free

No credit card required

Go to Store
Compare Addresses

Compare Addresses

marco.gullo/compare-addresses
Try for free

No credit card required

Matches addresses in different formats, using geocoding. It fetches geocodes from Google Map, compares them, and returns the matching addresses, within some threshold.

A utility Actor to compare and match locations' addresses.

Reason

When scraping places (apartments, hotels, restaurants...) from several platforms, such as Google, Facebook, and TripAdvisor, they can have different formats.

This Actor's purpose is to match different addresses which are actually the same, e.g.,

Vodičkova 704/36, 110 00 Nové Město

and

Praha, Vodičkova, 704/36, 110 00

How it works

It uses geocoding, i.e., it transform the addresses into geographical coordinates, and compute the distances among addresses using the Haversine formula.

Sequently, it selects the closest addresses and matches them. First, it selects the addresses that match exactly, having the same latitude and longitude. Then, it uses a Linear Programming solver to select the best couples of addresses that minimize the total distance.

Input

You will have to enter the addresses in the two groups.

You can also specify the coordinates for all the addresses you know in advance, otherwise they will be determined using Google Maps.

Finally, you can specify the maximum distance that two addresses can have to match. It can be useful to allow for some tolerance and not take exact matches only, especially if you provide coordinates in input from different providers, which will likely differ slightly.

Here is an input sample:

1{
2	"group1": [
3        {
4            "key": "4 St Pappin Rd, Glasnevin, Dublin, D11 ND70, Ireland",
5            "value": "53.385766,-6.2659933" // the coordinates for this address are known in advance
6        },
7        {
8            "key": "93 95 Emmet Rd, Inchicore, Dublin 8, D08 P1H1, Ireland",
9            "value": "53.3405958,-6.3141984"
10        },
11        {
12            "key": "Malpas Court, Clanbrassil Street Lower, Dublin, D08 HN76, Ireland",
13            "value": "53.3344092,-6.2745379"
14        }
15    ],
16    "group2": [
17        {
18            "key": "201 Emmet Road, Inchicore, Dublin, Ireland",
19            "value": "" // these coordinates will be determined using Google Maps
20        },
21        {
22            "key": "Main Street, Gorteendrunagh, Castlebar, Castlebar, Ireland",
23            "value": ""
24        },
25        {
26            "key": "93-95 Emmet road, Dublin, Ireland",
27            "value": ""
28        }
29    ],
30	"toleranceInMeters": 25
31}

Output

Here is an output sample:

1[
2    {
3        "address1": "93 95 Emmet Rd, Inchicore, Dublin 8, D08 P1H1, Ireland",
4        "address2": "93-95 Emmet road, Dublin, Ireland",
5        "location1": {
6            "lat": 53.3405958,
7            "lng": -6.3141984
8        },
9        "location2": {
10            "lat": 53.3405969,
11            "lng": -6.3140013
12        },
13        "distanceInMeters": 13.085981314251544
14    }
15]
Developer
Maintained by Community

Actor Metrics

  • 1 monthly user

  • 2 stars

  • >99% runs succeeded

  • Created in May 2024

  • Modified 4 months ago