aboutsummaryrefslogtreecommitdiffstats
path: root/t/map/cheshireeast.t
diff options
context:
space:
mode:
Diffstat (limited to 't/map/cheshireeast.t')
-rw-r--r--t/map/cheshireeast.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/map/cheshireeast.t b/t/map/cheshireeast.t
new file mode 100644
index 000000000..a90a1606e
--- /dev/null
+++ b/t/map/cheshireeast.t
@@ -0,0 +1,18 @@
+use Test::More;
+use FixMyStreet::Map::CheshireEast;
+
+# https://maps-cache.cheshiresharedservices.gov.uk/maps/?wmts/CE_OS_AllBasemaps_COLOUR/oscce_grid/10/10187/8134.jpeg&KEY=3a3f5c60eca1404ea114e6941c9d3895
+my $tiles = FixMyStreet::Map::CheshireEast->map_tiles(x_tile => 10187, y_tile => 8134, zoom_act => 10);
+$tiles = [ map { m{(\d+/\d+/\d+)}; $1; } @$tiles ];
+is_deeply $tiles, [ '10/10186/8133', '10/10187/8133', '10/10186/8134', '10/10187/8134' ];
+
+use Data::Dumper;
+my ($x, $y) = FixMyStreet::Map::CheshireEast->latlon_to_tile_with_adjust(53.150624, -2.386809, 10);
+is $x, 10187;
+is $y, 8134;
+
+my ($lat, $lon) = FixMyStreet::Map::CheshireEast->tile_to_latlon(10187, 8134, 10);
+is sprintf("%.6f", $lat), 53.150624;
+is sprintf("%.6f", $lon), -2.386809;
+
+done_testing();