-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert-test.php
26 lines (16 loc) · 2 KB
/
convert-test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
ini_set('display_errors', 1);
include_once(".system/vendor/jsor/proj4php/src/proj4php/proj4php.php");
$proj4 = new Proj4php();
Proj4php::$defs["EPSG:5850"] = "+proj=tmerc +lat_0=0 +lon_0=18 +k=1 +x_0=150000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";
$projSthlm = new Proj4phpProj('EPSG:5850',$proj4);
$projWGS84 = new Proj4phpProj('EPSG:4326',$proj4);
$points = "143431.01509,6583552.87272,0.0 143430.78771,6583549.88274,0.0 143431.45028,6583546.95355,0.0 143432.96257,6583544.36501,0.0 143456.26558,6583518.51663,0.0 143458.94681,6583517.16898,0.0 143461.90727,6583516.69151,0.0 143464.87695,6583517.12397,0.0 143469.44525,6583519.15766,0.0 143481.74234,6583511.28859,0.0 143473.38362,6583498.23261,0.0 143455.27316,6583509.82648,0.0 143449.92912,6583514.34164,0.0 143423.53306,6583543.61717,0.0 143420.09082,6583546.11408,0.0 143416.19925,6583547.83066,0.0 143412.03842,6583548.6971,0.0 143407.78838,6583548.65353,0.0 143375.96401,6583541.58738,0.0 143374.0052,6583540.19584,0.0 143372.84701,6583538.09504,0.0 143372.6491,6583535.70506,0.0 143377.87326,6583496.75254,0.0 143403.38264,6583497.96388,0.0 143481.43736,6583471.24153,0.0 143498.39653,6583483.96476,0.0 143525.35017,6583526.07404,0.0 143459.92241,6583625.11125,0.0 143413.44188,6583647.67043,0.0 143355.70975,6583568.9282,0.0 143364.83396,6583552.86714,0.0 143366.09578,6583550.80836,0.0 143368.04717,6583549.25014,0.0 143370.42789,6583548.48218,0.0 143372.92782,6583548.60427,0.0 143412.51083,6583557.3868,0.0 143414.67017,6583558.17855,0.0 143416.39887,6583559.69989,0.0 143417.4371,6583561.75059,0.0 143418.83292,6583566.55138,0.0 143433.72695,6583562.24423,0.0 143431.01509,6583552.87272,0.0";
foreach(explode(' ', $points) as $point){
$point = explode(',', $point);
$pointSrc = new proj4phpPoint($point[0],$point[1]);
$point = $proj4->transform($projSthlm,$projWGS84,$pointSrc);
$point = $point->toShortString();
$point = explode(' ', $point);
echo "[$point[1], $point[0]],<br>";
}