source: subversion/utils/CityKML/run.pl @ 1930

Last change on this file since 1930 was 1930, checked in by ojw, 13 years ago

Package KML files into KMZ zipped files (with icons etc.)

  • Property svn:executable set to *
File size: 866 bytes
Line 
1#!/usr/bin/perl
2use File::Copy;
3
4#----------------------------------------------------------------
5# Convert city OSM files (from http://almien.co.uk/OSM/Places)
6# to KML files, using the OsmGoogleEarth converter
7#
8# Oliver White, 2007, GNU GPL v2 or later
9#----------------------------------------------------------------
10
11# Search for a file to convert
12for($i = 1; 1; $i++){
13  $GZip = "data/data_$i.osm.gz";
14  $TempDir = "osmgoogleearth";
15  $Data = "$TempDir/data.osm";
16  $DataG = "$Data.gz";
17  $Output = "output/$i.kml";
18
19  # If reached end of input files, exit
20  exit if(!-f $GZip);
21 
22  # If input file exists, but output doesn't
23  if((-f $GZip && ! -f $Output) || (-s $Output == 0)){
24 
25    # Transform OSM to KML
26    copy($GZip, $DataG);
27    `gunzip $DataG`;
28    `xmlstarlet tr $TempDir/osm2kml.xsl $TempDir/osm2kml.xml > $Output`;
29    unlink($Data);
30  }
31}
32
Note: See TracBrowser for help on using the repository browser.