Skip to main content

Points of Interest (NZ only)

Points of Interest is a New Zealand only search feature which allows a user to search 'points of interest', such as hospitals, libraries, parks, businesses etc rather than specific addresses. This service returns points of interest, with associated addresses, in place of, or in addtion to regular addresses being searched.

This service is only available in New Zealand.

Widget integration guide

This page outlines how to integrate the Points of Interest Widget.
For advanced integration utilise the Points of Interest Autocomplete API and POI Metadata API.

Configure with widget options and select metadata returned when point of interest is selected.

Steps to integrate

You’ll need access to update the website or form where you want to add the widget and have an Addressfinder account.

  1. Copy and paste the code snippet below into the HTML of your webpage, ideally just before the closing </body> tag.
  2. Replace 'search_field_id' with the ID of your first address field (eg, address_1).
  3. Replace your_license_key with your Addressfinder license key. You can find it in the Addressfinder Portal. If you don't have an Addressfinder account, sign up for a free trial.
  4. Update the code snippet with the IDs of the fields you are using to capture the selected point of interest Name and Address.
  5. Test.

Points of interest autocomplete code snippet

Points of interest widget code snippet
<script>
(function() {
var widget, initAddressFinder = function() {
widget = new AddressFinder.Widget(

// Step 2 - Replace 'search_field_id' with the ID of your POI search field.
document.getElementById('search_field_id'),

// Step 3 - Replace `your_license_key` with your Addressfinder license key.
'your_license_key',
'NZ', {
"show_addresses": false,
"show_points_of_interest": true
}
);

// Step 4 - Update the lines below with the IDs of the fields you want the information to be populated into.
widget.on('points_of_interest:select', function(selectedPOI, metaData) {
let selected = new AddressFinder.NZSelectedAddress(metaData.a, metaData);
document.getElementById('poi_and_addrs1_field_id').value = metaData.name + ', ' + selected.address_line_1();
document.getElementById("suburb_field_id").value = selected.suburb();
document.getElementById("city_field_id").value = selected.city();
document.getElementById("postcode_field_id").value = selected.postcode();
});
};

function downloadAddressFinder() {
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};

document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
</script>

Points of Interest autocomplete options

Limit the number of search results to display in the drop down

By default, the widget will return and display up to 10 points of interest in the search results. To display more or less than the default, include the max address_param and the number of addresses you wish to display, in the widget code. Also include the max_results widget param in the code as this gives the widget permission to display these extra addresses. Use any whole number between 1 and 100.

Display up to 20 points of interest example
      "NZ",
{ show_addresses: false,
show_points_of_interest: true,
points_of_interest_params: {
max: 20
},
"max_results": "20"
}
);

See an example of this on CodePen.

Collecting metadata when Point of Interest selected

As well as the POI Name and Address, this service also returns a variety of other information of value. View the list of metadata available for collection below.

This information is returned in the response by default so to collected it, specify in the widget code which data you want and where to populate it.

See the list of Point of Interest Metadata API parameters, responses and errors

See this example showing the collection of metadata on selection of the POI.