What's New in Version 1.2

Spherical Mercator Default

By default your map and all layers will now appear in Spherical Mercator. This means you no longer need to set the sphericalMercator option to true when creating your BaseMap layer.

    var layer = new ALKMaps.Layer.BaseMap("Base Map", {}, { displayInLayerSwitcher: false });

MapBox Satellite Imagery

The ALK Maps JS API provides the ability to view satellite image tiles at a wide range of zoom levels. The satellite view has a road overlay over the aerial map tiles.

Please note, the satellite map style is only available using the spherical mercator projection.

Custom Places

You can now create, manage, and retrieve your very own custom places using the new set of functions added to the API. You can also create and manage custom sets and categories, allowing for better organization and easier retrieval of your custom places. For more information please visit the CustomPlaces page under the Services section of the guide.

For more information regarding the custom places services, please visit the Custom Places page.

Vector Markers Layer

ALKMaps.Layer.VectorMarkers is a new layer that has been added in 1.2, in an attempt to combine the versatility of the Vector layer with the simplicity of the Markers layer while eliminating certain disadvantages that the Markers layer presents. The major upside of this layer is its ability to allow for the interaction between multiple layers, while retaining the overall ease of use of the Markers layer.

For more information regarding this layer and how to use it, please visit the VectorMarkers page.

Clustering by Attribute and/or Rule

There is a new feature for clustering that gives the option to specify an attribute and/or rule in a cluster strategy. If an attribute is specified, the value of a feature's attribute must match that of the features already in the cluster before a feature can be added to the cluster. If a rule is specified, a feature must first satisfy the condition of the rule before it can even become eligable for clustering.

For more information regarding clustering by attribute/rule, please visit the Cluster by Attribute/Rule section of the Vectors page.

Specifying API Key

In addition to being able to set the ALKMaps.APIKey property, you now have the option of instead specifying your API key in the query string of the ALKMaps.js reference.

    <script src="https://maps.alk.com/api/1.2/alkmaps.js?key=YourAPIKeyHere" type="text/javascript"></script>


Customize Edit Toolbar

You can now customize which controls are displayed on the EditPanel. For more information please visit the Controls section of the guide.

    var editPanel = new ALKMaps.Control.EditPanel(
                 controlIndex: [0,3,7,9]

For more information regarding customizing the edit panel, please visit the EditPanel section of the Controls page.

Route Handle Images

In addition to still being able to set the images used for each route handle type using the setRouteHandle function in the addRoute callback function, you now also have the option of setting the images of each of the route handles individually using the externalImages property. The only property of externalImages is an array of strings images containing the image locations to be used for the handles at the cooresponding indices of the stops array.

Please note the images array must be the same length as the stops array, and that you can place null at any index where you want to use the default image or set later.

        images: ["http://www.alk.com/img/alk-logo-icon.png", ALKMaps.IMAGE.FAVORITE, null, ALKMaps.IMAGE.TRUCK_GREEN]

Another option for setting route handle images that has been added in version 1.2, is the ability to override the default images for origin, waypoint, and destination handles. This is done when defining your routing layer by setting the originURL, waypointURL, and destinationURL properties of the options object. The major advantage of this feature is the fact that if waypointURL is specified, that graphic will be used for any new handles created when a route is dragged.

var routingLayer = new ALKMaps.Layer.Routing("Routing Layer",{
    isDraggable: true,
    waypointURL: "http://www.alk.com/img/alk-logo-icon.png",
    destinationURL: ALKMaps.IMAGE.TRUCK_RED

For more information regarding custom route handle images, please visit the Graphics section of the Routing layer page.

Service Wrapper Functions

For your convenience, we have added a set of wrapper functions for some of the services to the ALKMaps.Map class. If the map is in the Spherical Mercator projection, your coordinate parameters must be in meters and any coordinates in the return object will be returned in meters as well. There is also the option of choosing different input and output formats for getRoutePath and getDerivedRoutePath wrapper functions.

For more information regarding these wrapper functions and examples on how to use them, please visit each of the pages located in the Services section of the guide menu.

Transforming Arrays

There are now functions to transform entire arrays of ALKMaps.LonLat or ALKMaps.Geometry.Point objects between projections. This can be done by passing an array followed by the source and destination projections to either the ALKMaps.LonLat.transformArray or ALKMaps.Geometry.Point.transformArray functions.

    var lonLats = [
            new ALKMaps.LonLat(-75.173297, 39.942892),
            new ALKMaps.LonLat(-74.83153, 39.61703),
            new ALKMaps.LonLat(-74.438942, 39.362469)
    lonLats = ALKMaps.LonLat.transformArray(lonLats, new ALKMaps.Projection("EPSG:4326"), map.getProjectionObject());


Migrating to 1.2


As a result of your map being in Spherical Mercator, most functions and features that take coordinates as arguments will expect the coordinates to be in meters rather than degrees. If you have coordinate values in degrees that you would still like to use while in the Spherical Mercator projection, you can use the transform function to get the equivalent coordinate values in meters. This function can be performed on a ALKMaps.LonLat object or any of the ALKMaps.Geometry classes.

    //LonLat Object
    new ALKMaps.LonLat(-74.438942, 39.362469).transform(new ALKMaps.Projection("EPSG:4326"), map.getProjectionObject());

    //Geometry Object
    new ALKMaps.Geometry.Point(-74.438942, 39.362469).transform(new ALKMaps.Projection("EPSG:4326"), map.getProjectionObject());

This is important to remember when doing things such as setting the center of your map, adding a popup to your map, adding a vector to a vector layer, or using some of the new service functions added to map.

Routing Layer

When creating a new route the coordinates in the stops array must be in the same projection as the map, previously the routing layer would expect coordinates to always be in degrees regardless of the map projection.

WeatherRadar Layer

WeatherRadar layer now defaults to Sherical Mercator as well, so you no longer need to set the sphericalMercator option to true when declaring a WeatherRadar layer while in Spherical Mercator.