@@ -5,14 +5,14 @@ |
||
5 | 5 | $shp->loadFromFile('data/capitals.*'); |
6 | 6 | |
7 | 7 | $i = 1; |
8 | -foreach($shp->records as $record){ |
|
8 | +foreach ($shp->records as $record) { |
|
9 | 9 | echo "<pre>"; |
10 | 10 | echo "Record No. $i:\n\n\n"; |
11 | 11 | echo "SHP Data = "; |
12 | - print_r($record->SHPData); //All the data related to the point |
|
12 | + print_r($record->SHPData); //All the data related to the point |
|
13 | 13 | print_r("\n\n\n"); |
14 | 14 | echo "DBF Data = "; |
15 | - print_r($record->DBFData); //All the information related to each point |
|
15 | + print_r($record->DBFData); //All the information related to each point |
|
16 | 16 | print_r("\n\n\n"); |
17 | 17 | echo "</pre>"; |
18 | 18 | $i++; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | function swap($binValue) { |
38 | 38 | $result = $binValue{strlen($binValue) - 1}; |
39 | - for($i = strlen($binValue) - 2; $i >= 0 ; $i--) { |
|
39 | + for ($i = strlen($binValue) - 2; $i >= 0; $i--) { |
|
40 | 40 | $result .= $binValue{$i}; |
41 | 41 | } |
42 | 42 | |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | function packDouble($value, $mode = 'LE') { |
47 | - $value = (double)$value; |
|
47 | + $value = (double) $value; |
|
48 | 48 | $bin = pack("d", $value); |
49 | 49 | |
50 | 50 | //We test if the conversion of an integer (1) is done as LE or BE by default |
51 | - switch (pack ('L', 1)) { |
|
52 | - case pack ('V', 1): //Little Endian |
|
51 | + switch (pack('L', 1)) { |
|
52 | + case pack('V', 1): //Little Endian |
|
53 | 53 | $result = ($mode == 'LE') ? $bin : swap($bin); |
54 | 54 | break; |
55 | - case pack ('N', 1): //Big Endian |
|
55 | + case pack('N', 1): //Big Endian |
|
56 | 56 | $result = ($mode == 'BE') ? $bin : swap($bin); |
57 | 57 | break; |
58 | 58 | default: //Some other thing, we just return false |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | fwrite($this->SHPFile, pack("dddd", 0, 0, 0, 0)); |
234 | 234 | |
235 | 235 | fwrite($this->SHXFile, pack("NNNNNN", 9994, 0, 0, 0, 0, 0)); |
236 | - fwrite($this->SHXFile, pack("N", 50 + 4*count($this->records))); |
|
236 | + fwrite($this->SHXFile, pack("N", 50 + 4 * count($this->records))); |
|
237 | 237 | fwrite($this->SHXFile, pack("V", 1000)); |
238 | 238 | fwrite($this->SHXFile, pack("V", $this->shapeType)); |
239 | 239 | fwrite($this->SHXFile, packDouble($this->boundingBox['xmin'])); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | - fseek($this->SHPFile, $firstIndex + ($readPoints*16)); |
|
525 | + fseek($this->SHPFile, $firstIndex + ($readPoints * 16)); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | function _savePolyLineRecord() { |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | fwrite($this->SHPFile, pack("V", count($this->SHPData["parts"][$i]))); |
535 | 535 | } |
536 | 536 | |
537 | - foreach ($this->SHPData["parts"] as $partData){ |
|
537 | + foreach ($this->SHPData["parts"] as $partData) { |
|
538 | 538 | reset($partData["points"]); |
539 | 539 | while (list($pointIndex, $pointData) = each($partData["points"])) { |
540 | 540 | $this->_savePoint($pointData); |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | break; |
639 | 639 | case 3: |
640 | 640 | case 5: |
641 | - $result = 22 + 2*count($this->SHPData["parts"]); |
|
641 | + $result = 22 + 2 * count($this->SHPData["parts"]); |
|
642 | 642 | for ($i = 0; $i < count($this->SHPData["parts"]); $i++) { |
643 | - $result += 8*count($this->SHPData["parts"][$i]["points"]); |
|
643 | + $result += 8 * count($this->SHPData["parts"][$i]["points"]); |
|
644 | 644 | } |
645 | 645 | break; |
646 | 646 | case 8: |
647 | - $result = 20 + 8*count($this->SHPData["points"]); |
|
647 | + $result = 20 + 8 * count($this->SHPData["points"]); |
|
648 | 648 | break; |
649 | 649 | default: |
650 | 650 | $result = false; |
@@ -5,14 +5,14 @@ |
||
5 | 5 | $shp->loadFromFile('data/mexico.*'); |
6 | 6 | |
7 | 7 | $i = 1; |
8 | -foreach($shp->records as $record){ |
|
8 | +foreach ($shp->records as $record) { |
|
9 | 9 | echo "<pre>"; |
10 | 10 | echo "Record No. $i:\n\n\n"; |
11 | 11 | echo "SHP Data = "; |
12 | - print_r($record->SHPData); //All the data related to the poligon |
|
12 | + print_r($record->SHPData); //All the data related to the poligon |
|
13 | 13 | print_r("\n\n\n"); |
14 | 14 | echo "DBF Data = "; |
15 | - print_r($record->DBFData); //All the information related to each poligon |
|
15 | + print_r($record->DBFData); //All the information related to each poligon |
|
16 | 16 | print_r("\n\n\n"); |
17 | 17 | echo "</pre>"; |
18 | 18 | $i++; |