-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from josteinl/feature/add_swedish_coordinates
Add Swedish projections SWEREF99 with EPSG SRID 3006 to 3018
- Loading branch information
Showing
9 changed files
with
715 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import pytest | ||
|
||
from coordinate_projector.projector import Projector | ||
|
||
|
||
# Assumption that the SWEREF99 is the same as WGS84 | ||
WGS84 = 4326 | ||
SWEREF99TM = 3006 | ||
SWEREF99_12_00 = 3007 | ||
SWEREF99_13_30 = 3008 | ||
SWEREF99_15_00 = 3009 | ||
SWEREF99_16_30 = 3010 | ||
SWEREF99_18_00 = 3011 | ||
SWEREF99_14_15 = 3012 | ||
SWEREF99_15_45 = 3013 | ||
SWEREF99_17_15 = 3014 | ||
SWEREF99_18_45 = 3015 | ||
SWEREF99_20_15 = 3016 | ||
SWEREF99_21_45 = 3017 | ||
SWEREF99_23_15 = 3018 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"latitude, longitude, to_srid, expected_northing, expected_easting", | ||
( | ||
(55, 12.75, SWEREF99TM, 6097106.672, 356083.438), | ||
(55, 14.25, SWEREF99TM, 6095048.642, 452024.069), | ||
(57, 12.75, SWEREF99TM, 6319636.937, 363331.554), | ||
(57, 19.5, SWEREF99TM, 6326392.707, 773251.054), | ||
(59, 11.25, SWEREF99TM, 6546096.724, 284626.066), | ||
(59, 19.5, SWEREF99TM, 6548757.206, 758410.519), | ||
(61, 12.75, SWEREF99TM, 6764877.311, 378323.440), | ||
(61, 18.75, SWEREF99TM, 6768593.345, 702745.127), | ||
(63, 12, SWEREF99TM, 6989134.048, 348083.148), | ||
(63, 19.5, SWEREF99TM, 6993565.630, 727798.671), | ||
(65, 13.5, SWEREF99TM, 7209293.753, 429270.201), | ||
(65, 21.75, SWEREF99TM, 7225449.115, 817833.405), | ||
(67, 16.5, SWEREF99TM, 7432168.174, 565398.458), | ||
(67, 24, SWEREF99TM, 7459745.672, 891298.142), | ||
(69, 21, SWEREF99TM, 7666089.698, 739639.195), | ||
(57, 11.25, SWEREF99_12_00, 6320164.077, 104421.390), | ||
(59, 11.25, SWEREF99_12_00, 6542910.921, 106894.103), | ||
(57, 12.75, SWEREF99_12_00, 6320164.077, 195578.610), | ||
(59, 12.75, SWEREF99_12_00, 6542910.921, 193105.897), | ||
(55, 12.75, SWEREF99_13_30, 6097487.637, 102004.871), | ||
(57, 12.75, SWEREF99_13_30, 6320164.077, 104421.390), | ||
(59, 12.75, SWEREF99_13_30, 6542910.921, 106894.103), | ||
(61, 12.75, SWEREF99_13_30, 6765725.847, 109420.005), | ||
(63, 12.75, SWEREF99_13_30, 6988606.198, 111996.020), | ||
(55, 14.25, SWEREF99_13_30, 6097487.637, 197995.129), | ||
(57, 14.25, SWEREF99_13_30, 6320164.077, 195578.610), | ||
(59, 14.25, SWEREF99_13_30, 6542910.921, 193105.897), | ||
(61, 14.25, SWEREF99_13_30, 6765725.847, 190579.995), | ||
(63, 12, SWEREF99_14_15, 6990379.288, 36003.367), | ||
(65, 13.5, SWEREF99_14_15, 7211548.993, 114619.001), | ||
(63, 15, SWEREF99_14_15, 6988606.198, 188003.980), | ||
(65, 15, SWEREF99_14_15, 7211548.993, 185380.999), | ||
# SWEREF 99 SWEREF 99 15 00 | ||
(55, 14.25, SWEREF99_15_00, 6097487.637, 102004.871), | ||
(57, 14.25, SWEREF99_15_00, 6320164.077, 104421.390), | ||
(59, 14.25, SWEREF99_15_00, 6542910.921, 106894.103), | ||
(61, 14.25, SWEREF99_15_00, 6765725.847, 109420.005), | ||
(57, 15.75, SWEREF99_15_00, 6320164.077, 195578.610), | ||
(59, 15.75, SWEREF99_15_00, 6542910.921, 193105.897), | ||
(61, 15.75, SWEREF99_15_00, 6765725.847, 190579.995), | ||
# SWEREF 99 SWEREF 99 15 45 | ||
(63, 15.00, SWEREF99_15_45, 6988606.198, 111996.020), | ||
(65, 15.00, SWEREF99_15_45, 7211548.993, 114619.001), | ||
(67, 15.00, SWEREF99_15_45, 7434550.943, 117285.739), | ||
(63, 16.50, SWEREF99_15_45, 6988606.198, 188003.980), | ||
(65, 16.50, SWEREF99_15_45, 7211548.993, 185380.999), | ||
(67, 16.50, SWEREF99_15_45, 7434550.943, 182714.261), | ||
# SWEREF 99 SWEREF 99 16 30 | ||
(57, 15.75, SWEREF99_16_30, 6320164.077, 104421.390), | ||
(59, 15.75, SWEREF99_16_30, 6542910.921, 106894.103), | ||
(61, 15.75, SWEREF99_16_30, 6765725.847, 109420.005), | ||
(63, 15.75, SWEREF99_16_30, 6988606.198, 111996.020), | ||
(57, 17.25, SWEREF99_16_30, 6320164.077, 195578.610), | ||
(59, 17.25, SWEREF99_16_30, 6542910.921, 193105.897), | ||
(61, 17.25, SWEREF99_16_30, 6765725.847, 190579.995), | ||
(63, 17.25, SWEREF99_16_30, 6988606.198, 188003.980), | ||
# SWEREF 99 SWEREF 99 17 15 | ||
(63, 16.50, SWEREF99_17_15, 6988606.198, 111996.020), | ||
(65, 16.50, SWEREF99_17_15, 7211548.993, 114619.001), | ||
(67, 16.50, SWEREF99_17_15, 7434550.943, 117285.739), | ||
(63, 18.00, SWEREF99_17_15, 6988606.198, 188003.980), | ||
(65, 18.00, SWEREF99_17_15, 7211548.993, 185380.999), | ||
(67, 18.00, SWEREF99_17_15, 7434550.943, 182714.261), | ||
# SWEREF 99 SWEREF 99 18 00 | ||
(59, 17.25, SWEREF99_18_00, 6542910.921, 106894.103), | ||
(61, 17.25, SWEREF99_18_00, 6765725.847, 109420.005), | ||
(59, 18.75, SWEREF99_18_00, 6542910.921, 193105.897), | ||
(61, 18.75, SWEREF99_18_00, 6765725.847, 190579.995), | ||
# SWEREF 99 SWEREF 99 18 45 | ||
(57, 18, SWEREF99_18_45, 6320164.077, 104421.390), | ||
(59, 18, SWEREF99_18_45, 6542910.921, 106894.103), | ||
(63, 18, SWEREF99_18_45, 6988606.198, 111996.020), | ||
(65, 18, SWEREF99_18_45, 7211548.993, 114619.001), | ||
(67, 18, SWEREF99_18_45, 7434550.943, 117285.739), | ||
(57, 19.5, SWEREF99_18_45, 6320164.077, 195578.610), | ||
(59, 19.5, SWEREF99_18_45, 6542910.921, 193105.897), | ||
(63, 19.5, SWEREF99_18_45, 6988606.198, 188003.980), | ||
(65, 19.5, SWEREF99_18_45, 7211548.993, 185380.999), | ||
(67, 19.5, SWEREF99_18_45, 7434550.943, 182714.261), | ||
# SWEREF 99 SWEREF 99 20 15 | ||
(63, 19.5, SWEREF99_20_15, 6988606.198, 111996.020), | ||
(65, 19.5, SWEREF99_20_15, 7211548.993, 114619.001), | ||
(67, 19.5, SWEREF99_20_15, 7434550.943, 117285.739), | ||
(69, 19.5, SWEREF99_20_15, 7657608.465, 119992.964), | ||
(65, 21, SWEREF99_20_15, 7211548.993, 185380.999), | ||
(67, 21, SWEREF99_20_15, 7434550.943, 182714.261), | ||
(69, 21, SWEREF99_20_15, 7657608.465, 180007.036), | ||
# SWEREF 99 SWEREF 99 21 45 | ||
(65, 21, SWEREF99_21_45, 7211548.993, 114619.001), | ||
(67, 21, SWEREF99_21_45, 7434550.943, 117285.739), | ||
(65, 22.5, SWEREF99_21_45, 7211548.993, 185380.999), | ||
(67, 22.5, SWEREF99_21_45, 7434550.943, 182714.261), | ||
# SWEREF 99 SWEREF 99 23 15 | ||
(65, 22.5, SWEREF99_23_15, 7211548.993, 114619.001), | ||
(67, 22.5, SWEREF99_23_15, 7434550.943, 117285.739), | ||
(65, 24, SWEREF99_23_15, 7211548.993, 185380.999), | ||
(67, 24, SWEREF99_23_15, 7434550.943, 182714.261), | ||
), | ||
) | ||
def test_sweref99(latitude, longitude, to_srid, expected_northing, expected_easting): | ||
""" | ||
Test data above taken from: | ||
https://www.lantmateriet.se/contentassets/a7ddfc3b7821498da8b55cd3f71b5150/kontrollpunkter_sweref99tm.pdf | ||
https://www.lantmateriet.se/contentassets/a7ddfc3b7821498da8b55cd3f71b5150/kontrollpunkter_sweref99proj.pdf | ||
""" | ||
projector = Projector() | ||
easting, northing = projector.transform(from_srid=WGS84, to_srid=to_srid, east=longitude, north=latitude) | ||
assert easting == pytest.approx(expected_easting) | ||
assert northing == pytest.approx(expected_northing) |