The ALKMaps.Layer.DriveTime
layer can be used to display polygons representing the drivable distance from a center point within the given time constraint.
A new drive time polygon can be added your ALKMaps.Layer.DriveTime
layer using the addDriveTimePolygon
function. The parameters for this function are mapped out in the table below.
Please note that projection of the ALKMaps.Layer.DriveTime
layer is inherited from the base layer, so the projection of the ALKMaps.LonLat
used for the center of the polygon must be in the same projection.
Parameter | Type | Description/Values |
---|---|---|
center |
ALKMaps.LonLat
|
The center point of the polygon. |
minutes |
Number
|
Driving time in minutes from the specified center point. Can be a maximum of 30 minutes. |
style |
Object
|
Optional object containing styling properties for the polygon. |
framePolygon |
Boolean
|
If true, the map will be zoomed to the bounds of the newly added polygon. Default: true
|
options |
Object
|
Optional object containing the region and any routing or truck options. By default region will be inherited from the base layer.
|
success |
Function
|
Callback function called after a successfull response is received from the service. The parameter passed in will be the id of the newly added polygon. |
failure |
Function
|
Callback function triggered on service error. |
The removeDriveTimePolygon
function can be used to remove an existing polygon from the layer by providing the id of the polygon. The polygon's id can be obtained from the parameter in the user defined success callback function of addDriveTimePolygon
.
var id = "ALKMaps.Feature.Vector_248"; driveTime.removeDriveTimePolygon(id);