Find the occupant nearest to a point
const url = 'https://geocoder.api.gov.bc.ca/occupants/nearest?minDegree=2&maxDegree=100&point=-122.377%2C50.121&bbox=-119.51%2C49.48%2C-119.53%2C49.50&excludeUnits=false&onlyCivic=false&callback=jsonp&outputSRS=4326&asAttachment=false&brief=false&maxResults=1&setBack=0&locationDescriptor=any';const options = {method: 'GET', headers: {apikey: '<apikey>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://geocoder.api.gov.bc.ca/occupants/nearest?minDegree=2&maxDegree=100&point=-122.377%2C50.121&bbox=-119.51%2C49.48%2C-119.53%2C49.50&excludeUnits=false&onlyCivic=false&callback=jsonp&outputSRS=4326&asAttachment=false&brief=false&maxResults=1&setBack=0&locationDescriptor=any' \ --header 'apikey: <apikey>'Finds the single occupant (business) nearest to the specified point. Optionally filter by tags and location descriptor. Returns a GeoJSON FeatureCollection containing the nearest occupant as a Point, with properties including the business name, civic address, and location metadata.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The minimum degree an intersection can have to be included in results. A dead-end has a degree of 1.
The maximum degree an intersection can have to be included in results. A four-way stop has a degree of 4.
The X (longitude) and Y (latitude) coordinate of the search point, in the format ‘x,y’. Must be in the same SRS as the outputSRS parameter.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
-122.377,50.121A bounding box (xmin,ymin,xmax,ymax) used to limit the search area. Must be in the same SRS as the outputSRS parameter.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
-119.51,49.48,-119.53,49.50The maximum distance (in metres) to search from the given point.
If true, address results that are identified as ‘access points’ are excluded.
If true, only civic addresses are returned.
If provided the JSON result will be wrapped in a function call of the given name (for JSONP support).
Example
jsonpThe EPSG code of the spatial reference system (SRS) to use for output geometries.
Example
4326If true the result is returned as a file attachment.
A set of user-defined tags to apply to the query results.
If true the results are returned in brief format, omitting detailed address and location properties.
The maximum number of results to return.
The setback distance in metres from the street segment. A value of -1 indicates the centroid of the address range.
Describes the nature of the address location.
Responses
Section titled “Responses”The nearest occupant in Site Address Representation plus Occupant Representation. See https://github.com/bcgov/ols-geocoder/blob/gh-pages/geocoder-developer-guide.md#occupant-representation
The standard response envelope for all geocoder API responses. Contains the response object (which may be a single result, an array of results, or a search results object), along with metadata about the query parameters and output settings.
object
The complete search results for a geocode query, including match information, scoring, metadata, and the list of matching addresses.
object
The original query address that was geocoded.
The list of matching addresses, sorted by score (highest first). Each match includes the full address, location, and scoring details.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Base class for all geocoder address results, containing the shared properties for both site addresses and intersection addresses.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The full name of the locality (neighbourhood, city, province) for the address.
Example
Victoria, BCThe type of locality.
Example
MunicipalityThe electoral area, if applicable.
The province or territory abbreviation.
Example
BCThe positional accuracy classification of the location point.
Describes what the location point actually refers to (e.g. intersectionPoint, rooftopPoint, accessPoint).
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The EPSG code of the spatial reference system used for the output geometries.
The maximum number of search results returned.
The minimum score required for a match to be returned.
The distance (in metres) to move the access point away from the curb towards the inside of the parcel.
A semicolon-separated list of tags associated with the results.
Whether unmatched address details are included in the results.
The timestamp when the search was executed.
The execution time of the search in seconds.
The date and time when the underlying geocoder data was last processed.
A legal disclaimer for the geocoder service.
The interpolation method used for address matching.
The privacy statement for the geocoder service.
The copyright notice for the geocoder data.
The copyright license for the geocoder data.
The location descriptor used for the output addresses.
The character encoding of the output. Defaults to ‘ascii’.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Base class for all geocoder address results, containing the shared properties for both site addresses and intersection addresses.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The full name of the locality (neighbourhood, city, province) for the address.
Example
Victoria, BCThe type of locality.
Example
MunicipalityThe electoral area, if applicable.
The province or territory abbreviation.
Example
BCThe positional accuracy classification of the location point.
Describes what the location point actually refers to (e.g. intersectionPoint, rooftopPoint, accessPoint).
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
A site address representation including street address details, civic number, site identifiers, and status information.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The full name of the locality (neighbourhood, city, province) for the address.
Example
Victoria, BCThe type of locality.
Example
MunicipalityThe electoral area, if applicable.
The province or territory abbreviation.
Example
BCThe positional accuracy classification of the location point.
Describes what the location point actually refers to (e.g. intersectionPoint, rooftopPoint, accessPoint).
The unit number within a building or complex.
A letter that follows the unit number (e.g., ‘A’, ‘B’).
The type of unit within a building (e.g., ‘Suite’, ‘Unit’, ‘Apt’).
The civic number assigned to the site.
A letter or fraction that follows the civic number.
The street name.
The street type (e.g., ‘St’, ‘Ave’, ‘Blvd’).
The street direction (e.g., ‘N’, ‘S’, ‘E’, ‘W’).
The street qualifier (e.g., ‘Bridge’ in ‘Johnson St Bridge’).
The UUID of the site.
The UUID of the parent site.
The street segment (block) ID.
The name of the building, facility, or institution.
A narrative description of the location.
The physical status of the site.
The date the site was retired.
The date the site was last changed.
The internal access point ID.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
An occupant address representation including site address details and occupant information such as name, contact details, and business category.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The full name of the locality (neighbourhood, city, province) for the address.
Example
Victoria, BCThe type of locality.
Example
MunicipalityThe electoral area, if applicable.
The province or territory abbreviation.
Example
BCThe positional accuracy classification of the location point.
Describes what the location point actually refers to (e.g. intersectionPoint, rooftopPoint, accessPoint).
The unit number within a building or complex.
A letter that follows the unit number (e.g., ‘A’, ‘B’).
The type of unit within a building (e.g., ‘Suite’, ‘Unit’, ‘Apt’).
The civic number assigned to the site.
A letter or fraction that follows the civic number.
The street name.
The street type (e.g., ‘St’, ‘Ave’, ‘Blvd’).
The street direction (e.g., ‘N’, ‘S’, ‘E’, ‘W’).
The street qualifier (e.g., ‘Bridge’ in ‘Johnson St Bridge’).
The UUID of the site.
The UUID of the parent site.
The street segment (block) ID.
The name of the building, facility, or institution.
A narrative description of the location.
The physical status of the site.
The date the site was retired.
The date the site was last changed.
The internal access point ID.
The UUID of the occupant.
The name of the occupant (business or organization).
A description of the occupant.
An alternative address for the occupant.
The contact phone number.
The contact email address.
The contact fax number.
The website URL of the occupant.
The image URL of the occupant.
A list of keyword tags associated with the occupant.
The business category class.
The business category description.
The NAICS code for the business.
The date the occupant information was last updated.
The date the occupant was added.
A custom style name for mapping display.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Represents a street intersection address, including the intersection’s unique ID, name (built from the intersecting street names), degree (number of streets meeting at the intersection), and the representative point location.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
The full name of the locality (neighbourhood, city, province) for the address.
Example
Victoria, BCThe type of locality.
Example
MunicipalityThe electoral area, if applicable.
The province or territory abbreviation.
Example
BCThe positional accuracy classification of the location point.
Describes what the location point actually refers to (e.g. intersectionPoint, rooftopPoint, accessPoint).
The unique identifier (UUID) of the intersection.
Example
74628473-1460-4d5f-8699-34964e8d3ba6The name of the intersection, built from the intersecting street names (e.g. ‘Douglas St and Johnson St’). If only one street name is known, it is repeated.
Example
Douglas St and Johnson StThe degree of the intersection, i.e. the number of streets meeting at this point. A dead-end has degree 1, a T-intersection has degree 2, a four-way intersection has degree 4.
Example
4object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Response containing the Property Identifiers (PIDs) associated with a site.
object
The unique identifier (UUID) of the site.
Example
a810e87b-7f99-4898-a19c-1493e1d25e25A comma-separated list of Property Identifiers (PIDs) for the site’s parcels.
Example
005-570-168;005-570-169The EPSG code of the spatial reference system used for the output geometries.
Example
4326The JSONP callback function name, if one was requested.
Whether the results are in brief format, omitting detailed properties.
An error message, if the request resulted in an error. Null if the request was successful.