[OpenLayers-Users] selectable grid control

Puneet Kishor punk.kish at gmail.com
Thu Jan 19 14:31:38 EST 2012


I have finally managed to mock up a selectable grid control (see http://mumbai.geology.wisc.edu/test/svg_grid.html). The pseudocode is as follows

    // create styleMap
    var myStyles = new OpenLayers.StyleMap...

    // create and add grid_layer
    var grid_layer = new OpenLayers.Layer.Vector("Grid", {styleMap: myStyles});
    map.addLayer(grid_layer);
    
    // create grid cells
    var cells = [];
    for (var r = 0; r < rows; r++) {
        for (var c = 0; c < cols; c++) {
            ...       
        }
    }
    
    // add the cells to the grid_layer
    grid_layer.addFeatures(cells);

    // add and activate highlight and select controls

I have the following questions:

1. Seems like I am unable to make the grid line thinner. I have set strokeWidth: 1, but it looks rather thick. Can I make it thinner?

2. I want the grid to remain the same size whether I zoom in or out. Do I have to destroy the layer and re-make it on every map change, resize, etc.?

3. "double-click to zoom", "press shift and drag to zoom", or "click-hold and drag to pan" are no longer possible because selectControl takes over. Is there a way to accomplish both?

And, the over-arching question

0. Is there a better way to accomplish all this?


Many thanks in advance for your suggestions,

--
Puneet Kishor


More information about the Users mailing list