source: subversion/applications/utils/export/CityKML/package.pl @ 27053

Last change on this file since 27053 was 1935, checked in by dirkl, 13 years ago

Zip should work now (hack necessary)

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/perl
2use File::Copy;
3
4#----------------------------------------------------------------
5# Packages KML files and their associated icons into zipped KMZ files
6#
7# Oliver White, 2007, GNU GPL v2 or later
8#----------------------------------------------------------------
9
10$KmlDir = "output";
11opendir(DIR, $KmlDir) || die("Can't read directory $KmlDir ($!)  have you created KML files? (use run.pl)\n");
12
13while($File = readdir(DIR)){
14 
15  $KML = "$KmlDir/$File";
16  if($File =~ /(\d+)\.kml/){
17    $i = $1;
18   
19    # Icons etc.
20    $FilesDir = "osmgoogleearth";
21   
22    # Place for ZIP to work
23    $TempDir = "temp";
24   
25    # Output
26    $Output = "output_packaged/$i.kmz";
27   
28    # Move all relevant files to a temporary directory, and ZIP them
29    mkdir $TempDir;
30    copy($KML, "$TempDir/doc.kml");
31   
32    if(1){ # Sorry, zip is too crap...
33      mkdir "$TempDir/icons";
34      `cp $FilesDir/icons/*.png $TempDir/icons`;
35    }
36   
37    `cp $FilesDir/*.png $TempDir/`;
38   
39    chdir $TempDir;
40
41    `zip -r ../$Output *`;
42
43    chdir ".." ;
44   
45    print "Done $Output\n";
46   
47  }
48}
Note: See TracBrowser for help on using the repository browser.