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