OpenLayers.Control.Graticule

The Graticule displays a grid of latitude/longitude lines reprojected on the map.  The grid is specified by a list of widths in degrees (with height the same as the width).  The grid height can be specified as a multiple of the width.  This allows making the grid more regular in specific regions of some projections.  The grid can also be specified by lists of both widths and heights.  This allows matching externally-defined grid systems.

Inherits from

Summary
OpenLayers.Control.GraticuleThe Graticule displays a grid of latitude/longitude lines reprojected on the map.
Properties
autoActivate{Boolean} Activate the control when it is added to a map.
intervals{Array(Float)} A list of possible graticule widths in degrees.
intervalHeights{Array(Float)} A list of possible graticule heights in degrees.
intervalHeightFactor{Number} Factor to compute graticule height from the width.
displayInLayerSwitcher{Boolean} Allows the Graticule control to be switched on and off by LayerSwitcher control.
visible{Boolean} should the graticule be initially visible (default=true)
numPoints{Integer} The number of points to use in each graticule line.
targetSize{Integer} The maximum size of the grid in pixels on the map
layerName{String} The name to be displayed in the layer switcher, default is set by {OpenLayers.Lang}.
labelled{Boolean} Should the graticule lines be labelled?.
labelFormat{String} the format of the labels, default = ‘dm’.
labelLonYOffset{Integer} the offset of the longitude (X) label from the bottom of the map.
labelLatXOffset{Integer} the offset of the latitude (Y) label from the right of the map.
lineSymbolizer{symbolizer} the symbolizer used to render lines
labelSymbolizer{symbolizer} the symbolizer used to render labels
gratLayer{OpenLayers.Layer.Vector} vector layer used to draw the graticule on
epsg4326Projection{OpenLayers.Projection}
projection{OpenLayers.Projection} The projection of the graticule.
projectionCenterLonLat{OpenLayers.LonLat} The center of the projection’s validity extent.
maxLat{number}
minLat{number}
minLon{number}
meridians{Array.<OpenLayers.Feature.Vector>}
Constructor
OpenLayers.Control.GraticuleCreate a new graticule control to display a grid of latitude longitude lines.
Functions
destroy
drawinitializes the graticule layer and does the initial update
activate
deactivate
updatecalculates the grid to be displayed and actually draws it
createGraticule
updateProjectionInfo
addMeridian
addParallel

Properties

autoActivate

{Boolean} Activate the control when it is added to a map.  Default is true.

intervals

{Array(Float)} A list of possible graticule widths in degrees.

intervalHeights

{Array(Float)} A list of possible graticule heights in degrees.  Length must match intervals array.  Default is null (same as widths).

intervalHeightFactor

{Number} Factor to compute graticule height from the width.  Can be used to match existing grid systems, or improve regularity of grid.  Default is 1.  Ignored if intervalHeights are set explicitly.

displayInLayerSwitcher

{Boolean} Allows the Graticule control to be switched on and off by LayerSwitcher control.  Defaults is true.

visible

{Boolean} should the graticule be initially visible (default=true)

numPoints

{Integer} The number of points to use in each graticule line.  Higher numbers result in a smoother curve for projected maps.  Deprecated.  The number of points is now determined by adaptive quantization.

targetSize

{Integer} The maximum size of the grid in pixels on the map

layerName

{String} The name to be displayed in the layer switcher, default is set by {OpenLayers.Lang}.

labelled

{Boolean} Should the graticule lines be labelled?. default=true

labelFormat

{String} the format of the labels, default = ‘dm’.  See <OpenLayers.Util.getFormattedLonLat> for other options.

labelLonYOffset

{Integer} the offset of the longitude (X) label from the bottom of the map.

labelLatXOffset

{Integer} the offset of the latitude (Y) label from the right of the map.

lineSymbolizer

{symbolizer} the symbolizer used to render lines

labelSymbolizer

{symbolizer} the symbolizer used to render labels

gratLayer

{OpenLayers.Layer.Vector} vector layer used to draw the graticule on

epsg4326Projection

{OpenLayers.Projection}

projection

{OpenLayers.Projection} The projection of the graticule.

projectionCenterLonLat

{OpenLayers.LonLat} The center of the projection’s validity extent.

maxLat

{number}

minLat

{number}

minLon

{number}

meridians

{Array.<OpenLayers.Feature.Vector>}

Constructor

OpenLayers.Control.Graticule

Create a new graticule control to display a grid of latitude longitude lines.

Parameters

options{Object} An optional object whose properties will be used to extend the control.

Functions

destroy

destroy: function()

draw

draw: function()

initializes the graticule layer and does the initial update

Returns

{DOMElement}

activate

activate: function()

deactivate

deactivate: function()

update

update: function()

calculates the grid to be displayed and actually draws it

Returns

{DOMElement}

createGraticule

createGraticule: function(extent,
center,
resolution,
squaredTolerance)

Parameters

extent{OpenLayers.Bounds} Extent.
center{OpenLayers.LonLat} Center.
resolution{number} Resolution.
squaredTolerance{number} Squared tolerance.

updateProjectionInfo

updateProjectionInfo: function(projection)

Parameters

projection{OpenLayers.Projection} Projection.

addMeridian

addMeridian: function(lon,
minLat,
maxLat,
squaredTolerance,
extentGeom,
index)

Parameters

lon{number} Longitude.
minLat{number} Minimum latitude.
maxLat{number} Maximum latitude.
squaredTolerance{number} Squared tolerance.
extentGeom{OpenLayers.Geometry.Polygon} Extent. index {number} Index.

Returns

{number} Index.

addParallel

addParallel: function(lat,
minLon,
maxLon,
squaredTolerance,
extentGeom,
index)

Parameters

lat{number} Latitude.
minLon{number} Minimum longitude.
maxLon{number} Maximum longitude.
squaredTolerance{number} Squared tolerance.
extentGeom{OpenLayers.Geometry.Polygon} Extent.
index{number} Index.

Returns

{number} Index.

Internationalization namespace.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
destroy: function()
draw: function()
initializes the graticule layer and does the initial update
activate: function()
deactivate: function()
update: function()
calculates the grid to be displayed and actually draws it
createGraticule: function(extent,
center,
resolution,
squaredTolerance)
updateProjectionInfo: function(projection)
addMeridian: function(lon,
minLat,
maxLat,
squaredTolerance,
extentGeom,
index)
addParallel: function(lat,
minLon,
maxLon,
squaredTolerance,
extentGeom,
index)
Controls affect the display or behavior of the map.
Close