Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Skeye
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sorgre
Skeye
Commits
582c7c74
Commit
582c7c74
authored
Nov 16, 2020
by
s192327
Browse files
Options
Downloads
Patches
Plain Diff
finished localization
parent
2f3c7d78
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CalculatePictureXYFromLatLon.js
+0
-162
0 additions, 162 deletions
CalculatePictureXYFromLatLon.js
with
0 additions
and
162 deletions
CalculatePictureXYFromLatLon.js
deleted
100644 → 0
+
0
−
162
View file @
2f3c7d78
// The lat / Lon is retrieved from the URL_params or by point dropped on map
let
ortomosaic_Lat
=
55.39478003
;
let
ortomosaic_Lon
=
10.36819213
;
// This matrix is project-wide and used for all images
let
ortomosaic_matrix
=
[
[
0.02058
,
0
,
422992.35133
],
[
0
,
-
0.02058
,
1141303.77145
],
];
// Homographies - 1 pr. image
let
homography_0318
=
[
[
18.1748008896691
,
110.768040573102
,
-
1073920.02739014
],
[
-
93.5072721511896
,
22.9184010773105
,
1443133.71867263
],
[
0.00251773837644659
,
0.00477261054405393
,
13.1563804084711
],
];
let
homography_0319
=
[
[
91.1913681526212
,
74.4954006235995
,
-
2032705.65426289
],
[
-
45.9491261079299
,
91.0850627766938
,
171874.03429197
],
[
0.00847800760620633
,
0.00670916759943164
,
-
107.707794052532
],
];
let
homography_0396
=
[
[
-
95.2171306574051
,
-
29.8646394213374
,
2211180.11714658
],
[
35.8083803816194
,
-
86.1842002662421
,
401622.842075709
],
[
-
0.000900957696478009
,
0.00265330072368818
,
90.1507734097704
],
];
let
homography_0397
=
[
[
-
87.1783293678574
,
-
45.230650433766
,
2167669.31918901
],
[
50.6739871848908
,
-
80.3042160587032
,
171110.407022258
],
[
-
0.000591511908147938
,
0.00219435869720514
,
87.7727832580621
],
];
console
.
log
(
'
lat :
'
+
ortomosaic_Lat
);
console
.
log
(
'
lon :
'
+
ortomosaic_Lon
);
console
.
log
(
'
-------------------------------------
'
);
picture_coordinates
=
CalculatePictureXYFromLatLon
(
ortomosaic_Lat
,
ortomosaic_Lon
,
'
DKTM2_4094
'
,
ortomosaic_matrix
,
homography_0318
)
console
.
log
(
'
Picture : 0318
'
);
console
.
log
(
'
x :
'
+
picture_coordinates
[
0
]);
console
.
log
(
'
y :
'
+
picture_coordinates
[
1
]);
console
.
log
(
'
-------------------------------------
'
);
picture_coordinates
=
CalculatePictureXYFromLatLon
(
ortomosaic_Lat
,
ortomosaic_Lon
,
'
DKTM2_4094
'
,
ortomosaic_matrix
,
homography_0319
);
console
.
log
(
'
Picture : 0319
'
);
console
.
log
(
'
x :
'
+
picture_coordinates
[
0
]);
console
.
log
(
'
y :
'
+
picture_coordinates
[
1
]);
console
.
log
(
'
-------------------------------------
'
);
picture_coordinates
=
CalculatePictureXYFromLatLon
(
ortomosaic_Lat
,
ortomosaic_Lon
,
'
DKTM2_4094
'
,
ortomosaic_matrix
,
homography_0396
);
console
.
log
(
'
Picture : 0396
'
);
console
.
log
(
'
x :
'
+
picture_coordinates
[
0
]);
console
.
log
(
'
y :
'
+
picture_coordinates
[
1
]);
console
.
log
(
'
-------------------------------------
'
);
picture_coordinates
=
CalculatePictureXYFromLatLon
(
ortomosaic_Lat
,
ortomosaic_Lon
,
'
DKTM2_4094
'
,
ortomosaic_matrix
,
homography_0397
);
console
.
log
(
'
Picture : 0397
'
);
console
.
log
(
'
x :
'
+
picture_coordinates
[
0
]);
console
.
log
(
'
y :
'
+
picture_coordinates
[
1
]);
console
.
log
(
'
-------------------------------------
'
);
function
CalculatePictureXYFromLatLon
(
Lat
,
Lon
,
project_csr
,
mosaic_matrix
,
pic_homography
)
{
switch
(
project_csr
)
{
case
'
WGS84_4326
'
:
csr
=
'
+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees
'
;
break
;
case
'
DKTM1_4093
'
:
csr
=
'
+proj=tmerc +lat_0=0 +lon_0=9 +k=0.99998 +x_0=200000 +y_0=-5000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
'
;
break
;
case
'
DKTM2_4094
'
:
csr
=
'
+proj=tmerc +lat_0=0 +lon_0=10 +k=0.99998 +x_0=400000 +y_0=-5000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
'
;
break
;
case
'
DKTM3_4095
'
:
csr
=
'
+proj=tmerc +lat_0=0 +lon_0=11.75 +k=0.99998 +x_0=600000 +y_0=-5000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
'
;
break
;
case
'
DKTM4_4096
'
:
csr
=
'
+proj=tmerc +lat_0=0 +lon_0=15 +k=1 +x_0=800000 +y_0=-5000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
'
;
break
;
case
'
ETRS89_25832
'
:
csr
=
'
+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
'
;
break
;
default
:
csr
=
''
;
}
//
// Default 'from' crs is WGS84_4326
var
projected_xy
=
proj4
(
csr
,
[
Lon
,
Lat
]);
var
mosaic_coordinates_x
=
(
mosaic_matrix
[
1
][
1
]
*
projected_xy
[
0
]
-
mosaic_matrix
[
0
][
1
]
*
projected_xy
[
1
]
+
mosaic_matrix
[
0
][
1
]
*
mosaic_matrix
[
1
][
2
]
-
mosaic_matrix
[
1
][
1
]
*
mosaic_matrix
[
0
][
2
])
/
(
mosaic_matrix
[
0
][
0
]
*
mosaic_matrix
[
1
][
1
]
-
mosaic_matrix
[
1
][
0
]
*
mosaic_matrix
[
1
][
0
]);
var
mosaic_coordinates_y
=
(
-
mosaic_matrix
[
0
][
1
]
*
projected_xy
[
0
]
+
mosaic_matrix
[
0
][
0
]
*
projected_xy
[
1
]
+
mosaic_matrix
[
0
][
1
]
*
mosaic_matrix
[
0
][
2
]
-
mosaic_matrix
[
0
][
0
]
*
mosaic_matrix
[
1
][
2
])
/
(
mosaic_matrix
[
0
][
0
]
*
mosaic_matrix
[
1
][
1
]
-
mosaic_matrix
[
1
][
0
]
*
mosaic_matrix
[
0
][
1
]);
var
calc_a
=
pic_homography
[
0
][
0
]
*
mosaic_coordinates_x
+
pic_homography
[
0
][
1
]
*
mosaic_coordinates_y
+
pic_homography
[
0
][
2
];
var
calc_b
=
pic_homography
[
1
][
0
]
*
mosaic_coordinates_x
+
pic_homography
[
1
][
1
]
*
mosaic_coordinates_y
+
pic_homography
[
1
][
2
];
var
calc_c
=
pic_homography
[
2
][
0
]
*
mosaic_coordinates_x
+
pic_homography
[
2
][
1
]
*
mosaic_coordinates_y
+
pic_homography
[
2
][
2
];
var
pic_x
=
calc_a
/
calc_c
;
var
pic_y
=
calc_b
/
calc_c
;
let
pic_xy
=
[
pic_x
,
pic_y
];
return
pic_xy
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment