@@ -21,15 +21,15 @@ function onmainviewGetMaps ($event) {
21
21
// Get original extent from ini file if set
22
22
if (array_key_exists ('extent ' , $ readConfigPath )){
23
23
// 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+
26
30
$ proj4 = new \proj4php \Proj4php ();
27
31
$ sourceProj = new \proj4php \Proj ('EPSG:4326 ' , $ proj4 );
28
32
$ 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 );
33
33
}
34
34
$ extentArraySource = explode (", " , $ readConfigPath ['extent ' ]);
35
35
@@ -39,13 +39,13 @@ function onmainviewGetMaps ($event) {
39
39
$ extentArraySource = array_map ('floatval ' , $ extentArraySource );
40
40
41
41
// 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+
44
47
$ sourceMinPt = new \proj4php \Point (max ($ extentArraySource [0 ], -180.0 ), max ($ extentArraySource [1 ], -85.06 ));
45
48
$ 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 ));
49
49
}
50
50
try {
51
51
$ destMinPt = $ proj4 ->transform ($ sourceProj ,$ destProj ,$ sourceMinPt );
0 commit comments