A point grid layer dynamically generates a regularly spaced grid of point features. This is a specialty layer for cases where an application needs a regular grid of points. It can be used, for example, in an editing environment to snap to a grid.
Create a new vector layer with the OpenLayers.Layer.PointGrid constructor.
// create a grid with points spaced at 10 map units var points = new OpenLayers.Layer.PointGrid({dx: 10, dy: 10}); // create a grid with different x/y spacing rotated 15 degrees clockwise. var points = new OpenLayers.Layer.PointGrid({dx: 5, dy: 10, rotation: 15});
OpenLayers.
|
A point grid layer dynamically generates a regularly spaced grid of point features. |
Properties | |
dx | {Number} Point grid spacing in the x-axis direction (map units). |
dy | {Number} Point grid spacing in the y-axis direction (map units). |
ratio | {Number} Ratio of the desired grid size to the map viewport size. |
maxFeatures | {Number} The maximum number of points to generate in the grid. |
rotation | {Number} Grid rotation (in degrees clockwise from the positive x-axis). |
origin | {OpenLayers.LonLat} Grid origin. |
Constructor | |
OpenLayers.
|
Creates a new point grid layer. |
Functions | |
setRatio | Set the grid ratio property and update the grid. |
setMaxFeatures | Set the grid maxFeatures property and update the grid. |
setSpacing | Set the grid dx and dy properties and update the grid. |
setOrigin | Set the grid origin property and update the grid. |
getOrigin | Get the grid origin property. |
setRotation | Set the grid rotation property and update the grid. |
{Number} Point grid spacing in the x-axis direction (map units). Read-only. Use the setSpacing method to modify this value.
{Number} Point grid spacing in the y-axis direction (map units). Read-only. Use the setSpacing method to modify this value.
{Number} Ratio of the desired grid size to the map viewport size. Default is 1.5. Larger ratios mean the grid is recalculated less often while panning. The maxFeatures setting has precedence when determining grid size. Read-only. Use the setRatio method to modify this value.
{Number} The maximum number of points to generate in the grid. Default is 250. Read-only. Use the setMaxFeatures method to modify this value.
{Number} Grid rotation (in degrees clockwise from the positive x-axis). Default is 0. Read-only. Use the setRotation method to modify this value.
{OpenLayers.LonLat} Grid origin. The grid lattice will be aligned with the origin. If not set at construction, the center of the map’s maximum extent is used. Read-only. Use the setOrigin method to modify this value.
setRatio: function( ratio )
Set the grid ratio property and update the grid. Can only be called after the layer has been added to a map with a center/extent.
ratio | {Number} |
setMaxFeatures: function( maxFeatures )
Set the grid maxFeatures property and update the grid. Can only be called after the layer has been added to a map with a center/extent.
maxFeatures | {Number} |
setOrigin: function( origin )
Set the grid origin property and update the grid. Can only be called after the layer has been added to a map with a center/extent.
origin | {OpenLayers.LonLat} |
setRotation: function( rotation )
Set the grid rotation property and update the grid. Rotation values are in degrees clockwise from the positive x-axis (negative values for counter-clockwise rotation). Can only be called after the layer has been added to a map with a center/extent.
rotation | {Number} Degrees clockwise from the positive x-axis. |
Set the grid ratio property and update the grid.
setRatio: function( ratio )
Set the grid maxFeatures property and update the grid.
setMaxFeatures: function( maxFeatures )
Set the grid dx and dy properties and update the grid.
setSpacing: function( dx, dy )
Set the grid origin property and update the grid.
setOrigin: function( origin )
Get the grid origin property.
getOrigin: function()
Set the grid rotation property and update the grid.
setRotation: function( rotation )