What's New in v1.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 eligible for clustering.

For more information regarding clustering by attribute/rule, please visit the Cluster by Attribute/Rule section of the Vectors 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.

Example: 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

Transforming

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 Spherical Mercator as well, so you no longer need to set the sphericalMercator option to true when declaring a WeatherRadar layer while in Spherical Mercator.

Last updated April 3, 2019.