/[flash]/openlayers/pdf2tiles.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /openlayers/pdf2tiles.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 17 by dpavlin, Sun Feb 24 12:30:19 2008 UTC revision 18 by dpavlin, Sun Feb 24 12:41:41 2008 UTC
# Line 15  my $pdf = shift @ARGV || die "usage: $0 Line 15  my $pdf = shift @ARGV || die "usage: $0
15  my $limit = '';  my $limit = '';
16  $limit = '-f 1 -l 1';  $limit = '-f 1 -l 1';
17    
18    my $tiles_path = 'tiles/basic';
19    rmtree $tiles_path if -d $tiles_path;
20    mkpath $tiles_path || die "can't create $tiles_path: $!";
21    
22  foreach my $zoom ( 1 .. 12 ) {  foreach my $zoom ( 1 .. 12 ) {
23    
24          my $dpi = $zoom * 25;          my $dpi = $zoom * 15;
25    
26          my $ppm = "tmp-$dpi";          my $ppm = "tmp-$dpi";
27          my $tmp = "$ppm-000001.ppm";          my $tmp = "$ppm-000001.ppm";
# Line 39  foreach my $zoom ( 1 .. 12 ) { Line 43  foreach my $zoom ( 1 .. 12 ) {
43          my $tiles_x = int( $x_size / 256 );          my $tiles_x = int( $x_size / 256 );
44          my $tiles_y = int( $y_size / 256 );          my $tiles_y = int( $y_size / 256 );
45    
46          print "creating in $tiles_x*$tiles_y tiles...\n";          print "creating in $tiles_x*$tiles_y tiles\n";
47    
48          for my $y ( 0 .. $tiles_y ) {          for my $y ( 0 .. $tiles_y ) {
49                  for my $x ( 0 .. $tiles_x ) {                  for my $x ( 0 .. $tiles_x ) {
# Line 65  foreach my $zoom ( 1 .. 12 ) { Line 69  foreach my $zoom ( 1 .. 12 ) {
69                          }                          }
70    
71                          # emulate TileCache disk layout                          # emulate TileCache disk layout
72                          my $path = sprintf("tiles/basic/%02d/%03d/%03d/%03d/%03d/%03d/%03d.png",                          my $path = sprintf("%s/%02d/%03d/%03d/%03d/%03d/%03d/%03d.png",
73                                    $tiles_path,
74                                  $zoom - 1,      # starts with 0                                  $zoom - 1,      # starts with 0
75                                  int( $x / 1000000 ),                                  int( $x / 1000000 ),
76                                  int( $x / 1000 ) % 1000,                                  int( $x / 1000 ) % 1000,

Legend:
Removed from v.17  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.26