Constructs a new LonLatGrid
. The constructor parameters determine how many grid lines are drawn
for each scale. This cannot be changed afterwards.
The creation of an example grid where the density of the grid lines increases when you zoom in is shown below:
var settings=[];
settings.push( {scale: 2.0E-8 * 4, deltaLon: 1, deltaLat: 1 });
settings.push( {scale: 2.0E-8 , deltaLon: 5, deltaLat: 5 });
settings.push( {scale: 9.0E-9 , deltaLon: 10, deltaLat: 10 });
settings.push( {scale: 5.0E-9 , deltaLon: 20, deltaLat: 20 });
settings.push( {scale: 0 , deltaLon: 45, deltaLat: 45 });
var grid = new LonLatGrid( settings );
This will for example show a grid line every 20 degrees longitude and every 20 degrees latitude for all scales between 5.0E-9 and 9.0E-9.
By default the grid origin is located at (0,0). Optionally, you can specify a new origin as well.
var grid = new LonLatGrid( settings, {originLon: 10, originLat: 10} );
An array of LonLatGrid.Settings specifying which grid lines should be drawn at each scale level.
Optional
options: LonLatGridOrigindefines the grid origin
The style which will be used for scales which do not define their own style. If you want to modify the fallback style, you should replace this instance and not modify the existing instance.
Defining a style for a specific scale can be done using the setStyle method.
When this is not set, a default fallback style is used. The default style configuration may change over time, so it is encouraged to set this property explicitly.
Null values are not allowed. To turn off the grid, you can always
GridLayer.setPaintRepresentationVisible set the paint representations to false
.
The latitude of the grid origin.
The longitude of the grid origin.
The different scales which were passed in the constructor.
Returns the style which will be used to visualize the grid lines at the specified scale.
You should not modify the StyleSettings
instance returned by this method. If you want
to modify the style for a certain scale, use the setStyle
method to replace the style instance.
The index of the scale. Must be a valid index in the scales array.
The style for the specified scale. Will return
null
when no style was specified for that scale.
Sets the style which needs to be used for the specified scale.
Once a style is set, the style object should no longer be modified. If you want to modify the style for a certain scale afterwards, call this method again with the new/modified style instance.
All scales for which no style is specified will be visualized using the fallback style.
The index of the scale. Must be a valid index in the this.scales
array.
The style
A longitude-latitude grid. This class contains specific information about the grid, such as the increment between grid lines and various options for styling and labeling. To paint this grid on a map, create a new GridLayer with an object of this class as input.
Since
2013.0