|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* phpMyAdmin ShapeFile library |
|
4
|
|
|
* <https://github.com/phpmyadmin/shapefile/>. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net> |
|
7
|
|
|
* Copyright 2016 - 2017 Michal Čihař <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software; you can redistribute it and/or |
|
10
|
|
|
* modify it under the terms of the GNU General Public License |
|
11
|
|
|
* as published by the Free Software Foundation. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU General Public License |
|
19
|
|
|
* along with this program; if not, you can download one from |
|
20
|
|
|
* https://www.gnu.org/copyleft/gpl.html. |
|
21
|
|
|
*/ |
|
22
|
|
|
use PhpMyAdmin\ShapeFile\ShapeFile; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Displays content of given file. |
|
26
|
|
|
* |
|
27
|
|
|
* @param string $filename File to open |
|
28
|
|
|
*/ |
|
29
|
|
|
function display_file($filename) |
|
30
|
|
|
{ |
|
31
|
|
|
$shp = new ShapeFile(1); |
|
32
|
|
|
$shp->loadFromFile($filename); |
|
33
|
|
|
|
|
34
|
|
|
$i = 1; |
|
|
|
|
|
|
35
|
|
|
foreach ($shp->records as $i => $record) { |
|
36
|
|
|
echo '<pre>'; |
|
37
|
|
|
echo "Record No. $i:\n\n\n"; |
|
38
|
|
|
// All the data related to the record |
|
39
|
|
|
echo 'SHP Data = '; |
|
40
|
|
|
print_r($record->SHPData); |
|
41
|
|
|
print_r("\n\n\n"); |
|
42
|
|
|
// All the information related to each record |
|
43
|
|
|
echo 'DBF Data = '; |
|
44
|
|
|
print_r($record->DBFData); |
|
45
|
|
|
print_r("\n\n\n"); |
|
46
|
|
|
echo '</pre>'; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
echo "The ShapeFile was completely readed.<br />\n"; |
|
50
|
|
|
echo "Return to the <a href='index.php'>index</a>."; |
|
51
|
|
|
} |
|
52
|
|
|
|