I am trying to create a grid in my map and do some calculations.
I seen the following links:-
Create regular polygon grid using postgis
Create regular polygon grid inside a polygon using postgis
Here I understood, how to create a polygon grid using postgis spatial query.
Any one, please help me to do the same concept in Openlayers(any client side code).
My arguments are :
- Bounds value. Example: new OpenLayers.Bounds(77.06173,28.50872,77.40918,28.74567)
- Distance between the points in the grid. Example : 100
My actual requirements is
- Create a grid on map.
- Plot some POINTS.
- Calculate the number of points in each grid.
- Get the centroid(x,y) of the grid which have maximum number of points.
I just seen this code..
var points = new OpenLayers.Layer.PointGrid({
isBaseLayer: true, dx: 15, dy: 15
});
var map = new OpenLayers.Map({
div: "map",
layers: [points],
center: new OpenLayers.LonLat(0, 0),
zoom: 2
});
Reference: Openlayers Point Grid
My Queries
- How can I add polygon grid layer.
- How can I set this layer in a particular bounds/extent.
- How can I give "select" control to this layer.
- How can I find out Number of points on a selected grid/polygon.
Note: I am using Openlayers 2.11.