aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2007-07-07 11:47:22 +0000
committermatthew <matthew>2007-07-07 11:47:22 +0000
commit157533df7fdd6e839a8734fcf398feb6fd16fffd (patch)
treee36aea0a0e6a0894e22f22c4f73ee42f85cd4e0b
parentb5efd040d260a8b4860e6cc6064930f3c5a14163 (diff)
Better centring of geocoded location.
-rwxr-xr-xweb/index.cgi10
1 files changed, 7 insertions, 3 deletions
diff --git a/web/index.cgi b/web/index.cgi
index ede29ba2e..7637cc6e7 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -6,7 +6,7 @@
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: index.cgi,v 1.151 2007-07-07 11:39:41 matthew Exp $
+# $Id: index.cgi,v 1.152 2007-07-07 11:47:22 matthew Exp $
use strict;
require 5.8.0;
@@ -899,8 +899,12 @@ sub geocode_string {
$js =~ /"coordinates":\[(.*?),(.*?),/;
my $lon = $1; my $lat = $2;
($easting, $northing) = mySociety::GeoUtil::wgs84_to_national_grid($lat, $lon, 'G');
- $x = int(Page::os_to_tile($easting))-1;
- $y = int(Page::os_to_tile($northing))-1;
+ my $xx = Page::os_to_tile($easting);
+ my $yy = Page::os_to_tile($northing);
+ $x = int($xx);
+ $y = int($yy);
+ $x -= 1 if ($xx - $x < 0.5);
+ $y -= 1 if ($yy - $y < 0.5);
}
}
return ($x, $y, $easting, $northing, $error);