1

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 :

  1. Bounds value. Example: new OpenLayers.Bounds(77.06173,28.50872,77.40918,28.74567)
  2. Distance between the points in the grid. Example : 100

My actual requirements is

  1. Create a grid on map.
  2. Plot some POINTS.
  3. Calculate the number of points in each grid.
  4. 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

  1. How can I add polygon grid layer.
  2. How can I set this layer in a particular bounds/extent.
  3. How can I give "select" control to this layer.
  4. How can I find out Number of points on a selected grid/polygon.

Note: I am using Openlayers 2.11.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.