source: subversion/applications/utils/osm-extract/polygons/poly2bb.pl @ 29411

Last change on this file since 29411 was 18299, checked in by frederik, 10 years ago

small script to compute polygon file's bbox

  • Property svn:executable set to *
File size: 552 bytes
Line 
1#!/usr/bin/perl
2
3# script to extract a polygon file's bbox
4# output is in a form suitable for the Osmosis "--bb" task.
5
6# written by Frederik Ramm <frederik@remote.org>, public domain.
7
8$maxx = -360;
9$maxy = -360;
10$minx = 360;
11$miny = 360;
12
13while(<>)
14{
15   if (/^\s+([0-9.E+-]+)\s+([0-9.E+-]+)\s*$/)
16   {
17       my ($x, $y) = ($1, $2);
18       $maxx = $x if ($x>$maxx);
19       $maxy = $y if ($y>$maxy);
20       $minx = $x if ($x<$minx);
21       $miny = $y if ($y<$miny);
22   }
23}
24
25printf "left=%f right=%f top=%f bottom=%f\n",
26   $minx, $maxx, $maxy, $miny;
Note: See TracBrowser for help on using the repository browser.