POI
Contents
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.
Parameter | Type/Values | Description |
---|---|---|
displayInfo
| boolean
| Indicates 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 .
|
displayName
| boolean
| Indicates 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.
Parameter | Type/Values | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
center
| ALKMaps.LonLat
| Center point of the search. | ||||||||||||||||||||||||
radius
| number
| Distance from the center point that will be included in the POI search. | ||||||||||||||||||||||||
units
| "Miles"|"Kilometers"
| Distance units of the radius. Default Miles. | ||||||||||||||||||||||||
categories
| string
|
Single 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. | ||||||||||||||||||||||||
region
| string
| Data region of the search. | ||||||||||||||||||||||||
options
| object
|
Options object. (optional)
| ||||||||||||||||||||||||
success
| function
|
Callback 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.
| ||||||||||||||||||||||||
failure
| function
| Callback 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
Property | Type/Values | Description |
---|---|---|
DistanceUnits
| [0 (Miles) \ 1 (Kilometers)]
| Unit of measurement used for distance value. |
Value
| Number
| Distance from the center point of the POI search. |
data
Property | Type/Values | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Address
| Object
|
| |||||||||||||||||||||
Coords
| Object
|
| |||||||||||||||||||||
Label
| String
| Distance from the center point of the POI search. | |||||||||||||||||||||
PlaceName
| String
| Distance from the center point of the POI search. | |||||||||||||||||||||
Region
| Number
| Data 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.
Attribute | Data Type | Description |
---|---|---|
Category
| String
| Will return all POIs on the layer in the given category. Please reference the POI search table for the list of possible categories. |
PlaceName
| String
| Useful 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. |
City
| String
| Will return all POIs with an address located in the specified city. |
State
| String
| Will return all POIs with an address located in the specified state. |
Zip
| Number
| Will return all POIs with a 5 digit zip code that matches the specified value. |
StreetAddress
| String
| Useful for locating a specific single POI, using this attribute will return the POI with a matching street address. |
Street
| String
| Street 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. |
DistanceFromCenter
| Number
| Will 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);