summaryrefslogtreecommitdiff
path: root/navit/script
diff options
context:
space:
mode:
authorJoseph Herlant <herlantj@gmail.com>2018-05-01 23:39:33 -0700
committerJoseph Herlant <aerostitch@users.noreply.github.com>2018-05-01 23:56:56 -0700
commita9f61c26e31eca52b1bf1a444f6283bb26bc2391 (patch)
tree83071a810267c8d104dd155b770a87b0f8375e1e /navit/script
parent24fc7cf03af08f140eec67001f279d68d8ff37a3 (diff)
downloadnavit-a9f61c26e31eca52b1bf1a444f6283bb26bc2391.tar.gz
cleanup:general:Declaring war to control-M
Diffstat (limited to 'navit/script')
-rw-r--r--navit/script/download_index.html290
-rw-r--r--navit/script/mapextract.php450
2 files changed, 370 insertions, 370 deletions
diff --git a/navit/script/download_index.html b/navit/script/download_index.html
index fed33e179..7439f4b6a 100644
--- a/navit/script/download_index.html
+++ b/navit/script/download_index.html
@@ -1,145 +1,145 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Planet Extraction</title>
- <style type="text/css">
- html, body {
- margin: 0;
- padding: 1em;
- font: 0.9em Verdana, Arial, sans serif;
- }
- input, select, textarea {
- font: 1em Verdana, Arial, sans serif;
- }
- .input {
- border: none;
- width: 100px;
- }
- .bbox {
- font-size: 12px;
- color: #000;
- background-color: #fff;
- width: 300px;
- border: 1px solid gray;
- }
- .button {
- width: 200px;
- height: 50px;
- font-weight: bold;
- }
- #map {
- float: left;
- width: 500px;
- height: 500px;
- border: 1px solid gray;
- }
- #controls {
- float: left;
-
- }
- </style>
- <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
- <script type="text/javascript">
- var map, polygonControl, polygonLayer, bbox_set;
-
- OpenLayers.Util.onImageLoadErrorColor = "transparent";
- function init(){
- map = new OpenLayers.Map('map');
-
- var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
-
- polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
-
- map.addLayers([wmsLayer, polygonLayer]);
- map.addControl(new OpenLayers.Control.LayerSwitcher());
- map.addControl(new OpenLayers.Control.MousePosition());
-
- polyOptions = {sides: 4, irregular: true};
- polygonControl = new OpenLayers.Control.DrawFeature(polygonLayer,
- OpenLayers.Handler.RegularPolygon,
- {handlerOptions: polyOptions});
- //alert(polygonControl);
-
- map.addControl(polygonControl);
-
- polygonControl.featureAdded=featureInsert;
-
- map.setCenter(new OpenLayers.LonLat(0, 0), 3);
-
- document.getElementById('noneToggle').checked = true;
- //document.getElementById('irregularToggle').checked = false;
-
- //var polyOptions = {sides: 4, irregular: true};
- //polygonControl.handler.setOptions(polyOptions);
- }
-
- function featureInsert(feature){
- var old=[];
- for (var i = 0; i < polygonLayer.features.length; i++) {
- if (polygonLayer.features[i] != feature) {
- old.push(polygonLayer.features[i]);
- }
- }
- polygonLayer.destroyFeatures(old);
-
- var bounds = feature.geometry.getBounds();
-
- document.form.bounds_top.value = bounds.top;
- document.form.bounds_right.value = bounds.right;
- document.form.bounds_btm.value = bounds.bottom;
- document.form.bounds_left.value = bounds.left;
- bbox_set=true;
- }
- function download() {
- var bbox = document.form.bounds_left.value + "," +
- document.form.bounds_btm.value + "," +
- document.form.bounds_right.value + "," +
- document.form.bounds_top.value;
- if (bbox_set) {
- location.href="http://maps.navit-project.org/api/map?bbox=" + bbox;
- } else {
- alert("Please select a bounding box first\n");
- }
- }
- function setOptions(options) {
- polygonControl.handler.setOptions(options);
- }
- function setSize(fraction) {
- var radius = fraction * map.getExtent().getHeight();
- polygonControl.handler.setOptions({radius: radius,
- angle: 0});
- }
- </script>
- </head>
- <body onload="init()">
- <h2>Planet extract</h2>
- <div id="map"></div>
- <div id="controls">
- <ul style="list-style:none;"><b>Map Controls</b>
- <li>
- <input type="radio" name="type"
- value="none" id="noneToggle"
- onclick="polygonControl.deactivate()"
- checked="checked" />
- <label for="noneToggle">navigate</label>
- </li>
- <li>
- <input type="radio" name="type"
- value="polygon" id="polygonToggle"
- onclick="polygonControl.activate()" />
- <label for="polygonToggle">select</label>
- </li>
- </ul>
- <ul style="list-style:none"><b>Fetch box</b>
- <form name="form">
- <li>Top Right: <input type="text" name="bounds_top" class="input">,
- <input type="text" name="bounds_right" class="input"></li>
- <li>Bottom left: <input type="text" name="bounds_btm" class="input">,
- <input type="text" name="bounds_left" class="input"></li>
- </form>
- <li>&nbsp;</li>
- <li><input type="button" class="button" value="Get map!" onclick="javascript:download()"></li>
- </ul>
- </div>
- </body>
-</html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Planet Extraction</title>
+ <style type="text/css">
+ html, body {
+ margin: 0;
+ padding: 1em;
+ font: 0.9em Verdana, Arial, sans serif;
+ }
+ input, select, textarea {
+ font: 1em Verdana, Arial, sans serif;
+ }
+ .input {
+ border: none;
+ width: 100px;
+ }
+ .bbox {
+ font-size: 12px;
+ color: #000;
+ background-color: #fff;
+ width: 300px;
+ border: 1px solid gray;
+ }
+ .button {
+ width: 200px;
+ height: 50px;
+ font-weight: bold;
+ }
+ #map {
+ float: left;
+ width: 500px;
+ height: 500px;
+ border: 1px solid gray;
+ }
+ #controls {
+ float: left;
+
+ }
+ </style>
+ <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, polygonControl, polygonLayer, bbox_set;
+
+ OpenLayers.Util.onImageLoadErrorColor = "transparent";
+ function init(){
+ map = new OpenLayers.Map('map');
+
+ var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
+
+ polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
+
+ map.addLayers([wmsLayer, polygonLayer]);
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+ map.addControl(new OpenLayers.Control.MousePosition());
+
+ polyOptions = {sides: 4, irregular: true};
+ polygonControl = new OpenLayers.Control.DrawFeature(polygonLayer,
+ OpenLayers.Handler.RegularPolygon,
+ {handlerOptions: polyOptions});
+ //alert(polygonControl);
+
+ map.addControl(polygonControl);
+
+ polygonControl.featureAdded=featureInsert;
+
+ map.setCenter(new OpenLayers.LonLat(0, 0), 3);
+
+ document.getElementById('noneToggle').checked = true;
+ //document.getElementById('irregularToggle').checked = false;
+
+ //var polyOptions = {sides: 4, irregular: true};
+ //polygonControl.handler.setOptions(polyOptions);
+ }
+
+ function featureInsert(feature){
+ var old=[];
+ for (var i = 0; i < polygonLayer.features.length; i++) {
+ if (polygonLayer.features[i] != feature) {
+ old.push(polygonLayer.features[i]);
+ }
+ }
+ polygonLayer.destroyFeatures(old);
+
+ var bounds = feature.geometry.getBounds();
+
+ document.form.bounds_top.value = bounds.top;
+ document.form.bounds_right.value = bounds.right;
+ document.form.bounds_btm.value = bounds.bottom;
+ document.form.bounds_left.value = bounds.left;
+ bbox_set=true;
+ }
+ function download() {
+ var bbox = document.form.bounds_left.value + "," +
+ document.form.bounds_btm.value + "," +
+ document.form.bounds_right.value + "," +
+ document.form.bounds_top.value;
+ if (bbox_set) {
+ location.href="http://maps.navit-project.org/api/map?bbox=" + bbox;
+ } else {
+ alert("Please select a bounding box first\n");
+ }
+ }
+ function setOptions(options) {
+ polygonControl.handler.setOptions(options);
+ }
+ function setSize(fraction) {
+ var radius = fraction * map.getExtent().getHeight();
+ polygonControl.handler.setOptions({radius: radius,
+ angle: 0});
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h2>Planet extract</h2>
+ <div id="map"></div>
+ <div id="controls">
+ <ul style="list-style:none;"><b>Map Controls</b>
+ <li>
+ <input type="radio" name="type"
+ value="none" id="noneToggle"
+ onclick="polygonControl.deactivate()"
+ checked="checked" />
+ <label for="noneToggle">navigate</label>
+ </li>
+ <li>
+ <input type="radio" name="type"
+ value="polygon" id="polygonToggle"
+ onclick="polygonControl.activate()" />
+ <label for="polygonToggle">select</label>
+ </li>
+ </ul>
+ <ul style="list-style:none"><b>Fetch box</b>
+ <form name="form">
+ <li>Top Right: <input type="text" name="bounds_top" class="input">,
+ <input type="text" name="bounds_right" class="input"></li>
+ <li>Bottom left: <input type="text" name="bounds_btm" class="input">,
+ <input type="text" name="bounds_left" class="input"></li>
+ </form>
+ <li>&nbsp;</li>
+ <li><input type="button" class="button" value="Get map!" onclick="javascript:download()"></li>
+ </ul>
+ </div>
+ </body>
+</html>
diff --git a/navit/script/mapextract.php b/navit/script/mapextract.php
index 004b63caf..33441ba95 100644
--- a/navit/script/mapextract.php
+++ b/navit/script/mapextract.php
@@ -1,225 +1,225 @@
-#!/usr/local/bin/php &#8211;q
-<?php
-function getmercator($sx,$sy,$ex,$ey) {
-
- $sx = $sx*6371000.0*M_PI/180;
- $sy = log(tan(M_PI_4+$sy*M_PI/360))*6371000.0;
-
- $ex = $ex*6371000.0*M_PI/180;
- $ey = log(tan(M_PI_4+$ey*M_PI/360))*6371000.0;
-
- return array(
- 'l' => array(
- 'x' => $sx,
- 'y' => $sy
- ),
- 'h' => array(
- 'x' => $ex,
- 'y' => $ey
- )
- );
-
-}
-function contains_bbox($c, &$r) {
- if ($c['l']['x'] > $r['h']['x'])
- return false;
- elseif ($c['h']['x'] < $r['l']['x'])
- return false;
- elseif ($c['l']['y'] > $r['h']['y'])
- return false;
- elseif ($c['h']['y'] < $r['l']['y'])
- return false;
- else
- return true;
-}
-
-$fetch_bbox = getmercator(11.3, 47.9, 11.4, 48.0);
-
-$files = array();
-$files['input'] = '/home/burner/carputer/navit/src/maps/osm_bbox_11.3,47.9,11.7,48.2.bin';
-$files['output'] = 'myarea.bin';
-
-$formats = array();
-$formats['ziphpack'] = "lssssslLLSS";
-$formats['zipheader'] = "l" . "ziplocsig"; # Signature (is always the same)
-$formats['zipheader'] .= "/s" . "zipver"; # zip version needed
-$formats['zipheader'] .= "/s" . "zipgenfld";# type of os that generated the file
-$formats['zipheader'] .= "/s" . "zipmthd"; #
-$formats['zipheader'] .= "/s" . "ziptime"; # time
-$formats['zipheader'] .= "/s" . "zipdate"; # date
-$formats['zipheader'] .= "/l" . "zipcrc"; # crc checksum
-$formats['zipheader'] .= "/L" . "zipsize"; # data size
-$formats['zipheader'] .= "/L" . "zipuncmp"; # uncompressed size
-$formats['zipheader'] .= "/S" . "zipfnln"; # length of filename
-$formats['zipheader'] .= "/S" . "zipxtraln";# length of extra data (always 0)
-
-$formats['zipcd'] = "".
- "i" . "zipcensig/".
- "c" . "zipcver/".
- "c" . "zipcos/".
- "c" . "zipcvxt/".
- "c" . "zipcexos/".
- "s" . "zipcflg/".
- "s" . "zipcmthd/".
- "s" . "ziptim/".
- "s" . "zipdat/".
- "i" . "zipccrc/".
- "I" . "zipcsiz/".
- "I" . "zipcunc/".
- "S" . "zipcfnl/".
- "S" . "zipcxtl/".
- "S" . "zipccml/".
- "S" . "zipdsk/".
- "S" . "zipint/".
- "I" . "zipext/".
- "I" . "zipofst/".
-$formats['zipcdpack'] = "iccccssssiIISSSSSII";
-
-$formats['zipcontent'] = "i5x/i5y/ii";
-
-$world_bbox = array();
-$world_bbox['l']['x'] = -20000000;
-$world_bbox['l']['y'] = -20000000;
-$world_bbox['h']['x'] = 20000000;
-$world_bbox['h']['y'] = 20000000;
-
-$fp = fopen($files['input'], 'r');
-$sp = fopen($files['output'], 'w');
-
-$files = array();
-$offset = 0;
-
-/**
- * Read through zipheaders
- *
- */
-while (!feof($fp)) {
-
- $buffer = fread($fp, 30);
- $tileinfo = unpack($formats['zipheader'], $buffer);
-
- if ($tileinfo['zipfnln'] <= 0)
- break;
-
- $filename = fread($fp, $tileinfo['zipfnln']);
- $x=0;
- $done=false;
-
- $r = $world_bbox;
-
- while (!$done) {
- $c['x'] = floor( ($r['l']['x'] + $r['h']['x'])/2 );
- $c['y'] = floor( ($r['l']['y'] + $r['h']['y'])/2 );
-
- switch($filename[$x]) {
- case 'a':
- $r['l']['x'] = $c['x'];
- $r['l']['y'] = $c['y'];
- break;
- case 'b':
- $r['h']['x'] = $c['x'];
- $r['l']['y'] = $c['y'];
- break;
- case 'c':
- $r['l']['x'] = $c['x'];
- $r['h']['y'] = $c['y'];
- break;
- case 'd':
- $r['h']['x'] = $c['x'];
- $r['h']['y'] = $c['y'];
- break;
- default:
- $done=true;
- }
- $x++;
- }
-
- $tilecontent = fread($fp, $tileinfo['zipsize']);
-
- /* Area inside box, save it! */
- if (contains_bbox($fetch_bbox, $r)) {
- #echo "In box. ";
- #echo $filename . " ";
- $zipheader = $buffer;
- #echo "\n";
-
- /* Area outside of box, set zipcontent=0 */
- } else {
- $tileinfo['zipmthd'] = $tileinfo['zipcrc'] = $tileinfo['zipsize'] = $tileinfo['zipuncmp'] = 0;
- #echo "Out of box";
- $zipheader = $tileinfo;
- $tilecontent = '';
- $zipheader = pack($formats['ziphpack'],
- $tileinfo['ziplocsig'],
- $tileinfo['zipver'],
- $tileinfo['zipgenfld'],
- $tileinfo['zipmthd'],
- $tileinfo['ziptime'],
- $tileinfo['zipdate'],
- $tileinfo['zipcrc'],
- $tileinfo['zipsize'],
- $tileinfo['zipuncmp'],
- $tileinfo['zipfnln'],
- $tileinfo['zipxtraln']
- );
- }
-
- $put = $zipheader.$filename.$tilecontent;
- $files[$filename]['header'] = $tileinfo;
- $files[$filename]['size'] = strlen($put);
-
- $zipcd = array();
- $zipcd['zipcensig'] = 0x02014b50;
- $zipcd['zipcver'] = $tileinfo['zipver'];
- $zipcd['zipcos'] = 0x00;
- $zipcd['zipcvxt'] = 0x0a;
- $zipcd['zipcexos'] = 0x00;
- $zipcd['zipcflg'] = 0x00;
- $zipcd['zipcmthd'] = $tileinfo['zipmthd'];
- $zipcd['ziptim'] = $tileinfo['ziptime'];
- $zipcd['zipdat'] = $tileinfo['zipdate'];
- $zipcd['zipccrc'] = $tileinfo['zipcrc'];
- $zipcd['zipcsiz'] = $tileinfo['zipsize'];
- $zipcd['zipcunc'] = $tileinfo['zipuncmp'];
- $zipcd['zipcfnl'] = $tileinfo['zipfnln'];
- $zipcd['zipcxtl'] = 0x00;
- $zipcd['zipccml'] = 0x00;
- $zipcd['zipdsk'] = 0x00;
- $zipcd['zipint'] = 0x00;
- $zipcd['zipext'] = 0x00;
- $zipcd['zipofst'] = $offset;
-
- $zipcd_data .= pack($formats['zipcdpack'],
- $zipcd['zipcensig'],
- $zipcd['zipcver'],
- $zipcd['zipcos'],
- $zipcd['zipcvxt'],
- $zipcd['zipcexos'],
- $zipcd['zipcflg'],
- $zipcd['zipcmthd'],
- $zipcd['ziptim'],
- $zipcd['zipdat'],
- $zipcd['zipccrc'],
- $zipcd['zipcsiz'],
- $zipcd['zipcunc'],
- $zipcd['zipcfnl'],
- $zipcd['zipcxtl'],
- $zipcd['zipccml'],
- $zipcd['zipdsk'],
- $zipcd['zipint'],
- $zipcd['zipext'],
- $zipcd['zipofst']
- ) . $filename;
-
-
- fwrite($sp, $put);
- $offset += strlen($put);
-
-}
-
-fwrite($sp, $zipcd_data);
-
-fclose($fp);
-fclose($sp);
-
-?>
+#!/usr/local/bin/php &#8211;q
+<?php
+function getmercator($sx,$sy,$ex,$ey) {
+
+ $sx = $sx*6371000.0*M_PI/180;
+ $sy = log(tan(M_PI_4+$sy*M_PI/360))*6371000.0;
+
+ $ex = $ex*6371000.0*M_PI/180;
+ $ey = log(tan(M_PI_4+$ey*M_PI/360))*6371000.0;
+
+ return array(
+ 'l' => array(
+ 'x' => $sx,
+ 'y' => $sy
+ ),
+ 'h' => array(
+ 'x' => $ex,
+ 'y' => $ey
+ )
+ );
+
+}
+function contains_bbox($c, &$r) {
+ if ($c['l']['x'] > $r['h']['x'])
+ return false;
+ elseif ($c['h']['x'] < $r['l']['x'])
+ return false;
+ elseif ($c['l']['y'] > $r['h']['y'])
+ return false;
+ elseif ($c['h']['y'] < $r['l']['y'])
+ return false;
+ else
+ return true;
+}
+
+$fetch_bbox = getmercator(11.3, 47.9, 11.4, 48.0);
+
+$files = array();
+$files['input'] = '/home/burner/carputer/navit/src/maps/osm_bbox_11.3,47.9,11.7,48.2.bin';
+$files['output'] = 'myarea.bin';
+
+$formats = array();
+$formats['ziphpack'] = "lssssslLLSS";
+$formats['zipheader'] = "l" . "ziplocsig"; # Signature (is always the same)
+$formats['zipheader'] .= "/s" . "zipver"; # zip version needed
+$formats['zipheader'] .= "/s" . "zipgenfld";# type of os that generated the file
+$formats['zipheader'] .= "/s" . "zipmthd"; #
+$formats['zipheader'] .= "/s" . "ziptime"; # time
+$formats['zipheader'] .= "/s" . "zipdate"; # date
+$formats['zipheader'] .= "/l" . "zipcrc"; # crc checksum
+$formats['zipheader'] .= "/L" . "zipsize"; # data size
+$formats['zipheader'] .= "/L" . "zipuncmp"; # uncompressed size
+$formats['zipheader'] .= "/S" . "zipfnln"; # length of filename
+$formats['zipheader'] .= "/S" . "zipxtraln";# length of extra data (always 0)
+
+$formats['zipcd'] = "".
+ "i" . "zipcensig/".
+ "c" . "zipcver/".
+ "c" . "zipcos/".
+ "c" . "zipcvxt/".
+ "c" . "zipcexos/".
+ "s" . "zipcflg/".
+ "s" . "zipcmthd/".
+ "s" . "ziptim/".
+ "s" . "zipdat/".
+ "i" . "zipccrc/".
+ "I" . "zipcsiz/".
+ "I" . "zipcunc/".
+ "S" . "zipcfnl/".
+ "S" . "zipcxtl/".
+ "S" . "zipccml/".
+ "S" . "zipdsk/".
+ "S" . "zipint/".
+ "I" . "zipext/".
+ "I" . "zipofst/".
+$formats['zipcdpack'] = "iccccssssiIISSSSSII";
+
+$formats['zipcontent'] = "i5x/i5y/ii";
+
+$world_bbox = array();
+$world_bbox['l']['x'] = -20000000;
+$world_bbox['l']['y'] = -20000000;
+$world_bbox['h']['x'] = 20000000;
+$world_bbox['h']['y'] = 20000000;
+
+$fp = fopen($files['input'], 'r');
+$sp = fopen($files['output'], 'w');
+
+$files = array();
+$offset = 0;
+
+/**
+ * Read through zipheaders
+ *
+ */
+while (!feof($fp)) {
+
+ $buffer = fread($fp, 30);
+ $tileinfo = unpack($formats['zipheader'], $buffer);
+
+ if ($tileinfo['zipfnln'] <= 0)
+ break;
+
+ $filename = fread($fp, $tileinfo['zipfnln']);
+ $x=0;
+ $done=false;
+
+ $r = $world_bbox;
+
+ while (!$done) {
+ $c['x'] = floor( ($r['l']['x'] + $r['h']['x'])/2 );
+ $c['y'] = floor( ($r['l']['y'] + $r['h']['y'])/2 );
+
+ switch($filename[$x]) {
+ case 'a':
+ $r['l']['x'] = $c['x'];
+ $r['l']['y'] = $c['y'];
+ break;
+ case 'b':
+ $r['h']['x'] = $c['x'];
+ $r['l']['y'] = $c['y'];
+ break;
+ case 'c':
+ $r['l']['x'] = $c['x'];
+ $r['h']['y'] = $c['y'];
+ break;
+ case 'd':
+ $r['h']['x'] = $c['x'];
+ $r['h']['y'] = $c['y'];
+ break;
+ default:
+ $done=true;
+ }
+ $x++;
+ }
+
+ $tilecontent = fread($fp, $tileinfo['zipsize']);
+
+ /* Area inside box, save it! */
+ if (contains_bbox($fetch_bbox, $r)) {
+ #echo "In box. ";
+ #echo $filename . " ";
+ $zipheader = $buffer;
+ #echo "\n";
+
+ /* Area outside of box, set zipcontent=0 */
+ } else {
+ $tileinfo['zipmthd'] = $tileinfo['zipcrc'] = $tileinfo['zipsize'] = $tileinfo['zipuncmp'] = 0;
+ #echo "Out of box";
+ $zipheader = $tileinfo;
+ $tilecontent = '';
+ $zipheader = pack($formats['ziphpack'],
+ $tileinfo['ziplocsig'],
+ $tileinfo['zipver'],
+ $tileinfo['zipgenfld'],
+ $tileinfo['zipmthd'],
+ $tileinfo['ziptime'],
+ $tileinfo['zipdate'],
+ $tileinfo['zipcrc'],
+ $tileinfo['zipsize'],
+ $tileinfo['zipuncmp'],
+ $tileinfo['zipfnln'],
+ $tileinfo['zipxtraln']
+ );
+ }
+
+ $put = $zipheader.$filename.$tilecontent;
+ $files[$filename]['header'] = $tileinfo;
+ $files[$filename]['size'] = strlen($put);
+
+ $zipcd = array();
+ $zipcd['zipcensig'] = 0x02014b50;
+ $zipcd['zipcver'] = $tileinfo['zipver'];
+ $zipcd['zipcos'] = 0x00;
+ $zipcd['zipcvxt'] = 0x0a;
+ $zipcd['zipcexos'] = 0x00;
+ $zipcd['zipcflg'] = 0x00;
+ $zipcd['zipcmthd'] = $tileinfo['zipmthd'];
+ $zipcd['ziptim'] = $tileinfo['ziptime'];
+ $zipcd['zipdat'] = $tileinfo['zipdate'];
+ $zipcd['zipccrc'] = $tileinfo['zipcrc'];
+ $zipcd['zipcsiz'] = $tileinfo['zipsize'];
+ $zipcd['zipcunc'] = $tileinfo['zipuncmp'];
+ $zipcd['zipcfnl'] = $tileinfo['zipfnln'];
+ $zipcd['zipcxtl'] = 0x00;
+ $zipcd['zipccml'] = 0x00;
+ $zipcd['zipdsk'] = 0x00;
+ $zipcd['zipint'] = 0x00;
+ $zipcd['zipext'] = 0x00;
+ $zipcd['zipofst'] = $offset;
+
+ $zipcd_data .= pack($formats['zipcdpack'],
+ $zipcd['zipcensig'],
+ $zipcd['zipcver'],
+ $zipcd['zipcos'],
+ $zipcd['zipcvxt'],
+ $zipcd['zipcexos'],
+ $zipcd['zipcflg'],
+ $zipcd['zipcmthd'],
+ $zipcd['ziptim'],
+ $zipcd['zipdat'],
+ $zipcd['zipccrc'],
+ $zipcd['zipcsiz'],
+ $zipcd['zipcunc'],
+ $zipcd['zipcfnl'],
+ $zipcd['zipcxtl'],
+ $zipcd['zipccml'],
+ $zipcd['zipdsk'],
+ $zipcd['zipint'],
+ $zipcd['zipext'],
+ $zipcd['zipofst']
+ ) . $filename;
+
+
+ fwrite($sp, $put);
+ $offset += strlen($put);
+
+}
+
+fwrite($sp, $zipcd_data);
+
+fclose($fp);
+fclose($sp);
+
+?>