POI

The ALKMaps.Layer.POI layer allows you to search for and display points of interest within a specified distance of a given location. By default each POI is also given a popup that display’s additional information in addition to a hover tooltip with the POI’s place name, but each of these features can also be turned off.

ParameterType/ValuesDescription
displayInfobooleanIndicates whether or not to display info popups for POIs. This will be overridden for any POIs returned from the radiusSearch method if the function level displayInfo option is specified. Default true.
displayNamebooleanIndicates whether or not to display hover tooltips with the POI’s place name. This will be overridden for any POIs returned from the radiusSearch method if the function level displayName option is specified. Default true.
var poiLayer = new ALKMaps.Layer.POI("POI Layer", {
  displayInfo: true,
  displayName: false
});
map.addLayer(poiLayer);

POI searches can be done using the radiusSearch function. The parameters for this function are explained in the table below.

ParameterType/ValuesDescription
centerALKMaps.LonLatCenter point of the search.
radiusnumberDistance from the center point that will be included in the POI search.
units"Miles"|"Kilometers"Distance units of the radius. Default Miles.
categoriesstringSingle category name or comma delimited string of category names to include in the search. Default All.
Note: Please refer to the box below this table for a list of possible categories.
regionstringData region of the search.
optionsobject

Options object. (optional)

ParameterTypeDescription
externalGraphicstringSingle external graphic to use for all POIs returned by this search.
graphicHeightnumberHeight of the graphic in pixels.
graphicWidthnumberWidth of the graphic in pixels.
displayInfobooleanIndicates whether or not to display info popups for this search.
displayNamebooleanIndicates whether or not to display hover tooltip containing POI's place name for this search.
eraseSearchesbooleanIndicates whether or not to remove any existing POIs from previous searches.
limitNumberSets the limit for the maximum number of POIs that will be rendered on the layer. Default: null (no limit)

Note: If using Internet Explorer version 8 or lower, a default limit of 200 will be set. If provided, this will be overridden by the specified limit option (set to null for no limit). Please note that increasing or removing the limit in IE8 can cause severely decreased performance and page crashes when attempting to render a high number of results.
successfunctionCallback function called after success with the list of POIs returned from the service as its only parameter, and is expected to return an array of POIs. This allows the user to manipulate the list of POIs (i.e. filter POIs by attribute) before it is passed to the layer for processing and rendering. (optional)
Note: Returning null, a non-array, or not returning anything will cause all POIs to still be displayed. In order to prevent any POIs from being rendered, an empty array must be returned.
failurefunctionCallback function called after failure with the return object as a parameter. (optional)

Categories List:

"Airport"|"Attractions"|"AutoDealership"|"Automotive"|"Bank"|"BusTaxiLimo"|"Dining"|"Education"|"Emergency"|
"Entertainment"|"EventFacility"|"FerryTerminal"|"Gas"|"GeographicFeature"|"Government"|"GroceryStore"|
"GuestHouse"|"Lodging"|"Marina"|"Municipal"|"Other"|"Parking"|"Parks"|"PlaceOfWorship"|"RailwayStation"|
"RentACar"|"Retail"|"RVServices"|"SportsRec"|"Travel"|"TruckServices"|"WeighStation"

POI Data

The radius search will return up to 3000 POI’s regardless of the miles requested. In some cases you may need to specify a smaller radius to get a complete list of matches. Also, the API uses air miles not road miles.

The data returned for each POI is attached to its marker attributes. This data is broken up into three attribute properties; category which is just the category name and the distanceFromCenter and data objects. Please reference the tables below for breakdown of the structure of this data

distanceFromCenter

PropertyType/ValuesDescription
DistanceUnits[0 (Miles) \ 1 (Kilometers)]Unit of measurement used for distance value.
ValueNumberDistance from the center point of the POI search.

data

PropertyType/ValuesDescription
AddressObject
PropertyType/ValuesDescription
CityStringCity in which the POI is located.
CountryStringCountry in which the POI is located.
CountyStringCounty in which the POI is located.
StateStringState in which the POI is located.
StreetAddressStringStreet address of the POI.
ZipStringZip code of the POI's address.
CoordsObject
PropertyType/ValuesDescription
LatStringLatitude value of the POI's location.
LonStringLongitude value of the POI's location.
LabelStringDistance from the center point of the POI search.
PlaceNameStringDistance from the center point of the POI search.
RegionNumberData region of the POI.

Category Manipulation

The POI layer also gives you the ability to set the visibility or remove all the POI’s of a specified category using the setCategoryVisibility and removeCategory functions respectively.

poiLayer.setCategoryVisibility("Dining", false); //hides all POI's in the Dining category
poiLayer.removeCategory("Lodging");

Retrieving POIs By Attribute

Using the POI layer’s getPoisBy function, you can retrieve any POIs from the layer with an attribute value matching the one specified in the parameters. The function takes two parameters the first being the name of attribute such as “Category”, and the second being the value of the attribute like “Dining” for example. A description of the supported attributes are explained in the table below.

AttributeData TypeDescription
CategoryStringWill return all POIs on the layer in the given category. Please reference the POI search table for the list of possible categories.
PlaceNameStringUseful for locating a specific single POI, using this attribute will return the POI with the matching PlaceName. Please note POIs such chain stores or restaurants will return multiple results if there more than one of them on the layer.
CityStringWill return all POIs with an address located in the specified city.
StateStringWill return all POIs with an address located in the specified state.
ZipNumberWill return all POIs with a 5 digit zip code that matches the specified value.
StreetAddressStringUseful for locating a specific single POI, using this attribute will return the POI with a matching street address.
StreetStringStreet actually uses the StreetAddress attribute and checks to see if it contains the specified street name. Please note that there can be streets with the same name across different cities, which depending on the search radius may result in undesired POIs being returned.
DistanceFromCenterNumberWill return all POIs with a matching integer distance value. Please note that the specified value is compared with the floor of the POI’s distance value.
poiLayer.getPoisBy("Zip", 08901);
Last updated November 5, 2019.