1

Topic: National grid location selection size vs. map zoom level

When using a spatial reference system of British National Grid, there seems to be a hard-coded relationship between the grid square size and the zoom level:
1-9: 10km (2-fig grid ref)
10-12: 1km (4-fig grid ref)
13-16: 100m (6-fig grid ref)
17-19: 10m (8-fig grid ref)

Is this configurable? If not, where is it coded?

Thanks, Chris

Chris Dee
Garganey Consulting

2

Re: National grid location selection size vs. map zoom level

There is a function, _zoomInToClickPoint() in iform/media/jquery.indiciaMapPanel.js which might be what you are looking for, if I have understood your query.

This determines how the map zooms in after clicking a point on the map.

There is a maxZoomBuffer setting which is described as the "margin around feature when relocating to gridref or initialFeatureWkt"

Jim Bacon.

3

Re: National grid location selection size vs. map zoom level

Thanks for the pointer. In fact is it the 'precision' (i.e. size) of the plotted grid square that I wanted to modify. This is set in getPrecisionInfo as a function of the zoom setting.

Modifying the conditional setting of the precision variable achieved just what I wanted. I changed

        if (metres < 3) {
          precision = 10;
        } else if (metres < 30) {
          precision = 8;
        } else if (metres < 300) {
          precision = 6;
        } else if (metres < 3000) {
          precision = 4;
        } else {
          precision = 2;
        }

to

        if (metres < 3) {
          precision = 10;
        } else if (metres < 8) {
          precision = 8;
        } else if (metres < 128) {
          precision = 6;
        } else if (metres < 1024) {
          precision = 4;
        } else {
          precision = 2;
        }

Thanks again, Chris

Chris Dee
Garganey Consulting

4

Re: National grid location selection size vs. map zoom level

I understand the question now I see the answer! Glad I helped you in the right direction.

If you want to make a permanent feature of these changes I'd recommend creating configuration settings, defaulting to the old values, which you override with the values you need. Submit a pull request to https://github.com/Indicia-Team/media and this could be incorporated in the next release.

Jim Bacon