source: subversion/applications/rendering/tilesAtHome/debugHelper.pl @ 13020

Last change on this file since 13020 was 13020, checked in by matthiasj, 11 years ago

Merge -dev r12273

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/usr/bin/perl
2#-------------------------------------------------------------
3# OpenStreetMap tiles@home
4#
5# Contact Deelkar on the Openstreetmap wiki for help using this program
6#-----------------------------------------------------------------------------
7# Copyright 2008, Dirk-Lueder Kreie and others
8#
9# This program is free software; you can redistribute it and/or
10# modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation; either version 2
12# of the License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22#-----------------------------------------------------------------------------
23
24use strict;
25use lib './lib';
26use tahlib;
27use TahConf;
28use English '-no_match_vars';
29use tahproject;
30
31
32our $Mode = shift() || '';
33
34my $Config;
35my %EnvironmentInfo;
36
37$Config = TahConf->getConfig();
38%EnvironmentInfo = $Config->CheckConfig();
39
40if ($Mode eq "getbbox")
41{
42    my $X = shift();
43    my $Y = shift();
44    my $Z = shift() || 12;
45
46    my ($N,$E,$S,$W) = ProjectXY($Z, $X, $Y);
47
48    my $N1 = $N + ($N - $S) * $Config->get("BorderNS");
49    my $S1 = $S - ($N - $S) * $Config->get("BorderNS");
50    my $E1 = $E + ($E - $W) * $Config->get("BorderWE");
51    my $W1 = $W - ($E - $W) * $Config->get("BorderWE");
52
53    print "\n";
54    print "tilearea for $X,$Y zoom $Z is\n";
55    print "  in left,bottom,right,top order: bbox=$W,$S,$E,$N \n";
56    print "  coordinates: N=$N, S=$S, W=$W, E=$E \n\n";
57
58    print "downloaded area for $X,$Y zoom $Z is\n";
59    print "  in left,bottom,right,top order: bbox=$W1,$S1,$E1,$N1 \n";
60    print "  coordinates: N=$N1, S=$S1, W=$W1, E=$E1)\n\n";
61}
62elsif ($Mode eq "center")
63{
64    my $X = shift();
65    my $Y = shift();
66    my $Z = shift() || 12;
67
68    my ($N,$E,$S,$W) = ProjectXY($Z, $X, $Y);
69
70    my $lat = ($W + $E) / 2;
71    my $lon = ($N + $S) / 2;
72
73    print "bbox center for tile $X,$Y zoom $Z is\n";
74    print "  in lat,lon order: $lat,$lon \n\n";
75
76    # lat stays the same
77    (undef,$lon) = Project($Y*2, $Z+1);
78
79    print "center of rendered (projected) tile is\n";
80    print "  in lat,lon order: $lat,$lon \n\n";
81}
82else
83{
84    usage();
85}
86
87sub usage
88{
89   print "perl debugHelper.pl <mode> <X> <Y> [Zoom]\n";
90   print "where <mode> one of \"getbbox\", \"center\"\n";
91   exit 1;
92}
Note: See TracBrowser for help on using the repository browser.