Skip to content

Commit 332d950

Browse files
committed
Fix regression
1 parent 6ff19a9 commit 332d950

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

mapBuilder/classes/mapBuilderView.listener.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ function onmainviewGetMaps ($event) {
2121
// Get original extent from ini file if set
2222
if(array_key_exists('extent', $readConfigPath)){
2323
// Reproject extent in ini file from EPSG:4326 to EPSG:3857.
24-
if (! class_exists('Proj4phpProj') ) {
25-
// proj4php > 2.0
24+
if (class_exists('Proj4php') ) { // lizmap 3.6
25+
$proj4 = new \Proj4php();
26+
$sourceProj = new \Proj4Proj('EPSG:4326', $proj4);
27+
$destProj = new \Proj4Proj('EPSG:3857', $proj4);
28+
} else {
29+
// proj4php > 2.0, lizmap 3.7+
2630
$proj4 = new \proj4php\Proj4php();
2731
$sourceProj = new \proj4php\Proj('EPSG:4326', $proj4);
2832
$destProj = new \proj4php\Proj('EPSG:3857', $proj4);
29-
} else {
30-
$proj4 = new Proj4php();
31-
$sourceProj = new Proj4Proj('EPSG:4326', $proj4);
32-
$destProj = new Proj4Proj('EPSG:3857', $proj4);
3333
}
3434
$extentArraySource = explode(",", $readConfigPath['extent']);
3535

@@ -39,13 +39,13 @@ function onmainviewGetMaps ($event) {
3939
$extentArraySource = array_map('floatval', $extentArraySource);
4040

4141
// Handle WGS84 bounds
42-
if (! class_exists('Proj4phpPoint') ) {
43-
// proj4php >2.0
42+
if (class_exists('proj4phpPoint') ) { // lizmap 3.6
43+
$sourceMinPt = new \proj4phpPoint(max($extentArraySource[0], -180.0), max($extentArraySource[1], -85.06));
44+
$sourceMaxPt = new \proj4phpPoint(min($extentArraySource[2], 180.0), min($extentArraySource[3], 85.06));
45+
} else {
46+
// proj4php >2.0, lizmap 3.7+
4447
$sourceMinPt = new \proj4php\Point(max($extentArraySource[0], -180.0), max($extentArraySource[1], -85.06));
4548
$sourceMaxPt = new \proj4php\Point(min($extentArraySource[2], 180.0), min($extentArraySource[3], 85.06));
46-
} else {
47-
$sourceMinPt = new Proj4phpPoint(max($extentArraySource[0], -180.0), max($extentArraySource[1], -85.06));
48-
$sourceMaxPt = new Proj4phpPoint(min($extentArraySource[2], 180.0), min($extentArraySource[3], 85.06));
4949
}
5050
try {
5151
$destMinPt = $proj4->transform($sourceProj,$destProj,$sourceMinPt);

0 commit comments

Comments
 (0)