DriveTime

The ALKMaps.Layer.DriveTime layer can be used to create an isochrone map representing the drivable distance from a center point within the given time constraint.

Add A Polygon

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.

ParameterTypeDescription/Values
centerALKMaps.LonLatThe center point of the polygon.
minutesNumberDriving time in minutes from the specified center point. Can be a maximum of 30 minutes.
styleObjectOptional object containing styling properties for the polygon.
framePolygonBooleanIf true, the map will be zoomed to the bounds of the newly added polygon.
Default: true
optionsObjectOptional object containing the region and any routing or truck options. By default region will be inherited from the base layer.
successFunctionCallback function called after a successful response is received from the service. The parameter passed in will be the id of the newly added polygon.
failureFunctionCallback function triggered on service error.

Remove A Polygon

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);