A vector layer for displaying drive time polygons. Create a new instance with the ALKMaps.Layer.DriveTime constructor.
ALKMaps. | A vector layer for displaying drive time polygons. |
Properties | |
framePolygon | {Boolean} Determines whether or not the map should zoom to the bounds of the most recently added polygon. |
Constructor | |
ALKMaps. | Create a vector layer for displaying drive time polygons |
Functions | |
setMap | Forces this layer having the same projection as the map. |
addDriveTimePolygon | Adds a new polygon to the map using the getDriveTimePolygon service. |
removeDriveTimePolygon | Remove the drive time polygon with the given id. |
Create a vector layer for displaying drive time polygons
name | {String} Used to identify this layer. |
options | {Object} Optional object whose properties will be set on the instance. |
{ALKMaps.Layer.DriveTime} A new vector layer for drawing drive time polygons.
setMap: function ( map )
Forces this layer having the same projection as the map.
map | {ALKMaps.Map} |
addDriveTimePolygon: function( params )
Adds a new polygon to the map using the getDriveTimePolygon service.
center | {ALKMaps.LonLat} Center point of polygon. The center acts as the starting point of all the virtual route paths ending at each point in the polygon. The projection of this point is inherited from the base layer. |
minutes | {Number} Driving time in minutes from the center point to each point of the polygon. |
style | {Object} optional object containing the styling properties to be used for the polygon feature. |
framePolygon | {Boolean} Determines whether or not map should zoom to the bounds of the polygon after it is added. |
options | {Object} Object containing optional routing and trucking configurations. |
success | {Function} success callback function |
failure | {Function} failure callback function |
driveTimeLayer.addDriveTimePolygon({ center: new ALKMaps.LonLat(-8310543.22567,4919623.93353), //inherits projection from the base layer minutes: 10, options: { region: "NA", dataset: "Current", highwayOnly: false, tollDiscourage: true }, success: function(response){ console.log(response); } });
The id of the polygon is returned in the success callback function.
removeDriveTimePolygon: function ( id )
Remove the drive time polygon with the given id.
id | {String} Id of the polygon that will be removed from the layer. |
driveTimeLayer.removeDriveTimePolygon("ALKMaps.Feature.Vector_400");
{Boolean} Whether or not polygon was successfully removed.
Forces this layer having the same projection as the map.
setMap: function ( map )
Adds a new polygon to the map using the getDriveTimePolygon service.
addDriveTimePolygon: function( params )
Remove the drive time polygon with the given id.
removeDriveTimePolygon: function ( id )