1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Added support for prime meridians and angular units to GCS

This commit is contained in:
Martin Tůma 2018-01-20 20:13:56 +01:00
parent e9ef68a81c
commit 1739625896
38 changed files with 886 additions and 773 deletions

View File

@ -36,7 +36,7 @@ build_script:
copy pkg\ellipsoids.csv installer copy pkg\ellipsoids.csv installer
copy pkg\datums.csv installer copy pkg\gcs.csv installer
copy pkg\pcs.csv installer copy pkg\pcs.csv installer

View File

@ -111,7 +111,10 @@ HEADERS += src/config.h \
src/data/fitparser.h \ src/data/fitparser.h \
src/data/igcparser.h \ src/data/igcparser.h \
src/data/nmeaparser.h \ src/data/nmeaparser.h \
src/data/str2int.h src/data/str2int.h \
src/map/gcs.h \
src/map/angularunits.h \
src/map/primemeridian.h
SOURCES += src/main.cpp \ SOURCES += src/main.cpp \
src/common/coordinates.cpp \ src/common/coordinates.cpp \
src/common/rectc.cpp \ src/common/rectc.cpp \
@ -192,7 +195,10 @@ SOURCES += src/main.cpp \
src/data/igcparser.cpp \ src/data/igcparser.cpp \
src/data/nmeaparser.cpp \ src/data/nmeaparser.cpp \
src/data/str2int.cpp \ src/data/str2int.cpp \
src/map/projection.cpp src/map/projection.cpp \
src/map/gcs.cpp \
src/map/angularunits.cpp \
src/map/primemeridian.cpp
RESOURCES += gpxsee.qrc RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \ TRANSLATIONS = lang/gpxsee_cs.ts \
lang/gpxsee_sv.ts \ lang/gpxsee_sv.ts \
@ -210,7 +216,7 @@ macx {
icons/nmea.icns \ icons/nmea.icns \
pkg/maps.txt \ pkg/maps.txt \
pkg/ellipsoids.csv \ pkg/ellipsoids.csv \
pkg/datums.csv \ pkg/gcs.csv \
pkg/pcs.csv pkg/pcs.csv
APP_RESOURCES.path = Contents/Resources APP_RESOURCES.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_RESOURCES QMAKE_BUNDLE_DATA += APP_RESOURCES

View File

@ -1,283 +0,0 @@
TWD97,3824,7019,0,0,0
IGRS,3889,7019,0,0,0
Hermannskogel,3906,7004,653,-212,449
MOLDREF99,4023,7019,0,0,0
RGRDC 2005,4046,7019,0,0,0
REGCAN95,4081,7019,0,0,0
GGRS 87,4121,7019,-199.87,74.79,246.62
Finland Hayford,4123,7022,-78,-231,-97
RT 90,4124,7004,498,-36,568
Samboja,4125,7004,-404.78,685.68,45.47
Tete,4127,7008,-80,-100,-228
Indian 1960,4131,7015,198,881,317
FD58,4132,7012,-241.54,-163.64,396.06
Old Hawaiian,4135,7008,61,-285,-181
Puerto Rico,4139,7008,11,72,-101
NAD83(CSRS98),4140,7019,0,0,0
Israel 1993,4141,7019,-48,55,52
Locodjo 1965,4142,7012,-125,53,467
Abidjan 1987,4143,7012,-124.76,53,466.79
Kalianpur 1937,4144,7015,214,804,268
Kalianpur 1962,4145,7044,283,682,231
Kalianpur 1975,4146,7045,295,736,257
Hanoi 1972,4147,7024,-17.51,-108.32,-62.39
Hartebeeshoek94,4148,7030,0,0,0
CH-1903,4149,7004,674,15,405
NAD83(HARN),4152,7019,0,0,0
ED50(ED77),4154,7022,-117,-132,-164
Dabola 1981,4155,7011,-83,37,124
Naparima 1955,4158,7022,-0.465,372.095,171.736
ELD79,4159,7022,-115.8543,-99.0583,-152.4616
Pampa del Castillo,4161,7022,27.5,14,186.4
Yemen NGN96,4163,7030,0,0,0
South Yemen,4164,7024,-76,-138,67
Bissau,4165,7022,-173,253,27
NZGD2000,4167,7030,0,0,0
Accra,4168,7029,-199,32,322
American Samoa 1962,4169,7008,-115,118,426
SIRGAS 1995,4170,7019,0,0,0
RGF93,4171,7019,0,0,0
IRENET95,4173,7019,0,0,0
Sierra Leone 1968,4175,7012,-88,4,101
Pulkovo 1942(83),4178,7024,26,-121,-78
S42,4179,7024,28,-121,-77
EST97,4180,7019,0,0,0
Observatorio 1966,4182,7022,-425,-169,81
Southwest Base,4183,7022,-104,167,-38
Sao Braz,4184,7022,-203,141,53
REGVEN,4189,7019,0,0,0
POSGAR 98,4190,7019,0,0,0
Douala 1948,4192,7022,-206.1,-174.7,-87.7
Manoca 1962,4193,7011,-70.9,-151.8,-41.4
Qornoq 1927,4194,7022,164,138,-189
Adindan,4201,7012,-162,-12,206
Australian Geodetic 1966,4202,7003,-133,-48,148
Australian Geodetic 1984,4203,7003,-134,-48,149
Ain el Abd 1970,4204,7022,-150,-251,-2
Afgooye,4205,7024,-43,-163,45
Lisbon,4207,7022,-304.046,-60.576,103.64
Aratu,4208,7022,-151.99,287.04,-147.45
Arc 1950,4209,7012,-143,-90,-294
Arc 1960,4210,7012,-160,-8,-300
Djakarta (Batavia),4211,7004,-377,681,-50
Barbados 1938,4212,7012,31.95,300.99,419.19
Beduaram,4213,7011,-106,-87,188
Beijing 1954,4214,7024,15.8,-154.4,-82.3
Bermuda 1957,4216,7008,-73,213,296
Bogota Observatory,4218,7022,307,304,-318
Camacupa,4220,7012,-50.9,-347.6,-231
Campo Inchauspe,4221,7022,-148,136,90
Cape,4222,7012,-136,-108,-292
Carthage,4223,7012,-263,6,431
Chua Astro,4224,7022,-134,229,-29
Corrego Alegre,4225,7022,-206,172,-6
Deir ez Zor,4227,7011,-190.421,8.532,238.69
Old Egyptian,4229,7020,-130,110,-13
European 1950,4230,7022,-87,-98,-121
Oman,4232,7012,-346,-1,224
Gandajika Base,4233,7022,-133,-321,50
Hu-Tzu-Shan,4236,7022,-634,-549,-201
ID74,4238,7021,-24,-15,5
Indian 1954,4239,7015,217,823,299
Indian Thailand,4240,7015,214,836,303
JAD69,4242,7008,70,207,389.5
Kandawala,4244,7015,-97,787,86
Kertau 1948,4245,7018,-11,851,5
KOC,4246,7012,-294.7,-200.1,525.5
La Canoa,4247,7022,-273.5,110.6,-357.9
Prov So Amrican 1956,4248,7022,-288,175,-376
Leigon,4250,7012,-130,29,364
Liberia 1964,4251,7012,-90,40,88
Luzon Philippines,4253,7008,-133,-77,-51
Prov So Chilean 1963,4254,7022,16,196,93
Mahe 1971,4256,7012,41,-220,-134
ETRS89,4258,7019,0,0,0
Malongo 1987,4259,7022,-254.1,-5.36,-100.29
Merchich,4261,7012,31,146,47
Massawa,4262,7004,639,405,60
Minna,4263,7012,-92,-93,122
Mhast,4264,7022,-252.95,-4.11,-96.38
M'poraloko,4266,7011,-74,-130,42
NAD27 CONUS,4267,7008,-8,160,176
NAD83,4269,7019,0,0,0
Nahrwan 1967,4270,7012,-249,-156,381
Naparima BWI,4271,7022,-2,374,172
Geodetic Datum 1949,4272,7022,84,-22,209
NZGD1949,4272,7022,84,-22,209
NGO1948,4273,7005,315,-217,528
Datum 73,4274,7022,-223.237,110.193,36.649
NTF France,4275,7011,-168,-60,320
Ord Srvy Grt Britn,4277,7001,375,-111,431
Israeli,4281,7010,-235,-85,264
Pointe Noire,4282,7011,-148,51,-291
Australian Geocentric 1994 (GDA94),4283,7019,0,0,0
Pulkovo 1942 (1),4284,7024,28,-130,-95
Qatar National,4285,7022,-128,-283,22
Qornoq,4287,7022,164,138,-189
Rijksdriehoeksmeting,4289,7004,593,26,478
South American 1969,4291,7036,-57,1,-41
Sapper Hill 1943,4292,7022,-355,16,74
Schwarzeck,4293,7046,616,97,-251
Tananarive,4297,7022,-189,-242,-91
Timbalai 1948,4298,7015,-689,691,-46
Ireland 1965,4299,7002,506,-122,611
Tokyo,4301,7004,-128,481,664
Voirol 1875,4304,7011,-73,-247,227
Yacare,4309,7022,-155,171,37
Yoff,4310,7011,-30,190,89
Zanderij,4311,7022,-265,120,-358
Austrian,4312,7004,594,84,471
Potsdam Rauenberg DHDN,4314,7004,606,23,413
Conakry 1905,4315,7011,-23,259,-9
NGN,4318,7030,-3.2,-5.7,2.8
KUDAMS,4319,7019,-20.8,11.3,2.4
WGS 72,4322,7043,0,0,5
WGS 84,4326,7030,0,0,0
RGSPM06,4463,7019,0,0,0
RGM04,4470,7019,0,0,0
Cadastre 1997,4475,7022,-381.788,-57.501,-256.673
Mexico ITRF92,4483,7019,0,0,0
RRAF 1991,4558,7019,0,0,0
Antigua 1943,4601,7012,-255,-15,71
Dominica 1945,4602,7012,725,685,536
Grenada 1953,4603,7012,72,213.7,93
Montserrat 1958,4604,7012,174,359,365
St. Kitts 1955,4605,7012,9,183,236
St. Lucia 1955,4606,7012,-149,128,296
St. Vincent 1945,4607,7012,195.671,332.517,274.607
JGD2000,4612,7019,0,0,0
Segara,4613,7004,-403,684,41
Southeast Base,4615,7022,-499,-249,314
Marco Astro,4616,7022,-289,-124,60
NAD83(CSRS),4617,7019,0,0,0
SAD69,4618,7050,-66.87,4.37,-38.52
SWEREF99,4619,7019,0,0,0
Fort Marigot,4621,7022,137,248,-430
Guadeloupe 1948,4622,7022,-467,-16,-300
CSG67,4623,7022,-186,230,110
RGFG95,4624,7019,0,0,0
Martinique 1938,4625,7022,186,482,151
Reunion,4626,7022,94,-948,-1262
RGR92,4627,7019,0,0,0
Tahiti 52,4628,7022,162,117,154
IGN72 Nuku Hiva,4630,7022,84,274,65
K0 1949,4631,7022,145,-187,103
Combani 1950,4632,7022,-382,-59,-262
IGN56 Lifou,4633,7022,335.47,222.58,-230.94
IGN72 Grand Terre,4634,7022,-13,-348,292
Saint Pierre et Miquelon 1950,4638,7008,30,430,368
MOP78,4639,7022,253,-132,-127
RRAF 1991,4640,7030,0,0,0
IGN53 Mare,4641,7022,287.58,177.78,-135.41
ST84 Ile des Pins,4642,7022,-13,-348,292
NEA74 Noumea,4644,7022,-10.18,-350.43,291.37
RGNC 1991,4645,7022,0,0,0
Grand Comoros,4646,7022,-963,510,-359
Hjorsey 1955,4658,7022,-73,46,-86
ISN93,4659,7019,0,0,0
LKS92,4661,7019,0,0,0
IGN72 Grande Terre,4662,7022,-11.64,-348.6,291.98
Porto Santo 1995,4663,7022,-502.862,-247.438,312.724
Azores Oriental 1995,4664,7022,-204.619,140.176,55.226
Azores Central 1995,4665,7022,-106.226,166.366,-37.893
European 1979,4668,7022,-86,-98,-119
LKS94,4669,7019,0,0,0
IGM95,4670,7030,0,0,0
Chatham 1971,4672,7022,175,-38,113
SIRGAS 2000,4674,7019,0,0,0
Guam 1963,4675,7008,-100,-248,259
Indian Bangladesh,4682,7015,289,734,257
MAGNA-SIRGAS,4686,7019,0,0,0
Maupiti 83,4692,7022,217.037,86.959,23.956
Nakhl-e Ghanem,4693,7030,0,-0.15,0.68
POSGAR 94,4694,7030,0,0,0
Katanga 1955,4695,7008,-103.746,-9.614,-255.95
Kerguelen Island,4698,7022,145,-187,103
Le Pouce 1934,4699,7012,-770.1,158.4,-498.2
IGCB 1955,4701,7012,-79.9,-158,-168.9
Mauritania 1999,4702,7019,0,0,0
Egypt Gulf of Suez S-650 TL,4706,7020,-146.21,112.63,4.05
Astro B4 Sorol Atoll,4707,7022,114,-116,-333
Anna 1 Astro 1965,4708,7003,-491,-22,435
Astro Beacon 1945,4709,7022,145,75,-272
Astro DOS 71/4,4710,7022,-320,550,-494
Astronomic Stn 1952,4711,7022,124,-234,-25
Ascension Island 1958,4712,7022,-207,107,52
Bellevue (IGN),4714,7022,-127,-769,472
Canton Astro 1966,4716,7022,298,-304,-375
Cape Canaveral,4717,7008,-2,150,181
GUX 1 Astro,4718,7022,252,-209,-751
Easter Island 1967,4719,7022,211,147,111
Fiji 1956,4721,7022,265.025,384.929,-194.046
ISTS 073 Astro 1969,4724,7022,208,-435,-229
Johnston Island,4725,7022,191,-77,-204
L.C. 5 Astro,4726,7008,42,124,147
Midway Astro 1961,4727,7022,912,-58,1227
Pico De Las Nieves,4728,7022,-307,-92,127
Pitcairn Astro 1967,4729,7022,185,165,42
Santo (DOS),4730,7022,170,42,84
Viti Levu 1916,4731,7012,51,391,-36
Wake-Eniwetok 1960,4732,7053,101,52,-39
Tristan Astro 1968,4734,7022,-632,438,-609
Korea 2000,4737,7019,0,0,0
Hong Kong 1963,4739,7022,-156,-271,-189
Karbala 1979,4743,7012,70.995,-335.916,262.898
Nahrwan 1934,4744,7012,-242.2,-144.9,370.3
GR96,4747,7019,0,0,0
RGNC91-93,4749,7019,0,0,0
ST87 Ouvea,4750,7030,-56.263,16.136,-22.856
LGD2006,4754,7022,-208.4058,-109.8777,-2.5764
DGN95,4755,7030,0,0,0
JAD2001,4758,7030,0,0,0
NAD83(NSRS2007),4759,7019,0,0,0
HTRS96,4761,7019,0,0,0
BDA2000,4762,7030,0,0,0
Pitcairn 2006,4763,7030,0,0,0
RSRGD2000,4764,7019,0,0,0
Slovenia 1996,4765,7019,0,0,0
Lisbon (Lisbon),4803,7022,-304.046,-60.576,103.64
MGI (Ferro),4805,7004,682,-203,480
Rome 1940,4806,7022,-225,-65,9
NTF (Paris),4807,7011,-168,-60,320
Norsk,4817,7005,278,93,474
PTRA08,5013,7019,0,0,0
TUREF,5252,7019,0,0,0
DRUKREF 03,5264,7019,0,0,0
ISN2004,5324,7019,0,0,0
POSGAR 2007,5340,7019,0,0,0
MARGEN,5354,7019,0,0,0
SIRGAS-Chile,5360,7019,0,0,0
CR05,5365,7030,0,0,0
Peru96,5373,7019,0,0,0
SIRGAS-ROU98,5381,7030,0,0,0
Ocotepeque 1935,5451,7008,205,96,-98
RGAF09,5489,7019,0,0,0
SAD69(96),5527,7050,-67.35,3.88,-38.22
PNG94,5546,7019,0,0,0
FEH2010,5593,7019,0,0,0
CIGD11,6135,7019,0,0,0
Mexico ITRF2008,6365,7019,0,0,0
RDN2008,6706,7019,0,0,0
South East Island 1943,6892,7012,-43.685,-179.785,-267.721
ONGD14,7373,7019,0,0,0
St. Helena Tritan,7881,7030,-0.077,0.079,0.086
SHGD2015,7886,7019,0,0,0
DOS 1968,,7022,230,-199,-752
Egypt,,7022,-130,-117,-151
European 1950 (Mean France),,7022,-87,-96,-120
European 1950 (Spain and Portugal),,7022,-84,-107,-120
Luzon Mindanao,,7008,-133,-79,-72
NAD27 Alaska,,7008,-5,135,172
NAD27 Bahamas,,7008,-4,154,178
NAD27 Canada,,7008,-10,158,187
NAD27 Canal Zone,,7008,0,125,201
NAD27 Caribbean,,7008,-3,142,183
NAD27 Central,,7008,0,125,194
NAD27 Cuba,,7008,-9,152,178
NAD27 Greenland,,7008,11,114,195
NAD27 Mexico,,7008,-12,130,190
NAD27 San Salvador,,7008,1,140,165
Nahrwn Masirah Ilnd,,7012,-247,-148,369
Nahrwn Saudi Arbia,,7012,-231,-196,482
Nahrwn United Arab,,7012,-249,-156,381
Pulkovo 1942 (2),,7024,28,-130,-95
1 TWD97 3824 7019 0 0 0
2 IGRS 3889 7019 0 0 0
3 Hermannskogel 3906 7004 653 -212 449
4 MOLDREF99 4023 7019 0 0 0
5 RGRDC 2005 4046 7019 0 0 0
6 REGCAN95 4081 7019 0 0 0
7 GGRS 87 4121 7019 -199.87 74.79 246.62
8 Finland Hayford 4123 7022 -78 -231 -97
9 RT 90 4124 7004 498 -36 568
10 Samboja 4125 7004 -404.78 685.68 45.47
11 Tete 4127 7008 -80 -100 -228
12 Indian 1960 4131 7015 198 881 317
13 FD58 4132 7012 -241.54 -163.64 396.06
14 Old Hawaiian 4135 7008 61 -285 -181
15 Puerto Rico 4139 7008 11 72 -101
16 NAD83(CSRS98) 4140 7019 0 0 0
17 Israel 1993 4141 7019 -48 55 52
18 Locodjo 1965 4142 7012 -125 53 467
19 Abidjan 1987 4143 7012 -124.76 53 466.79
20 Kalianpur 1937 4144 7015 214 804 268
21 Kalianpur 1962 4145 7044 283 682 231
22 Kalianpur 1975 4146 7045 295 736 257
23 Hanoi 1972 4147 7024 -17.51 -108.32 -62.39
24 Hartebeeshoek94 4148 7030 0 0 0
25 CH-1903 4149 7004 674 15 405
26 NAD83(HARN) 4152 7019 0 0 0
27 ED50(ED77) 4154 7022 -117 -132 -164
28 Dabola 1981 4155 7011 -83 37 124
29 Naparima 1955 4158 7022 -0.465 372.095 171.736
30 ELD79 4159 7022 -115.8543 -99.0583 -152.4616
31 Pampa del Castillo 4161 7022 27.5 14 186.4
32 Yemen NGN96 4163 7030 0 0 0
33 South Yemen 4164 7024 -76 -138 67
34 Bissau 4165 7022 -173 253 27
35 NZGD2000 4167 7030 0 0 0
36 Accra 4168 7029 -199 32 322
37 American Samoa 1962 4169 7008 -115 118 426
38 SIRGAS 1995 4170 7019 0 0 0
39 RGF93 4171 7019 0 0 0
40 IRENET95 4173 7019 0 0 0
41 Sierra Leone 1968 4175 7012 -88 4 101
42 Pulkovo 1942(83) 4178 7024 26 -121 -78
43 S42 4179 7024 28 -121 -77
44 EST97 4180 7019 0 0 0
45 Observatorio 1966 4182 7022 -425 -169 81
46 Southwest Base 4183 7022 -104 167 -38
47 Sao Braz 4184 7022 -203 141 53
48 REGVEN 4189 7019 0 0 0
49 POSGAR 98 4190 7019 0 0 0
50 Douala 1948 4192 7022 -206.1 -174.7 -87.7
51 Manoca 1962 4193 7011 -70.9 -151.8 -41.4
52 Qornoq 1927 4194 7022 164 138 -189
53 Adindan 4201 7012 -162 -12 206
54 Australian Geodetic 1966 4202 7003 -133 -48 148
55 Australian Geodetic 1984 4203 7003 -134 -48 149
56 Ain el Abd 1970 4204 7022 -150 -251 -2
57 Afgooye 4205 7024 -43 -163 45
58 Lisbon 4207 7022 -304.046 -60.576 103.64
59 Aratu 4208 7022 -151.99 287.04 -147.45
60 Arc 1950 4209 7012 -143 -90 -294
61 Arc 1960 4210 7012 -160 -8 -300
62 Djakarta (Batavia) 4211 7004 -377 681 -50
63 Barbados 1938 4212 7012 31.95 300.99 419.19
64 Beduaram 4213 7011 -106 -87 188
65 Beijing 1954 4214 7024 15.8 -154.4 -82.3
66 Bermuda 1957 4216 7008 -73 213 296
67 Bogota Observatory 4218 7022 307 304 -318
68 Camacupa 4220 7012 -50.9 -347.6 -231
69 Campo Inchauspe 4221 7022 -148 136 90
70 Cape 4222 7012 -136 -108 -292
71 Carthage 4223 7012 -263 6 431
72 Chua Astro 4224 7022 -134 229 -29
73 Corrego Alegre 4225 7022 -206 172 -6
74 Deir ez Zor 4227 7011 -190.421 8.532 238.69
75 Old Egyptian 4229 7020 -130 110 -13
76 European 1950 4230 7022 -87 -98 -121
77 Oman 4232 7012 -346 -1 224
78 Gandajika Base 4233 7022 -133 -321 50
79 Hu-Tzu-Shan 4236 7022 -634 -549 -201
80 ID74 4238 7021 -24 -15 5
81 Indian 1954 4239 7015 217 823 299
82 Indian Thailand 4240 7015 214 836 303
83 JAD69 4242 7008 70 207 389.5
84 Kandawala 4244 7015 -97 787 86
85 Kertau 1948 4245 7018 -11 851 5
86 KOC 4246 7012 -294.7 -200.1 525.5
87 La Canoa 4247 7022 -273.5 110.6 -357.9
88 Prov So Amrican 1956 4248 7022 -288 175 -376
89 Leigon 4250 7012 -130 29 364
90 Liberia 1964 4251 7012 -90 40 88
91 Luzon Philippines 4253 7008 -133 -77 -51
92 Prov So Chilean 1963 4254 7022 16 196 93
93 Mahe 1971 4256 7012 41 -220 -134
94 ETRS89 4258 7019 0 0 0
95 Malongo 1987 4259 7022 -254.1 -5.36 -100.29
96 Merchich 4261 7012 31 146 47
97 Massawa 4262 7004 639 405 60
98 Minna 4263 7012 -92 -93 122
99 Mhast 4264 7022 -252.95 -4.11 -96.38
100 M'poraloko 4266 7011 -74 -130 42
101 NAD27 CONUS 4267 7008 -8 160 176
102 NAD83 4269 7019 0 0 0
103 Nahrwan 1967 4270 7012 -249 -156 381
104 Naparima BWI 4271 7022 -2 374 172
105 Geodetic Datum 1949 4272 7022 84 -22 209
106 NZGD1949 4272 7022 84 -22 209
107 NGO1948 4273 7005 315 -217 528
108 Datum 73 4274 7022 -223.237 110.193 36.649
109 NTF France 4275 7011 -168 -60 320
110 Ord Srvy Grt Britn 4277 7001 375 -111 431
111 Israeli 4281 7010 -235 -85 264
112 Pointe Noire 4282 7011 -148 51 -291
113 Australian Geocentric 1994 (GDA94) 4283 7019 0 0 0
114 Pulkovo 1942 (1) 4284 7024 28 -130 -95
115 Qatar National 4285 7022 -128 -283 22
116 Qornoq 4287 7022 164 138 -189
117 Rijksdriehoeksmeting 4289 7004 593 26 478
118 South American 1969 4291 7036 -57 1 -41
119 Sapper Hill 1943 4292 7022 -355 16 74
120 Schwarzeck 4293 7046 616 97 -251
121 Tananarive 4297 7022 -189 -242 -91
122 Timbalai 1948 4298 7015 -689 691 -46
123 Ireland 1965 4299 7002 506 -122 611
124 Tokyo 4301 7004 -128 481 664
125 Voirol 1875 4304 7011 -73 -247 227
126 Yacare 4309 7022 -155 171 37
127 Yoff 4310 7011 -30 190 89
128 Zanderij 4311 7022 -265 120 -358
129 Austrian 4312 7004 594 84 471
130 Potsdam Rauenberg DHDN 4314 7004 606 23 413
131 Conakry 1905 4315 7011 -23 259 -9
132 NGN 4318 7030 -3.2 -5.7 2.8
133 KUDAMS 4319 7019 -20.8 11.3 2.4
134 WGS 72 4322 7043 0 0 5
135 WGS 84 4326 7030 0 0 0
136 RGSPM06 4463 7019 0 0 0
137 RGM04 4470 7019 0 0 0
138 Cadastre 1997 4475 7022 -381.788 -57.501 -256.673
139 Mexico ITRF92 4483 7019 0 0 0
140 RRAF 1991 4558 7019 0 0 0
141 Antigua 1943 4601 7012 -255 -15 71
142 Dominica 1945 4602 7012 725 685 536
143 Grenada 1953 4603 7012 72 213.7 93
144 Montserrat 1958 4604 7012 174 359 365
145 St. Kitts 1955 4605 7012 9 183 236
146 St. Lucia 1955 4606 7012 -149 128 296
147 St. Vincent 1945 4607 7012 195.671 332.517 274.607
148 JGD2000 4612 7019 0 0 0
149 Segara 4613 7004 -403 684 41
150 Southeast Base 4615 7022 -499 -249 314
151 Marco Astro 4616 7022 -289 -124 60
152 NAD83(CSRS) 4617 7019 0 0 0
153 SAD69 4618 7050 -66.87 4.37 -38.52
154 SWEREF99 4619 7019 0 0 0
155 Fort Marigot 4621 7022 137 248 -430
156 Guadeloupe 1948 4622 7022 -467 -16 -300
157 CSG67 4623 7022 -186 230 110
158 RGFG95 4624 7019 0 0 0
159 Martinique 1938 4625 7022 186 482 151
160 Reunion 4626 7022 94 -948 -1262
161 RGR92 4627 7019 0 0 0
162 Tahiti 52 4628 7022 162 117 154
163 IGN72 Nuku Hiva 4630 7022 84 274 65
164 K0 1949 4631 7022 145 -187 103
165 Combani 1950 4632 7022 -382 -59 -262
166 IGN56 Lifou 4633 7022 335.47 222.58 -230.94
167 IGN72 Grand Terre 4634 7022 -13 -348 292
168 Saint Pierre et Miquelon 1950 4638 7008 30 430 368
169 MOP78 4639 7022 253 -132 -127
170 RRAF 1991 4640 7030 0 0 0
171 IGN53 Mare 4641 7022 287.58 177.78 -135.41
172 ST84 Ile des Pins 4642 7022 -13 -348 292
173 NEA74 Noumea 4644 7022 -10.18 -350.43 291.37
174 RGNC 1991 4645 7022 0 0 0
175 Grand Comoros 4646 7022 -963 510 -359
176 Hjorsey 1955 4658 7022 -73 46 -86
177 ISN93 4659 7019 0 0 0
178 LKS92 4661 7019 0 0 0
179 IGN72 Grande Terre 4662 7022 -11.64 -348.6 291.98
180 Porto Santo 1995 4663 7022 -502.862 -247.438 312.724
181 Azores Oriental 1995 4664 7022 -204.619 140.176 55.226
182 Azores Central 1995 4665 7022 -106.226 166.366 -37.893
183 European 1979 4668 7022 -86 -98 -119
184 LKS94 4669 7019 0 0 0
185 IGM95 4670 7030 0 0 0
186 Chatham 1971 4672 7022 175 -38 113
187 SIRGAS 2000 4674 7019 0 0 0
188 Guam 1963 4675 7008 -100 -248 259
189 Indian Bangladesh 4682 7015 289 734 257
190 MAGNA-SIRGAS 4686 7019 0 0 0
191 Maupiti 83 4692 7022 217.037 86.959 23.956
192 Nakhl-e Ghanem 4693 7030 0 -0.15 0.68
193 POSGAR 94 4694 7030 0 0 0
194 Katanga 1955 4695 7008 -103.746 -9.614 -255.95
195 Kerguelen Island 4698 7022 145 -187 103
196 Le Pouce 1934 4699 7012 -770.1 158.4 -498.2
197 IGCB 1955 4701 7012 -79.9 -158 -168.9
198 Mauritania 1999 4702 7019 0 0 0
199 Egypt Gulf of Suez S-650 TL 4706 7020 -146.21 112.63 4.05
200 Astro B4 Sorol Atoll 4707 7022 114 -116 -333
201 Anna 1 Astro 1965 4708 7003 -491 -22 435
202 Astro Beacon 1945 4709 7022 145 75 -272
203 Astro DOS 71/4 4710 7022 -320 550 -494
204 Astronomic Stn 1952 4711 7022 124 -234 -25
205 Ascension Island 1958 4712 7022 -207 107 52
206 Bellevue (IGN) 4714 7022 -127 -769 472
207 Canton Astro 1966 4716 7022 298 -304 -375
208 Cape Canaveral 4717 7008 -2 150 181
209 GUX 1 Astro 4718 7022 252 -209 -751
210 Easter Island 1967 4719 7022 211 147 111
211 Fiji 1956 4721 7022 265.025 384.929 -194.046
212 ISTS 073 Astro 1969 4724 7022 208 -435 -229
213 Johnston Island 4725 7022 191 -77 -204
214 L.C. 5 Astro 4726 7008 42 124 147
215 Midway Astro 1961 4727 7022 912 -58 1227
216 Pico De Las Nieves 4728 7022 -307 -92 127
217 Pitcairn Astro 1967 4729 7022 185 165 42
218 Santo (DOS) 4730 7022 170 42 84
219 Viti Levu 1916 4731 7012 51 391 -36
220 Wake-Eniwetok 1960 4732 7053 101 52 -39
221 Tristan Astro 1968 4734 7022 -632 438 -609
222 Korea 2000 4737 7019 0 0 0
223 Hong Kong 1963 4739 7022 -156 -271 -189
224 Karbala 1979 4743 7012 70.995 -335.916 262.898
225 Nahrwan 1934 4744 7012 -242.2 -144.9 370.3
226 GR96 4747 7019 0 0 0
227 RGNC91-93 4749 7019 0 0 0
228 ST87 Ouvea 4750 7030 -56.263 16.136 -22.856
229 LGD2006 4754 7022 -208.4058 -109.8777 -2.5764
230 DGN95 4755 7030 0 0 0
231 JAD2001 4758 7030 0 0 0
232 NAD83(NSRS2007) 4759 7019 0 0 0
233 HTRS96 4761 7019 0 0 0
234 BDA2000 4762 7030 0 0 0
235 Pitcairn 2006 4763 7030 0 0 0
236 RSRGD2000 4764 7019 0 0 0
237 Slovenia 1996 4765 7019 0 0 0
238 Lisbon (Lisbon) 4803 7022 -304.046 -60.576 103.64
239 MGI (Ferro) 4805 7004 682 -203 480
240 Rome 1940 4806 7022 -225 -65 9
241 NTF (Paris) 4807 7011 -168 -60 320
242 Norsk 4817 7005 278 93 474
243 PTRA08 5013 7019 0 0 0
244 TUREF 5252 7019 0 0 0
245 DRUKREF 03 5264 7019 0 0 0
246 ISN2004 5324 7019 0 0 0
247 POSGAR 2007 5340 7019 0 0 0
248 MARGEN 5354 7019 0 0 0
249 SIRGAS-Chile 5360 7019 0 0 0
250 CR05 5365 7030 0 0 0
251 Peru96 5373 7019 0 0 0
252 SIRGAS-ROU98 5381 7030 0 0 0
253 Ocotepeque 1935 5451 7008 205 96 -98
254 RGAF09 5489 7019 0 0 0
255 SAD69(96) 5527 7050 -67.35 3.88 -38.22
256 PNG94 5546 7019 0 0 0
257 FEH2010 5593 7019 0 0 0
258 CIGD11 6135 7019 0 0 0
259 Mexico ITRF2008 6365 7019 0 0 0
260 RDN2008 6706 7019 0 0 0
261 South East Island 1943 6892 7012 -43.685 -179.785 -267.721
262 ONGD14 7373 7019 0 0 0
263 St. Helena Tritan 7881 7030 -0.077 0.079 0.086
264 SHGD2015 7886 7019 0 0 0
265 DOS 1968 7022 230 -199 -752
266 Egypt 7022 -130 -117 -151
267 European 1950 (Mean France) 7022 -87 -96 -120
268 European 1950 (Spain and Portugal) 7022 -84 -107 -120
269 Luzon Mindanao 7008 -133 -79 -72
270 NAD27 Alaska 7008 -5 135 172
271 NAD27 Bahamas 7008 -4 154 178
272 NAD27 Canada 7008 -10 158 187
273 NAD27 Canal Zone 7008 0 125 201
274 NAD27 Caribbean 7008 -3 142 183
275 NAD27 Central 7008 0 125 194
276 NAD27 Cuba 7008 -9 152 178
277 NAD27 Greenland 7008 11 114 195
278 NAD27 Mexico 7008 -12 130 190
279 NAD27 San Salvador 7008 1 140 165
280 Nahrwn Masirah Ilnd 7012 -247 -148 369
281 Nahrwn Saudi Arbia 7012 -231 -196 482
282 Nahrwn United Arab 7012 -249 -156 381
283 Pulkovo 1942 (2) 7024 28 -130 -95

View File

@ -11,15 +11,9 @@ Everest 1830 (1937 Adjustment),7015,6377276.345,300.8017
Everest 1830 Modified,7018,6377304.063,300.8017 Everest 1830 Modified,7018,6377304.063,300.8017
GRS 80,7019,6378137.0,298.257222101 GRS 80,7019,6378137.0,298.257222101
Helmert 1906,7020,6378200.0,298.3 Helmert 1906,7020,6378200.0,298.3
Indonesian,7021,6378160.0,298.247
International 1924,7022,6378388.0,297.0 International 1924,7022,6378388.0,297.0
Krassovsky 1940,7024,6378245.0,298.3 Krassovsky 1940,7024,6378245.0,298.3
War Office,7029,6378300.0,296.0
WGS 84,7030,6378137.0,298.257223563
South American 1969,7036,6378160.0,298.25 South American 1969,7036,6378160.0,298.25
WGS 72,7043,6378135.0,298.26 WGS 72,7043,6378135.0,298.26
Everest 1830 (1962 Definition),7044,6377301.243,300.8017255
Everest 1830 (1975 Definition),7045,6377299.151,300.8017255
Bessel 1841 (Namibia),7046,6377483.865,299.1528128 Bessel 1841 (Namibia),7046,6377483.865,299.1528128
GRS 67 Modified,7050,6378160.0,298.25
Hough 1960,7053,6378270.0,297.0 Hough 1960,7053,6378270.0,297.0

1 Airy 1830 7001 6377563.396 299.3249646
11 Everest 1830 Modified 7018 6377304.063 300.8017
12 GRS 80 7019 6378137.0 298.257222101
13 Helmert 1906 7020 6378200.0 298.3
Indonesian 7021 6378160.0 298.247
14 International 1924 7022 6378388.0 297.0
15 Krassovsky 1940 7024 6378245.0 298.3
War Office 7029 6378300.0 296.0
WGS 84 7030 6378137.0 298.257223563
16 South American 1969 7036 6378160.0 298.25
17 WGS 72 7043 6378135.0 298.26
Everest 1830 (1962 Definition) 7044 6377301.243 300.8017255
Everest 1830 (1975 Definition) 7045 6377299.151 300.8017255
18 Bessel 1841 (Namibia) 7046 6377483.865 299.1528128
GRS 67 Modified 7050 6378160.0 298.25
19 Hough 1960 7053 6378270.0 297.0

121
pkg/gcs.csv Normal file
View File

@ -0,0 +1,121 @@
Adindan,4201,6201,9122,7012,8901,9603,-162,-12,206
Afgooye,4205,6205,9122,7024,8901,9603,-43,-163,45
Ain el Abd 1970,4204,6204,9122,7022,8901,9603,-150,-251,-2
Anna 1 Astro 1965,4708,6708,9122,7003,8901,9603,-491,-22,435
Arc 1950,4209,6209,9122,7012,8901,9603,-143,-90,-294
Arc 1960,4210,6210,9122,7012,8901,9603,-160,-8,-300
Ascension Island 1958,4712,6712,9122,7022,8901,9603,-207,107,52
Astro B4 Sorol Atoll,4707,6707,9122,7022,8901,9603,114,-116,-333
Astro Beacon 1945,4709,6709,9122,7022,8901,9603,145,75,-272
Astro DOS 71/4,4710,6710,9122,7022,8901,9603,-320,550,-494
Astronomic Stn 1952,4711,6711,9122,7022,8901,9603,124,-234,-25
Australian Geodetic 1966,4202,6202,9122,7003,8901,9603,-133,-48,148
Australian Geodetic 1984,4203,6203,9122,7003,8901,9603,-134,-48,149
Australian Geocentric 1994 (GDA94),4283,6283,9122,7019,8901,9603,0,0,0
Austrian,4312,6312,9122,7004,8901,9603,594,84,471
Bellevue (IGN),4714,6714,9122,7022,8901,9603,-127,-769,472
Bermuda 1957,4216,6216,9122,7008,8901,9603,-73,213,296
Bogota Observatory,4218,6218,9122,7022,8901,9603,307,304,-318
Campo Inchauspe,4221,6221,9122,7022,8901,9603,-148,136,90
Canton Astro 1966,4716,6716,9122,7022,8901,9603,298,-304,-375
Cape,4222,6222,9122,7012,8901,9603,-136,-108,-292
Cape Canaveral,4717,6717,9122,7008,8901,9603,-2,150,181
Carthage,4223,6223,9122,7012,8901,9603,-263,6,431
CH-1903,4149,6149,9122,7004,8901,9603,674,15,405
Chatham 1971,4672,6672,9122,7022,8901,9603,175,-38,113
Chua Astro,4224,6224,9122,7022,8901,9603,-134,229,-29
Corrego Alegre,4225,6225,9122,7022,8901,9603,-206,172,-6
Djakarta (Batavia),4211,6211,9122,7004,8901,9603,-377,681,-50
DOS 1968,,,9122,7022,8901,9603,230,-199,-752
Easter Island 1967,4719,6719,9122,7022,8901,9603,211,147,111
Egypt,4199,6199,9122,7022,8901,9603,-130,-117,-151
European 1950,4230,6230,9122,7022,8901,9603,-87,-98,-121
European 1950 (Mean France),,,9122,7022,8901,9603,-87,-96,-120
European 1950 (Spain and Portugal),,,9122,7022,8901,9603,-84,-107,-120
European 1979,4668,6668,9122,7022,8901,9603,-86,-98,-119
Finland Hayford,4123,6123,9122,7022,8901,9603,-78,-231,-97
Gandajika Base,4233,6233,9122,7022,8901,9603,-133,-321,50
Geodetic Datum 1949,4272,6272,9122,7022,8901,9603,84,-22,209
GGRS 87,4121,6121,9122,7019,8901,9603,-199.87,74.79,246.62
Guam 1963,4675,6675,9122,7008,8901,9603,-100,-248,259
GUX 1 Astro,4718,6718,9122,7022,8901,9603,252,-209,-751
Hartebeeshoek94,4148,6148,9122,7030,8901,9603,0,0,0
Hermannskogel,3906,1031,9122,7004,8901,9603,653,-212,449
Hjorsey 1955,4658,6658,9122,7022,8901,9603,-73,46,-86
Hong Kong 1963,4739,6739,9122,7022,8901,9603,-156,-271,-189
Hu-Tzu-Shan,4236,6236,9122,7022,8901,9603,-634,-549,-201
Indian Bangladesh,4682,6682,9122,7015,8901,9603,289,734,257
Indian Thailand,4240,6240,9122,7015,8901,9603,214,836,303
Israeli,4281,6281,9122,7010,8901,9603,-235,-85,264
Ireland 1965,4299,6299,9122,7002,8901,9603,506,-122,611
ISTS 073 Astro 1969,4724,6724,9122,7022,8901,9603,208,-435,-229
Johnston Island,4725,6725,9122,7022,8901,9603,191,-77,-204
Kandawala,4244,6244,9122,7015,8901,9603,-97,787,86
Kerguelen Island,4698,6698,9122,7022,8901,9603,145,-187,103
Kertau 1948,4245,6245,9122,7018,8901,9603,-11,851,5
L.C. 5 Astro,4726,6726,9122,7008,8901,9603,42,124,147
Liberia 1964,4251,6251,9122,7012,8901,9603,-90,40,88
Luzon Mindanao,,,9122,7008,8901,9603,-133,-79,-72
Luzon Philippines,4253,6253,9122,7008,8901,9603,-133,-77,-51
Mahe 1971,4256,6256,9122,7012,8901,9603,41,-220,-134
Marco Astro,4616,6616,9122,7022,8901,9603,-289,-124,60
Massawa,4262,6262,9122,7004,8901,9603,639,405,60
Merchich,4261,6261,9122,7012,8901,9603,31,146,47
Midway Astro 1961,4727,6727,9122,7022,8901,9603,912,-58,1227
Minna,4263,6263,9122,7012,8901,9603,-92,-93,122
NAD27 Alaska,,,9122,7008,8901,9603,-5,135,172
NAD27 Bahamas,,,9122,7008,8901,9603,-4,154,178
NAD27 Canada,,,9122,7008,8901,9603,-10,158,187
NAD27 Canal Zone,,,9122,7008,8901,9603,0,125,201
NAD27 Caribbean,,,9122,7008,8901,9603,-3,142,183
NAD27 Central,,,9122,7008,8901,9603,0,125,194
NAD27 CONUS,4267,6267,9122,7008,8901,9603,-8,160,176
NAD27 Cuba,,,9122,7008,8901,9603,-9,152,178
NAD27 Greenland,,,9122,7008,8901,9603,11,114,195
NAD27 Mexico,,,9122,7008,8901,9603,-12,130,190
NAD27 San Salvador,,,9122,7008,8901,9603,1,140,165
NAD83,4269,6269,9122,7019,8901,9603,0,0,0
Nahrwn Masirah Ilnd,,,9122,7012,8901,9603,-247,-148,369
Nahrwn Saudi Arbia,,,9122,7012,8901,9603,-231,-196,482
Nahrwn United Arab,4270,6270,9122,7012,8901,9603,-249,-156,381
Naparima BWI,4271,6271,9122,7022,8901,9603,-2,374,172
NGO1948,4273,6273,9122,7005,8901,9603,315,-217,528
NTF France,4275,6275,9122,7011,8901,9603,-168,-60,320
Norsk,4817,6817,9122,7005,8913,9603,278,93,474
NZGD1949,4272,6272,9122,7022,8901,9603,84,-22,209
NZGD2000,4167,6167,9122,7030,8901,9603,0,0,0
Observatorio 1966,4182,6182,9122,7022,8901,9603,-425,-169,81
Old Egyptian,4229,6229,9122,7020,8901,9603,-130,110,-13
Old Hawaiian,4135,6135,9122,7008,8901,9603,61,-285,-181
Oman,4232,6232,9122,7012,8901,9603,-346,-1,224
Ord Srvy Grt Britn,4277,6277,9122,7001,8901,9603,375,-111,431
Pico De Las Nieves,4728,6728,9122,7022,8901,9603,-307,-92,127
Pitcairn Astro 1967,4729,6729,9122,7022,8901,9603,185,165,42
Potsdam Rauenberg DHDN,4314,6314,9122,7004,8901,9603,606,23,413
Prov So Amrican 1956,4248,6248,9122,7022,8901,9603,-288,175,-376
Prov So Chilean 1963,4254,6254,9122,7022,8901,9603,16,196,93
Puerto Rico,4139,6139,9122,7008,8901,9603,11,72,-101
Pulkovo 1942 (1),4284,6284,9122,7024,8901,9603,28,-130,-95
Pulkovo 1942 (2),,,9122,7024,8901,9603,28,-130,-95
Qatar National,4285,6285,9122,7022,8901,9603,-128,-283,22
Qornoq,4287,6287,9108,7022,8901,9603,164,138,-189
Reunion,4626,6626,9122,7022,8901,9603,94,-948,-1262
Rijksdriehoeksmeting,4289,6289,9122,7004,8901,9603,593,26,478
Rome 1940,4806,6806,9122,7022,8906,9603,-225,-65,9
RT 90,4124,6124,9122,7004,8901,9603,498,-36,568
S42,4179,6179,9122,7024,8901,9603,28,-121,-77
Santo (DOS),4730,6730,9122,7022,8901,9603,170,42,84
Sao Braz,4184,6184,9122,7022,8901,9603,-203,141,53
Sapper Hill 1943,4292,6292,9122,7022,8901,9603,-355,16,74
Schwarzeck,4293,6293,9122,7046,8901,9603,616,97,-251
South American 1969,4291,6291,9108,7036,8901,9603,-57,1,-41
Southeast Base,4615,6615,9122,7022,8901,9603,-499,-249,314
Southwest Base,4183,6183,9122,7022,8901,9603,-104,167,-38
Timbalai 1948,4298,6298,9122,7015,8901,9603,-689,691,-46
Tokyo,4301,6301,9122,7004,8901,9603,-128,481,664
Tristan Astro 1968,4734,6734,9122,7022,8901,9603,-632,438,-609
Viti Levu 1916,4731,6731,9122,7012,8901,9603,51,391,-36
Wake-Eniwetok 1960,4732,6732,9122,7053,8901,9603,101,52,-39
WGS 72,4322,6322,9122,7043,8901,9603,0,0,5
Yacare,4309,6309,9122,7022,8901,9603,-155,171,37
Zanderij,4311,6311,9122,7022,8901,9603,-265,120,-358
1 Adindan 4201 6201 9122 7012 8901 9603 -162 -12 206
2 Afgooye 4205 6205 9122 7024 8901 9603 -43 -163 45
3 Ain el Abd 1970 4204 6204 9122 7022 8901 9603 -150 -251 -2
4 Anna 1 Astro 1965 4708 6708 9122 7003 8901 9603 -491 -22 435
5 Arc 1950 4209 6209 9122 7012 8901 9603 -143 -90 -294
6 Arc 1960 4210 6210 9122 7012 8901 9603 -160 -8 -300
7 Ascension Island 1958 4712 6712 9122 7022 8901 9603 -207 107 52
8 Astro B4 Sorol Atoll 4707 6707 9122 7022 8901 9603 114 -116 -333
9 Astro Beacon 1945 4709 6709 9122 7022 8901 9603 145 75 -272
10 Astro DOS 71/4 4710 6710 9122 7022 8901 9603 -320 550 -494
11 Astronomic Stn 1952 4711 6711 9122 7022 8901 9603 124 -234 -25
12 Australian Geodetic 1966 4202 6202 9122 7003 8901 9603 -133 -48 148
13 Australian Geodetic 1984 4203 6203 9122 7003 8901 9603 -134 -48 149
14 Australian Geocentric 1994 (GDA94) 4283 6283 9122 7019 8901 9603 0 0 0
15 Austrian 4312 6312 9122 7004 8901 9603 594 84 471
16 Bellevue (IGN) 4714 6714 9122 7022 8901 9603 -127 -769 472
17 Bermuda 1957 4216 6216 9122 7008 8901 9603 -73 213 296
18 Bogota Observatory 4218 6218 9122 7022 8901 9603 307 304 -318
19 Campo Inchauspe 4221 6221 9122 7022 8901 9603 -148 136 90
20 Canton Astro 1966 4716 6716 9122 7022 8901 9603 298 -304 -375
21 Cape 4222 6222 9122 7012 8901 9603 -136 -108 -292
22 Cape Canaveral 4717 6717 9122 7008 8901 9603 -2 150 181
23 Carthage 4223 6223 9122 7012 8901 9603 -263 6 431
24 CH-1903 4149 6149 9122 7004 8901 9603 674 15 405
25 Chatham 1971 4672 6672 9122 7022 8901 9603 175 -38 113
26 Chua Astro 4224 6224 9122 7022 8901 9603 -134 229 -29
27 Corrego Alegre 4225 6225 9122 7022 8901 9603 -206 172 -6
28 Djakarta (Batavia) 4211 6211 9122 7004 8901 9603 -377 681 -50
29 DOS 1968 9122 7022 8901 9603 230 -199 -752
30 Easter Island 1967 4719 6719 9122 7022 8901 9603 211 147 111
31 Egypt 4199 6199 9122 7022 8901 9603 -130 -117 -151
32 European 1950 4230 6230 9122 7022 8901 9603 -87 -98 -121
33 European 1950 (Mean France) 9122 7022 8901 9603 -87 -96 -120
34 European 1950 (Spain and Portugal) 9122 7022 8901 9603 -84 -107 -120
35 European 1979 4668 6668 9122 7022 8901 9603 -86 -98 -119
36 Finland Hayford 4123 6123 9122 7022 8901 9603 -78 -231 -97
37 Gandajika Base 4233 6233 9122 7022 8901 9603 -133 -321 50
38 Geodetic Datum 1949 4272 6272 9122 7022 8901 9603 84 -22 209
39 GGRS 87 4121 6121 9122 7019 8901 9603 -199.87 74.79 246.62
40 Guam 1963 4675 6675 9122 7008 8901 9603 -100 -248 259
41 GUX 1 Astro 4718 6718 9122 7022 8901 9603 252 -209 -751
42 Hartebeeshoek94 4148 6148 9122 7030 8901 9603 0 0 0
43 Hermannskogel 3906 1031 9122 7004 8901 9603 653 -212 449
44 Hjorsey 1955 4658 6658 9122 7022 8901 9603 -73 46 -86
45 Hong Kong 1963 4739 6739 9122 7022 8901 9603 -156 -271 -189
46 Hu-Tzu-Shan 4236 6236 9122 7022 8901 9603 -634 -549 -201
47 Indian Bangladesh 4682 6682 9122 7015 8901 9603 289 734 257
48 Indian Thailand 4240 6240 9122 7015 8901 9603 214 836 303
49 Israeli 4281 6281 9122 7010 8901 9603 -235 -85 264
50 Ireland 1965 4299 6299 9122 7002 8901 9603 506 -122 611
51 ISTS 073 Astro 1969 4724 6724 9122 7022 8901 9603 208 -435 -229
52 Johnston Island 4725 6725 9122 7022 8901 9603 191 -77 -204
53 Kandawala 4244 6244 9122 7015 8901 9603 -97 787 86
54 Kerguelen Island 4698 6698 9122 7022 8901 9603 145 -187 103
55 Kertau 1948 4245 6245 9122 7018 8901 9603 -11 851 5
56 L.C. 5 Astro 4726 6726 9122 7008 8901 9603 42 124 147
57 Liberia 1964 4251 6251 9122 7012 8901 9603 -90 40 88
58 Luzon Mindanao 9122 7008 8901 9603 -133 -79 -72
59 Luzon Philippines 4253 6253 9122 7008 8901 9603 -133 -77 -51
60 Mahe 1971 4256 6256 9122 7012 8901 9603 41 -220 -134
61 Marco Astro 4616 6616 9122 7022 8901 9603 -289 -124 60
62 Massawa 4262 6262 9122 7004 8901 9603 639 405 60
63 Merchich 4261 6261 9122 7012 8901 9603 31 146 47
64 Midway Astro 1961 4727 6727 9122 7022 8901 9603 912 -58 1227
65 Minna 4263 6263 9122 7012 8901 9603 -92 -93 122
66 NAD27 Alaska 9122 7008 8901 9603 -5 135 172
67 NAD27 Bahamas 9122 7008 8901 9603 -4 154 178
68 NAD27 Canada 9122 7008 8901 9603 -10 158 187
69 NAD27 Canal Zone 9122 7008 8901 9603 0 125 201
70 NAD27 Caribbean 9122 7008 8901 9603 -3 142 183
71 NAD27 Central 9122 7008 8901 9603 0 125 194
72 NAD27 CONUS 4267 6267 9122 7008 8901 9603 -8 160 176
73 NAD27 Cuba 9122 7008 8901 9603 -9 152 178
74 NAD27 Greenland 9122 7008 8901 9603 11 114 195
75 NAD27 Mexico 9122 7008 8901 9603 -12 130 190
76 NAD27 San Salvador 9122 7008 8901 9603 1 140 165
77 NAD83 4269 6269 9122 7019 8901 9603 0 0 0
78 Nahrwn Masirah Ilnd 9122 7012 8901 9603 -247 -148 369
79 Nahrwn Saudi Arbia 9122 7012 8901 9603 -231 -196 482
80 Nahrwn United Arab 4270 6270 9122 7012 8901 9603 -249 -156 381
81 Naparima BWI 4271 6271 9122 7022 8901 9603 -2 374 172
82 NGO1948 4273 6273 9122 7005 8901 9603 315 -217 528
83 NTF France 4275 6275 9122 7011 8901 9603 -168 -60 320
84 Norsk 4817 6817 9122 7005 8913 9603 278 93 474
85 NZGD1949 4272 6272 9122 7022 8901 9603 84 -22 209
86 NZGD2000 4167 6167 9122 7030 8901 9603 0 0 0
87 Observatorio 1966 4182 6182 9122 7022 8901 9603 -425 -169 81
88 Old Egyptian 4229 6229 9122 7020 8901 9603 -130 110 -13
89 Old Hawaiian 4135 6135 9122 7008 8901 9603 61 -285 -181
90 Oman 4232 6232 9122 7012 8901 9603 -346 -1 224
91 Ord Srvy Grt Britn 4277 6277 9122 7001 8901 9603 375 -111 431
92 Pico De Las Nieves 4728 6728 9122 7022 8901 9603 -307 -92 127
93 Pitcairn Astro 1967 4729 6729 9122 7022 8901 9603 185 165 42
94 Potsdam Rauenberg DHDN 4314 6314 9122 7004 8901 9603 606 23 413
95 Prov So Amrican 1956 4248 6248 9122 7022 8901 9603 -288 175 -376
96 Prov So Chilean 1963 4254 6254 9122 7022 8901 9603 16 196 93
97 Puerto Rico 4139 6139 9122 7008 8901 9603 11 72 -101
98 Pulkovo 1942 (1) 4284 6284 9122 7024 8901 9603 28 -130 -95
99 Pulkovo 1942 (2) 9122 7024 8901 9603 28 -130 -95
100 Qatar National 4285 6285 9122 7022 8901 9603 -128 -283 22
101 Qornoq 4287 6287 9108 7022 8901 9603 164 138 -189
102 Reunion 4626 6626 9122 7022 8901 9603 94 -948 -1262
103 Rijksdriehoeksmeting 4289 6289 9122 7004 8901 9603 593 26 478
104 Rome 1940 4806 6806 9122 7022 8906 9603 -225 -65 9
105 RT 90 4124 6124 9122 7004 8901 9603 498 -36 568
106 S42 4179 6179 9122 7024 8901 9603 28 -121 -77
107 Santo (DOS) 4730 6730 9122 7022 8901 9603 170 42 84
108 Sao Braz 4184 6184 9122 7022 8901 9603 -203 141 53
109 Sapper Hill 1943 4292 6292 9122 7022 8901 9603 -355 16 74
110 Schwarzeck 4293 6293 9122 7046 8901 9603 616 97 -251
111 South American 1969 4291 6291 9108 7036 8901 9603 -57 1 -41
112 Southeast Base 4615 6615 9122 7022 8901 9603 -499 -249 314
113 Southwest Base 4183 6183 9122 7022 8901 9603 -104 167 -38
114 Timbalai 1948 4298 6298 9122 7015 8901 9603 -689 691 -46
115 Tokyo 4301 6301 9122 7004 8901 9603 -128 481 664
116 Tristan Astro 1968 4734 6734 9122 7022 8901 9603 -632 438 -609
117 Viti Levu 1916 4731 6731 9122 7012 8901 9603 51 391 -36
118 Wake-Eniwetok 1960 4732 6732 9122 7053 8901 9603 101 52 -39
119 WGS 72 4322 6322 9122 7043 8901 9603 0 0 5
120 Yacare 4309 6309 9122 7022 8901 9603 -155 171 37
121 Zanderij 4311 6311 9122 7022 8901 9603 -265 120 -358

View File

@ -85,7 +85,7 @@ Section "GPXSee" SEC_APP
File "gpxsee.exe" File "gpxsee.exe"
File "maps.txt" File "maps.txt"
File "ellipsoids.csv" File "ellipsoids.csv"
File "datums.csv" File "gcs.csv"
File "pcs.csv" File "pcs.csv"
; Create start menu entry and add links ; Create start menu entry and add links

View File

@ -92,7 +92,7 @@ Section "GPXSee" SEC_APP
File "gpxsee.exe" File "gpxsee.exe"
File "maps.txt" File "maps.txt"
File "ellipsoids.csv" File "ellipsoids.csv"
File "datums.csv" File "gcs.csv"
File "pcs.csv" File "pcs.csv"
; Create start menu entry and add links ; Create start menu entry and add links

View File

@ -7,7 +7,7 @@
#include "map/onlinemap.h" #include "map/onlinemap.h"
#include "map/downloader.h" #include "map/downloader.h"
#include "map/ellipsoid.h" #include "map/ellipsoid.h"
#include "map/datum.h" #include "map/gcs.h"
#include "map/pcs.h" #include "map/pcs.h"
#include "opengl.h" #include "opengl.h"
#include "gui.h" #include "gui.h"
@ -69,7 +69,6 @@ bool App::event(QEvent *event)
void App::loadDatums() void App::loadDatums()
{ {
QString ef, df; QString ef, df;
bool ok = false;
if (QFile::exists(USER_ELLIPSOID_FILE)) if (QFile::exists(USER_ELLIPSOID_FILE))
ef = USER_ELLIPSOID_FILE; ef = USER_ELLIPSOID_FILE;
@ -78,35 +77,17 @@ void App::loadDatums()
else else
qWarning("No ellipsoids file found."); qWarning("No ellipsoids file found.");
if (QFile::exists(USER_DATUM_FILE)) if (QFile::exists(USER_GCS_FILE))
df = USER_DATUM_FILE; df = USER_GCS_FILE;
else if (QFile::exists(GLOBAL_DATUM_FILE)) else if (QFile::exists(GLOBAL_GCS_FILE))
df = GLOBAL_DATUM_FILE; df = GLOBAL_GCS_FILE;
else else
qWarning("No datums file found."); qWarning("No datums file found.");
if (!ef.isNull() && !df.isNull()) { if (!ef.isNull() && !df.isNull()) {
if (!Ellipsoid::loadList(ef)) { Ellipsoid::loadList(ef);
if (Ellipsoid::errorLine()) GCS::loadList(df);
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
else
qWarning("%s: %s", qPrintable(ef), qPrintable(
Ellipsoid::errorString()));
} else {
if (!Datum::loadList(df)) {
if (Datum::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(df),
Datum::errorLine(), qPrintable(Datum::errorString()));
else
qWarning("%s: %s", qPrintable(df), qPrintable(
Datum::errorString()));
} else } else
ok = true;
}
}
if (!ok)
qWarning("Maps based on a datum different from WGS84 won't work."); qWarning("Maps based on a datum different from WGS84 won't work.");
} }
@ -123,12 +104,5 @@ void App::loadPCSs()
return; return;
} }
if (!PCS::loadList(file)) { PCS::loadList(file);
if (PCS::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(file),
PCS::errorLine(), qPrintable(PCS::errorString()));
else
qWarning("%s: %s", qPrintable(file), qPrintable(
Datum::errorString()));
}
} }

View File

@ -13,7 +13,7 @@
#define FONT_SIZE 12 // px #define FONT_SIZE 12 // px
#define ELLIPSOID_FILE QString("ellipsoids.csv") #define ELLIPSOID_FILE QString("ellipsoids.csv")
#define DATUM_FILE QString("datums.csv") #define GCS_FILE QString("gcs.csv")
#define PCS_FILE QString("pcs.csv") #define PCS_FILE QString("pcs.csv")
#define MAP_FILE QString("maps.txt") #define MAP_FILE QString("maps.txt")
#define MAP_DIR QString("maps") #define MAP_DIR QString("maps")
@ -32,12 +32,12 @@
#endif #endif
#define USER_ELLIPSOID_FILE USER_DIR + QString("/") + ELLIPSOID_FILE #define USER_ELLIPSOID_FILE USER_DIR + QString("/") + ELLIPSOID_FILE
#define USER_DATUM_FILE USER_DIR + QString("/") + DATUM_FILE #define USER_GCS_FILE USER_DIR + QString("/") + GCS_FILE
#define USER_PCS_FILE USER_DIR + QString("/") + PCS_FILE #define USER_PCS_FILE USER_DIR + QString("/") + PCS_FILE
#define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR #define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR
#define USER_POI_DIR USER_DIR + QString("/") + POI_DIR #define USER_POI_DIR USER_DIR + QString("/") + POI_DIR
#define GLOBAL_ELLIPSOID_FILE GLOBAL_DIR + QString("/") + ELLIPSOID_FILE #define GLOBAL_ELLIPSOID_FILE GLOBAL_DIR + QString("/") + ELLIPSOID_FILE
#define GLOBAL_DATUM_FILE GLOBAL_DIR + QString("/") + DATUM_FILE #define GLOBAL_GCS_FILE GLOBAL_DIR + QString("/") + GCS_FILE
#define GLOBAL_PCS_FILE GLOBAL_DIR + QString("/") + PCS_FILE #define GLOBAL_PCS_FILE GLOBAL_DIR + QString("/") + PCS_FILE
#define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR #define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR
#define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR #define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR

View File

@ -56,7 +56,7 @@ Defense.
((clat) / sqrt(one_minus_sqr_es_sin)) ((clat) / sqrt(one_minus_sqr_es_sin))
AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1, AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
double standardParallel2, double latitudeOrigin, double longitudeOrigin, double standardParallel2, double latitudeOrigin, double longitudeOrigin,
double falseEasting, double falseNorthing) double falseEasting, double falseNorthing)
{ {
@ -78,7 +78,7 @@ AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
sp1 = deg2rad(standardParallel1); sp1 = deg2rad(standardParallel1);
sp2 = deg2rad(standardParallel2); sp2 = deg2rad(standardParallel2);
_es2 = 2 * _e.flattening() - _e.flattening() * _e.flattening(); _es2 = 2 * _e->flattening() - _e->flattening() * _e->flattening();
_es = sqrt(_es2); _es = sqrt(_es2);
_one_minus_es2 = 1 - _es2; _one_minus_es2 = 1 - _es2;
_two_es = 2 * _es; _two_es = 2 * _es;
@ -108,7 +108,7 @@ AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
_n = sin_lat1; _n = sin_lat1;
_C = sqr_m1 + _n * q1; _C = sqr_m1 + _n * q1;
_a_over_n = _e.radius() / _n; _a_over_n = _e->radius() / _n;
nq0 = _n * q0; nq0 = _n * q0;
_rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0); _rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0);
} }
@ -171,7 +171,7 @@ Coordinates AlbersEqual::xy2ll(const QPointF &p) const
if (rho != 0.0) if (rho != 0.0)
theta = atan2(dx, rho0_minus_dy); theta = atan2(dx, rho0_minus_dy);
rho_n = rho * _n; rho_n = rho * _n;
q = (_C - (rho_n * rho_n) / (_e.radius() * _e.radius())) / _n; q = (_C - (rho_n * rho_n) / (_e->radius() * _e->radius())) / _n;
qc = 1 - ((_one_minus_es2) / (_two_es)) * log((1.0 - _es) / (1.0 + _es)); qc = 1 - ((_one_minus_es2) / (_two_es)) * log((1.0 - _es) / (1.0 + _es));
if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) { if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) {
q_over_2 = q / 2.0; q_over_2 = q / 2.0;

View File

@ -7,7 +7,7 @@
class AlbersEqual : public Projection class AlbersEqual : public Projection
{ {
public: public:
AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1, AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
double standardParallel2, double latitudeOrigin, double longitudeOrigin, double standardParallel2, double latitudeOrigin, double longitudeOrigin,
double falseEasting, double falseNorthing); double falseEasting, double falseNorthing);
@ -15,7 +15,7 @@ public:
virtual Coordinates xy2ll(const QPointF &p) const; virtual Coordinates xy2ll(const QPointF &p) const;
private: private:
Ellipsoid _e; const Ellipsoid *_e;
double _latitudeOrigin; double _latitudeOrigin;
double _longitudeOrigin; double _longitudeOrigin;

41
src/map/angularunits.cpp Normal file
View File

@ -0,0 +1,41 @@
#include "common/coordinates.h"
#include "angularunits.h"
AngularUnits::AngularUnits(int code)
{
switch (code) {
case 9101:
_f = 180.0 / M_PI;
break;
case 9102:
case 9107:
case 9108:
case 9110:
case 9122:
_f = 1.0;
break;
case 9103:
_f = 1 / 60.0;
break;
case 9104:
_f = 1 / 3600.0;
break;
case 9105:
_f = 180.0 / 200.0;
break;
case 9106:
_f = 180.0 / 200.0;
break;
case 9109:
_f = 180.0 / (M_PI * 1000000.0);
break;
default:
_f = NAN;
}
}
QDebug operator<<(QDebug dbg, const AngularUnits &au)
{
dbg.nospace() << "AngularUnits(" << deg2rad(au._f) << ")";
return dbg.maybeSpace();
}

31
src/map/angularunits.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef ANGULARUNITS_H
#define ANGULARUNITS_H
#include <cmath>
#include <QDebug>
class AngularUnits
{
public:
AngularUnits() : _f(NAN) {}
AngularUnits(int code);
bool isNull() const {return std::isnan(_f);}
bool isValid() const {return !std::isnan(_f);}
double toDegrees(double val) const {return val * _f;}
double fromDegrees(double val) const {return val / _f;}
friend bool operator==(const AngularUnits &au1, const AngularUnits &au2);
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
private:
double _f;
};
inline bool operator==(const AngularUnits &au1, const AngularUnits &au2)
{return (au1._f == au2._f);}
QDebug operator<<(QDebug dbg, const AngularUnits &au);
#endif // ANGULARUNITS_H

View File

@ -1,24 +1,9 @@
#include <cmath> #include <cmath>
#include <QFile>
#include "common/wgs84.h" #include "common/wgs84.h"
#include "datum.h" #include "datum.h"
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
class Datum::Entry { static Datum WGS84 = Datum(&WGS84e, 0.0, 0.0, 0.0);
public:
Entry(const QString &name, int epsg, const Datum &datum)
: _name(name), _epsg(epsg), _datum(datum) {}
const QString &name() const {return _name;}
int epsg() const {return _epsg;}
const Datum &datum() const {return _datum;}
private:
QString _name;
int _epsg;
Datum _datum;
};
// Abridged Molodensky transformation // Abridged Molodensky transformation
static Coordinates molodensky(const Coordinates &c, const Datum &from, static Coordinates molodensky(const Coordinates &c, const Datum &from,
@ -37,11 +22,11 @@ static Coordinates molodensky(const Coordinates &c, const Datum &from,
double dy = from.dy() - to.dy(); double dy = from.dy() - to.dy();
double dz = from.dz() - to.dz(); double dz = from.dz() - to.dz();
double from_f = from.ellipsoid().flattening(); double from_f = from.ellipsoid()->flattening();
double to_f = to.ellipsoid().flattening(); double to_f = to.ellipsoid()->flattening();
double df = to_f - from_f; double df = to_f - from_f;
double from_a = from.ellipsoid().radius(); double from_a = from.ellipsoid()->radius();
double to_a = to.ellipsoid().radius(); double to_a = to.ellipsoid()->radius();
double da = to_a - from_a; double da = to_a - from_a;
double from_esq = from_f * (2.0 - from_f); double from_esq = from_f * (2.0 - from_f);
double adb = 1.0 / (1.0 - from_f); double adb = 1.0 / (1.0 - from_f);
@ -58,138 +43,25 @@ static Coordinates molodensky(const Coordinates &c, const Datum &from,
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat)); return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
} }
QList<Datum::Entry> Datum::_datums = WGS84(); Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy,
QString Datum::_errorString; double dz) : _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz)
int Datum::_errorLine = 0;
QList<Datum::Entry> Datum::WGS84()
{ {
QList<Datum::Entry> list; _WGS84 = (*this == WGS84) ? true : false;
list.append(Datum::Entry("WGS 84", 4326,
Datum(Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING), 0.0, 0.0, 0.0)));
return list;
}
Datum::Datum(const Ellipsoid &ellipsoid, double dx, double dy, double dz)
: _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz)
{
_WGS84 = (_ellipsoid.radius() == WGS84_RADIUS
&& _ellipsoid.flattening() == WGS84_FLATTENING
&& _dx == 0.0 && _dy == 0.0 && _dz == 0.0)
? true : false;
}
Datum::Datum(int id)
{
for (int i = 0; i < _datums.size(); i++) {
if (_datums.at(i).epsg() == id) {
*this = _datums.at(i).datum();
return;
}
}
*this = Datum();
}
Datum::Datum(const QString &name)
{
for (int i = 0; i < _datums.size(); i++) {
if (_datums.at(i).name() == name) {
*this = _datums.at(i).datum();
return;
}
}
*this = Datum();
}
void Datum::error(const QString &str)
{
_errorString = str;
_datums = WGS84();
}
bool Datum::loadList(const QString &path)
{
QFile file(path);
bool res;
if (!file.open(QFile::ReadOnly)) {
error(file.errorString());
return false;
}
_errorLine = 1;
_errorString.clear();
while (!file.atEnd()) {
QByteArray line = file.readLine();
QList<QByteArray> list = line.split(',');
if (list.size() != 6) {
error("Format error");
return false;
}
QString f1 = list[1].trimmed();
int id = 0;
if (!f1.isEmpty()) {
id = f1.toInt(&res);
if (!res) {
error("Invalid datum id");
return false;
}
}
int eid = list[2].trimmed().toInt(&res);
if (!res) {
error("Invalid ellipsoid id");
return false;
}
double dx = list[3].trimmed().toDouble(&res);
if (!res) {
error("Invalid dx");
return false;
}
double dy = list[4].trimmed().toDouble(&res);
if (!res) {
error("Invalid dy");
return false;
}
double dz = list[5].trimmed().toDouble(&res);
if (!res) {
error("Invalid dz");
return false;
}
Ellipsoid e(eid);
if (e.isNull()) {
error("Unknown ellipsoid ID");
return false;
}
Datum d(e, dx, dy, dz);
_datums.append(Entry(list[0].trimmed(), id, d));
_errorLine++;
}
return true;
} }
Coordinates Datum::toWGS84(const Coordinates &c) const Coordinates Datum::toWGS84(const Coordinates &c) const
{ {
return _WGS84 ? c : molodensky(c, *this, Datum(Ellipsoid(WGS84_RADIUS, return _WGS84 ? c : molodensky(c, *this, WGS84);
WGS84_FLATTENING), 0.0, 0.0, 0.0));
} }
Coordinates Datum::fromWGS84(const Coordinates &c) const Coordinates Datum::fromWGS84(const Coordinates &c) const
{ {
return _WGS84 ? c : molodensky(c, Datum(Ellipsoid(WGS84_RADIUS, return _WGS84 ? c : molodensky(c, WGS84, *this);
WGS84_FLATTENING), 0.0, 0.0, 0.0), *this);
} }
QDebug operator<<(QDebug dbg, const Datum &datum) QDebug operator<<(QDebug dbg, const Datum &datum)
{ {
dbg.nospace() << "Datum(" << datum.ellipsoid() << ", " << datum.dx() << ", " dbg.nospace() << "Datum(" << datum.ellipsoid() << ", " << datum.dx() << ", "
<< datum.dy() << ", " << datum.dz() << ")"; << datum.dy() << ", " << datum.dz() << ")";
return dbg.space(); return dbg.maybeSpace();
} }

View File

@ -10,43 +10,35 @@
class Datum class Datum
{ {
public: public:
Datum() : _ellipsoid(Ellipsoid()), _dx(NAN), _dy(NAN), _dz(NAN), Datum() : _ellipsoid(0), _dx(NAN), _dy(NAN), _dz(NAN),
_WGS84(false) {} _WGS84(false) {}
Datum(const Ellipsoid &ellipsoid, double dx, double dy, double dz); Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz);
Datum(const QString &name);
Datum(int id);
const Ellipsoid &ellipsoid() const {return _ellipsoid;} const Ellipsoid *ellipsoid() const {return _ellipsoid;}
double dx() const {return _dx;} double dx() const {return _dx;}
double dy() const {return _dy;} double dy() const {return _dy;}
double dz() const {return _dz;} double dz() const {return _dz;}
bool isNull() const bool isNull() const
{return (_ellipsoid.isNull() && std::isnan(_dx) && std::isnan(_dy) {return (!_ellipsoid && std::isnan(_dx) && std::isnan(_dy)
&& std::isnan(_dz));} && std::isnan(_dz));}
bool isValid() const
{return (_ellipsoid && !std::isnan(_dx) && !std::isnan(_dy)
&& !std::isnan(_dz));}
Coordinates toWGS84(const Coordinates &c) const; Coordinates toWGS84(const Coordinates &c) const;
Coordinates fromWGS84(const Coordinates &c) const; Coordinates fromWGS84(const Coordinates &c) const;
static bool loadList(const QString &path);
static const QString &errorString() {return _errorString;}
static int errorLine() {return _errorLine;}
private: private:
class Entry; const Ellipsoid *_ellipsoid;
static QList<Entry> WGS84();
static void error(const QString &str);
Ellipsoid _ellipsoid;
double _dx, _dy, _dz; double _dx, _dy, _dz;
bool _WGS84; bool _WGS84;
static QList<Entry> _datums;
static QString _errorString;
static int _errorLine;
}; };
inline bool operator==(const Datum &d1, const Datum &d2)
{return (d1.ellipsoid() == d2.ellipsoid() && d1.dx() == d2.dx()
&& d1.dy() == d2.dy() && d1.dz() == d2.dz());}
QDebug operator<<(QDebug dbg, const Datum &datum); QDebug operator<<(QDebug dbg, const Datum &datum);
#endif // DATUM_H #endif // DATUM_H

View File

@ -1,77 +1,74 @@
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
#include "common/wgs84.h"
#include "ellipsoid.h" #include "ellipsoid.h"
QMap<int, Ellipsoid> Ellipsoid::_ellipsoids; QMap<int, Ellipsoid> Ellipsoid::_ellipsoids = WGS84();
QString Ellipsoid::_errorString;
int Ellipsoid::_errorLine = 0;
Ellipsoid::Ellipsoid(int id) QMap<int, Ellipsoid> Ellipsoid::WGS84()
{
QMap<int, Ellipsoid> map;
map.insert(7030, Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING));
return map;
}
const Ellipsoid *Ellipsoid::ellipsoid(int id)
{ {
QMap<int, Ellipsoid>::const_iterator it = _ellipsoids.find(id); QMap<int, Ellipsoid>::const_iterator it = _ellipsoids.find(id);
if (it == _ellipsoids.end()) if (it == _ellipsoids.end())
*this = Ellipsoid(); return 0;
else else
*this = it.value(); return &(it.value());
} }
void Ellipsoid::error(const QString &str) void Ellipsoid::loadList(const QString &path)
{
_errorString = str;
_ellipsoids.clear();
}
bool Ellipsoid::loadList(const QString &path)
{ {
QFile file(path); QFile file(path);
bool res; bool res;
int ln = 0;
if (!file.open(QFile::ReadOnly)) { if (!file.open(QFile::ReadOnly)) {
error(file.errorString()); qWarning("Error opening ellipsoids file: %s: %s", qPrintable(path),
return false; qPrintable(file.errorString()));
return;
} }
_errorLine = 1;
_errorString.clear();
while (!file.atEnd()) { while (!file.atEnd()) {
ln++;
QByteArray line = file.readLine(); QByteArray line = file.readLine();
QList<QByteArray> list = line.split(','); QList<QByteArray> list = line.split(',');
if (list.size() != 4) { if (list.size() != 4) {
error("Format error"); qWarning("%s: %d: Format error", qPrintable(path), ln);
return false; continue;
} }
int id = list[1].trimmed().toInt(&res); int id = list[1].trimmed().toInt(&res);
if (!res) { if (!res) {
error("Invalid ellipsoid id"); qWarning("%s: %d: Invalid ellipsoid code", qPrintable(path), ln);
return false; continue;
} }
double radius = list[2].trimmed().toDouble(&res); double radius = list[2].trimmed().toDouble(&res);
if (!res) { if (!res) {
error("Invalid ellipsoid radius"); qWarning("%s: %d: Invalid radius", qPrintable(path), ln);
return false; continue;
} }
double flattening = list[3].trimmed().toDouble(&res); double flattening = list[3].trimmed().toDouble(&res);
if (!res) { if (!res) {
error("Invalid ellipsoid flattening"); qWarning("%s: %d: Invalid flattening", qPrintable(path), ln);
return false; continue;
} }
Ellipsoid e(radius, 1.0/flattening); Ellipsoid e(radius, 1.0/flattening);
_ellipsoids.insert(id, e); _ellipsoids.insert(id, e);
_errorLine++;
} }
return true;
} }
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid) QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid)
{ {
dbg.nospace() << "Ellipsoid(" << ellipsoid.radius() << ", " dbg.nospace() << "Ellipsoid(" << ellipsoid.radius() << ", "
<< 1.0 / ellipsoid.flattening() << ")"; << 1.0 / ellipsoid.flattening() << ")";
return dbg.space(); return dbg.maybeSpace();
} }

View File

@ -12,29 +12,29 @@ public:
Ellipsoid() : _radius(NAN), _flattening(NAN) {} Ellipsoid() : _radius(NAN), _flattening(NAN) {}
Ellipsoid(double radius, double flattening) Ellipsoid(double radius, double flattening)
: _radius(radius), _flattening(flattening) {} : _radius(radius), _flattening(flattening) {}
Ellipsoid(int id);
double radius() const {return _radius;} double radius() const {return _radius;}
double flattening() const {return _flattening;} double flattening() const {return _flattening;}
bool isNull() const bool isNull() const
{return (std::isnan(_radius) && std::isnan(_flattening));} {return (std::isnan(_radius) && std::isnan(_flattening));}
bool isValid() const
{return !(std::isnan(_radius) || std::isnan(_flattening));}
static bool loadList(const QString &path); static const Ellipsoid *ellipsoid(int id);
static const QString &errorString() {return _errorString;} static void loadList(const QString &path);
static int errorLine() {return _errorLine;}
private: private:
static void error(const QString &str);
double _radius; double _radius;
double _flattening; double _flattening;
static QMap<int, Ellipsoid> WGS84();
static QMap<int, Ellipsoid> _ellipsoids; static QMap<int, Ellipsoid> _ellipsoids;
static QString _errorString;
static int _errorLine;
}; };
inline bool operator==(const Ellipsoid &e1, const Ellipsoid &e2)
{return (e1.radius() == e2.radius() && e1.flattening() == e2.flattening());}
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid); QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid);
#endif // ELLIPSOID_H #endif // ELLIPSOID_H

191
src/map/gcs.cpp Normal file
View File

@ -0,0 +1,191 @@
#include <QFile>
#include "common/wgs84.h"
#include "gcs.h"
class GCS::Entry {
public:
Entry(int id, int gd, const QString &name, const GCS &gcs)
: _id(id), _gd(gd), _name(name), _gcs(gcs) {}
int id() const {return _id;}
int gd() const {return _gd;}
const QString &name() const {return _name;}
const GCS &gcs() const {return _gcs;}
private:
int _id, _gd;
QString _name;
GCS _gcs;
};
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
static Datum WGS84d = Datum(&WGS84e, 0.0, 0.0, 0.0);
static int parameter(const QString &str, bool *res)
{
QString field = str.trimmed();
if (field.isEmpty()) {
*res = true;
return 0;
}
return field.toInt(res);
}
QList<GCS::Entry> GCS::_gcss = WGS84();
QList<GCS::Entry> GCS::WGS84()
{
QList<GCS::Entry> list;
list.append(GCS::Entry(4326, 6326, "WGS 84", GCS(WGS84d, 8901, 9122)));
return list;
}
const GCS *GCS::gcs(int id)
{
for (int i = 0; i < _gcss.size(); i++)
if (_gcss.at(i).id() == id)
return &(_gcss.at(i).gcs());
return 0;
}
const GCS *GCS::gcs(int geodeticDatum, int primeMeridian, int angularUnits)
{
for (int i = 0; i < _gcss.size(); i++) {
const Entry &e = _gcss.at(i);
if (e.gd() == geodeticDatum && e.gcs().primeMeridian() == primeMeridian
&& e.gcs().angularUnits() == angularUnits)
return &(e.gcs());
}
return 0;
}
const GCS *GCS::gcs(const QString &name)
{
for (int i = 0; i < _gcss.size(); i++)
if (_gcss.at(i).name() == name)
return &(_gcss.at(i).gcs());
return 0;
}
void GCS::loadList(const QString &path)
{
QFile file(path);
bool res;
int ln = 0;
const Ellipsoid *e;
if (!file.open(QFile::ReadOnly)) {
qWarning("Error opening PCS file: %s: %s", qPrintable(path),
qPrintable(file.errorString()));
return;
}
while (!file.atEnd()) {
ln++;
QByteArray line = file.readLine();
QList<QByteArray> list = line.split(',');
if (list.size() < 10) {
qWarning("%s: %d: Format error", qPrintable(path), ln);
continue;
}
int id = parameter(list[1], &res);
if (!res) {
qWarning("%s: %d: Invalid GCS code", qPrintable(path), ln);
continue;
}
int gd = parameter(list[2], &res);
if (!res) {
qWarning("%s: %d: Invalid geodetic datum code", qPrintable(path),
ln);
continue;
}
int au = list[3].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid angular units code", qPrintable(path),
ln);
continue;
}
int el = list[4].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid ellipsoid code", qPrintable(path), ln);
continue;
}
int pm = list[5].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid prime meridian code", qPrintable(path),
ln);
continue;
}
int ct = list[6].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid coordinates transformation code",
qPrintable(path), ln);
continue;
}
double dx = list[7].trimmed().toDouble(&res);
if (!res) {
qWarning("%s: %d: Invalid dx", qPrintable(path), ln);
continue;
}
double dy = list[8].trimmed().toDouble(&res);
if (!res) {
qWarning("%s: %d: Invalid dy", qPrintable(path), ln);
continue;
}
double dz = list[9].trimmed().toDouble(&res);
if (!res) {
qWarning("%s: %d: Invalid dz", qPrintable(path), ln);
continue;
}
if (!(e = Ellipsoid::ellipsoid(el))) {
qWarning("%s: %d: Unknown ellipsoid code", qPrintable(path), ln);
continue;
}
Datum datum;
switch (ct) {
case 9603:
datum = Datum(e, dx, dy, dz);
break;
default:
qWarning("%s: %d: Unknown coordinates transformation method",
qPrintable(path), ln);
continue;
}
GCS gcs(datum, pm, au);
if (gcs.isValid())
_gcss.append(Entry(id, gd, list[0].trimmed(), gcs));
else
qWarning("%s: %d: Unknown prime meridian/angular units code",
qPrintable(path), ln);
}
}
Coordinates GCS::toWGS84(const Coordinates &c) const
{
return datum().toWGS84(Coordinates(_primeMeridian.toGreenwich(c.lon()),
c.lat()));
}
Coordinates GCS::fromWGS84(const Coordinates &c) const
{
Coordinates ds(datum().fromWGS84(c));
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
}
QDebug operator<<(QDebug dbg, const GCS &gcs)
{
dbg.nospace() << "GCS(" << gcs.datum() << ", " << gcs.primeMeridian()
<< ", " << gcs.angularUnits() << ")";
return dbg.maybeSpace();
}

55
src/map/gcs.h Normal file
View File

@ -0,0 +1,55 @@
#ifndef GCS_H
#define GCS_H
#include "datum.h"
#include "angularunits.h"
#include "primemeridian.h"
class GCS
{
public:
GCS() {}
GCS(const Datum &datum, const PrimeMeridian &primeMeridian,
const AngularUnits &angularUnits) : _datum(datum),
_primeMeridian(primeMeridian), _angularUnits(angularUnits) {}
const PrimeMeridian &primeMeridian() const {return _primeMeridian;}
const AngularUnits &angularUnits() const {return _angularUnits;}
const Datum &datum() const {return _datum;}
bool isNull() const {return _datum.isNull() && _angularUnits.isNull()
&& _primeMeridian.isNull();}
bool isValid() const {return _datum.isValid() && _angularUnits.isValid()
&& _primeMeridian.isValid();}
Coordinates toWGS84(const Coordinates &c) const;
Coordinates fromWGS84(const Coordinates &c) const;
static const GCS *gcs(int id);
static const GCS *gcs(int geodeticDatum, int primeMeridian,
int angularUnits);
static const GCS *gcs(const QString &name);
static void loadList(const QString &path);
private:
class Entry;
static QList<Entry> WGS84();
Datum _datum;
PrimeMeridian _primeMeridian;
AngularUnits _angularUnits;
static QList<Entry> _gcss;
};
inline bool operator==(const GCS &gcs1, const GCS &gcs2)
{return (gcs1.datum() == gcs2.datum()
&& gcs1.primeMeridian() == gcs2.primeMeridian()
&& gcs1.angularUnits() == gcs2.angularUnits());}
QDebug operator<<(QDebug dbg, const GCS &gcs);
#endif // GCS_H

View File

@ -21,7 +21,8 @@
#define GTRasterTypeGeoKey 1025 #define GTRasterTypeGeoKey 1025
#define GeographicTypeGeoKey 2048 #define GeographicTypeGeoKey 2048
#define GeogGeodeticDatumGeoKey 2050 #define GeogGeodeticDatumGeoKey 2050
#define GeogEllipsoidGeoKey 2056 #define GeogPrimeMeridianGeoKey 2051
#define GeogAngularUnitsGeoKey 2054
#define ProjectedCSTypeGeoKey 3072 #define ProjectedCSTypeGeoKey 3072
#define ProjectionGeoKey 3074 #define ProjectionGeoKey 3074
#define ProjCoordTransGeoKey 3075 #define ProjCoordTransGeoKey 3075
@ -218,7 +219,8 @@ bool GeoTIFF::readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const
case GTRasterTypeGeoKey: case GTRasterTypeGeoKey:
case GeogGeodeticDatumGeoKey: case GeogGeodeticDatumGeoKey:
case ProjectionGeoKey: case ProjectionGeoKey:
case GeogEllipsoidGeoKey: case GeogPrimeMeridianGeoKey:
case GeogAngularUnitsGeoKey:
if (entry.TIFFTagLocation != 0 || entry.Count != 1) if (entry.TIFFTagLocation != 0 || entry.Count != 1)
return false; return false;
value.SHORT = entry.ValueOffset; value.SHORT = entry.ValueOffset;
@ -260,80 +262,84 @@ bool GeoTIFF::readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
return true; return true;
} }
Datum GeoTIFF::datum(QMap<quint16, Value> &kv) const GCS *GeoTIFF::gcs(QMap<quint16, Value> &kv)
{ {
Datum datum; const GCS *gcs;
if (IS_SET(kv, GeographicTypeGeoKey)) { if (IS_SET(kv, GeographicTypeGeoKey)) {
datum = Datum(kv.value(GeographicTypeGeoKey).SHORT); if (!(gcs = GCS::gcs(kv.value(GeographicTypeGeoKey).SHORT)))
if (datum.isNull())
_errorString = QString("%1: unknown GCS") _errorString = QString("%1: unknown GCS")
.arg(kv.value(GeographicTypeGeoKey).SHORT); .arg(kv.value(GeographicTypeGeoKey).SHORT);
} else if (IS_SET(kv, GeogGeodeticDatumGeoKey)) { } else if (IS_SET(kv, GeogGeodeticDatumGeoKey)) {
datum = Datum(kv.value(GeogGeodeticDatumGeoKey).SHORT - 2000); int pm = IS_SET(kv, GeogPrimeMeridianGeoKey)
if (datum.isNull()) ? kv.value(GeogPrimeMeridianGeoKey).SHORT : 8901;
_errorString = QString("%1: unknown geodetic datum") int au = IS_SET(kv, GeogAngularUnitsGeoKey)
.arg(kv.value(GeogGeodeticDatumGeoKey).SHORT); ? kv.value(GeogAngularUnitsGeoKey).SHORT : 9122;
} else if (IS_SET(kv, GeogEllipsoidGeoKey)
&& kv.value(GeogEllipsoidGeoKey).SHORT == 7019) {
datum = Datum(4326);
} else
_errorString = "Missing datum";
return datum; if (!(gcs = GCS::gcs(kv.value(GeogGeodeticDatumGeoKey).SHORT, pm, au)))
_errorString = QString("%1+%2: unknown geodetic datum + prime"
" meridian combination")
.arg(kv.value(GeogGeodeticDatumGeoKey).SHORT)
.arg(kv.value(GeogPrimeMeridianGeoKey).SHORT);
} else
_errorString = "Can not determine GCS";
return gcs;
} }
Projection::Method GeoTIFF::method(QMap<quint16, Value> &kv) Projection::Method GeoTIFF::method(QMap<quint16, Value> &kv)
{ {
int epsg;
int table[] = {0, 9807, 0, 0, 0, 0, 0, 1024, 9801, 9802, 9820,
9822};
if (!IS_SET(kv, ProjCoordTransGeoKey)) { if (!IS_SET(kv, ProjCoordTransGeoKey)) {
_errorString = "Missing coordinate transformation method"; _errorString = "Missing coordinate transformation method";
return Projection::Method(); return Projection::Method();
} }
quint16 index = kv.value(ProjCoordTransGeoKey).SHORT; switch (kv.value(ProjCoordTransGeoKey).SHORT) {
epsg = (index >= ARRAY_SIZE(table)) ? 0 : table[index]; case 1:
return Projection::Method(9807);
if (!epsg) { case 7:
_errorString = QString("Unknown coordinate transformation method"); return Projection::Method(1024);
case 8:
return Projection::Method(9801);
case 9:
return Projection::Method(9802);
case 10:
return Projection::Method(9820);
case 11:
return Projection::Method(9822);
default:
_errorString = QString("%1: unknown coordinate transformation method")
.arg(kv.value(ProjCoordTransGeoKey).SHORT);
return Projection::Method(); return Projection::Method();
} }
return Projection::Method(epsg);
} }
bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv) bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
{ {
PCS pcs;
if (IS_SET(kv, ProjectedCSTypeGeoKey)) { if (IS_SET(kv, ProjectedCSTypeGeoKey)) {
pcs = PCS(kv.value(ProjectedCSTypeGeoKey).SHORT); const PCS *pcs;
if (pcs.isNull()) if (!(pcs = PCS::pcs(kv.value(ProjectedCSTypeGeoKey).SHORT))) {
_errorString = QString("%1: unknown PCS") _errorString = QString("%1: unknown PCS")
.arg(kv.value(ProjectedCSTypeGeoKey).SHORT); .arg(kv.value(ProjectedCSTypeGeoKey).SHORT);
} else if (IS_SET(kv, GeographicTypeGeoKey) return false;
&& IS_SET(kv, ProjectionGeoKey)) { }
pcs = PCS(kv.value(GeographicTypeGeoKey).SHORT, _gcs = pcs->gcs();
kv.value(ProjectionGeoKey).SHORT); _projection = Projection::projection(_gcs->datum(), pcs->method(),
if (pcs.isNull()) pcs->setup());
_errorString = QString("%1+%2: unknown GCS+projection combination") } else if (IS_SET(kv, ProjectionGeoKey)) {
if (!(_gcs = gcs(kv)))
return false;
const PCS *pcs;
if (!(pcs = PCS::pcs(_gcs, kv.value(ProjectionGeoKey).SHORT))) {
_errorString = QString("%1: unknown projection code")
.arg(kv.value(GeographicTypeGeoKey).SHORT) .arg(kv.value(GeographicTypeGeoKey).SHORT)
.arg(kv.value(ProjectionGeoKey).SHORT); .arg(kv.value(ProjectionGeoKey).SHORT);
} else if (IS_SET(kv, GeogGeodeticDatumGeoKey) return false;
&& IS_SET(kv, ProjectionGeoKey)) { }
pcs = PCS(kv.value(GeogGeodeticDatumGeoKey).SHORT - 2000, _projection = Projection::projection(_gcs->datum(), pcs->method(),
kv.value(ProjectionGeoKey).SHORT); pcs->setup());
if (pcs.isNull())
_errorString =
QString("%1+%2: unknown geodetic datum+projection combination")
.arg(kv.value(GeogGeodeticDatumGeoKey).SHORT)
.arg(kv.value(ProjectionGeoKey).SHORT);
} else { } else {
Datum d = datum(kv); if (!(_gcs = gcs(kv)))
if (d.isNull())
return false; return false;
Projection::Method m = method(kv); Projection::Method m = method(kv);
if (m.isNull()) if (m.isNull())
@ -348,24 +354,18 @@ bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
kv.value(ProjStdParallel1GeoKey).DOUBLE, kv.value(ProjStdParallel1GeoKey).DOUBLE,
kv.value(ProjStdParallel2GeoKey).DOUBLE kv.value(ProjStdParallel2GeoKey).DOUBLE
); );
_projection = Projection::projection(_gcs->datum(), m, setup);
pcs = PCS(d, m, setup);
} }
_datum = pcs.datum();
_projection = Projection::projection(pcs.datum(), pcs.method(),
pcs.setup());
return true; return true;
} }
bool GeoTIFF::geographicModel(QMap<quint16, Value> &kv) bool GeoTIFF::geographicModel(QMap<quint16, Value> &kv)
{ {
_datum = datum(kv); if (!(_gcs = gcs(kv)))
if (_datum.isNull())
return false; return false;
_projection = new LatLon(); _projection = new LatLon(_gcs->angularUnits());
return true; return true;
} }

View File

@ -4,7 +4,7 @@
#include <QTransform> #include <QTransform>
#include <QFile> #include <QFile>
#include <QMap> #include <QMap>
#include "datum.h" #include "gcs.h"
#include "projection.h" #include "projection.h"
#include "tifffile.h" #include "tifffile.h"
#include "transform.h" #include "transform.h"
@ -16,7 +16,7 @@ public:
bool load(const QString &path); bool load(const QString &path);
const Datum &datum() const {return _datum;} const GCS *gcs() const {return _gcs;}
Projection *projection() const {return _projection;} Projection *projection() const {return _projection;}
const QTransform &transform() const {return _transform;} const QTransform &transform() const {return _transform;}
@ -50,13 +50,13 @@ private:
bool readGeoValue(TIFFFile &file, quint32 offset, quint16 index, bool readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
double &val) const; double &val) const;
Datum datum(QMap<quint16, Value> &kv); const GCS *gcs(QMap<quint16, Value> &kv);
Projection::Method method(QMap<quint16, Value> &kv); Projection::Method method(QMap<quint16, Value> &kv);
bool geographicModel(QMap<quint16, Value> &kv); bool geographicModel(QMap<quint16, Value> &kv);
bool projectedModel(QMap<quint16, Value> &kv); bool projectedModel(QMap<quint16, Value> &kv);
QTransform _transform; QTransform _transform;
Datum _datum; const GCS *_gcs;
Projection *_projection; Projection *_projection;
QString _errorString; QString _errorString;

View File

@ -48,18 +48,18 @@ Defense.
#define M_PI_2 1.57079632679489661923 #define M_PI_2 1.57079632679489661923
#endif // M_PI_2 #endif // M_PI_2
LambertAzimuthal::LambertAzimuthal(const Ellipsoid &ellipsoid, LambertAzimuthal::LambertAzimuthal(const Ellipsoid *ellipsoid,
double latitudeOrigin, double longitudeOrigin, double falseEasting, double latitudeOrigin, double longitudeOrigin, double falseEasting,
double falseNorthing) double falseNorthing)
{ {
double es2, es4, es6; double es2, es4, es6;
es2 = 2 * ellipsoid.flattening() - ellipsoid.flattening() es2 = 2 * ellipsoid->flattening() - ellipsoid->flattening()
* ellipsoid.flattening(); * ellipsoid->flattening();
es4 = es2 * es2; es4 = es2 * es2;
es6 = es4 * es2; es6 = es4 * es2;
_ra = ellipsoid.radius() * (1.0 - es2 / 6.0 - 17.0 * es4 / 360.0 - 67.0 _ra = ellipsoid->radius() * (1.0 - es2 / 6.0 - 17.0 * es4 / 360.0 - 67.0
* es6 / 3024.0); * es6 / 3024.0);
_latOrigin = deg2rad(latitudeOrigin); _latOrigin = deg2rad(latitudeOrigin);
_sinLatOrigin = sin(_latOrigin); _sinLatOrigin = sin(_latOrigin);

View File

@ -7,7 +7,7 @@
class LambertAzimuthal : public Projection class LambertAzimuthal : public Projection
{ {
public: public:
LambertAzimuthal(const Ellipsoid &ellipsoid, double latitudeOrigin, LambertAzimuthal(const Ellipsoid *ellipsoid, double latitudeOrigin,
double longitudeOrigin, double falseEasting, double falseNorthing); double longitudeOrigin, double falseEasting, double falseNorthing);
virtual QPointF ll2xy(const Coordinates &c) const; virtual QPointF ll2xy(const Coordinates &c) const;

View File

@ -58,7 +58,7 @@ Defense.
(tan(M_PI_4 - lat / 2) / pow((1.0 - essin) / (1.0 + essin), es_over_2)) (tan(M_PI_4 - lat / 2) / pow((1.0 - essin) / (1.0 + essin), es_over_2))
LambertConic1::LambertConic1(const Ellipsoid &ellipsoid, double latitudeOrigin, LambertConic1::LambertConic1(const Ellipsoid *ellipsoid, double latitudeOrigin,
double longitudeOrigin, double scale, double falseEasting, double longitudeOrigin, double scale, double falseEasting,
double falseNorthing) double falseNorthing)
{ {
@ -76,8 +76,8 @@ LambertConic1::LambertConic1(const Ellipsoid &ellipsoid, double latitudeOrigin,
_falseEasting = falseEasting; _falseEasting = falseEasting;
_falseNorthing = falseNorthing; _falseNorthing = falseNorthing;
es2 = 2.0 * ellipsoid.flattening() - ellipsoid.flattening() es2 = 2.0 * ellipsoid->flattening() - ellipsoid->flattening()
* ellipsoid.flattening(); * ellipsoid->flattening();
_es = sqrt(es2); _es = sqrt(es2);
_es_over_2 = _es / 2.0; _es_over_2 = _es / 2.0;
@ -87,7 +87,7 @@ LambertConic1::LambertConic1(const Ellipsoid &ellipsoid, double latitudeOrigin,
m0 = LAMBERT_m(cos(lat_orig), es_sin); m0 = LAMBERT_m(cos(lat_orig), es_sin);
_t0 = LAMBERT1_t(lat_orig, es_sin, _es_over_2); _t0 = LAMBERT1_t(lat_orig, es_sin, _es_over_2);
_rho0 = ellipsoid.radius() * scale * m0 / _n; _rho0 = ellipsoid->radius() * scale * m0 / _n;
_rho_olat = _rho0; _rho_olat = _rho0;
} }
@ -202,7 +202,7 @@ Coordinates LambertConic1::xy2ll(const QPointF &p) const
return Coordinates(rad2deg(lon), rad2deg(lat)); return Coordinates(rad2deg(lon), rad2deg(lat));
} }
LambertConic2::LambertConic2(const Ellipsoid &ellipsoid, LambertConic2::LambertConic2(const Ellipsoid *ellipsoid,
double standardParallel1, double standardParallel2, double latitudeOrigin, double standardParallel1, double standardParallel2, double latitudeOrigin,
double longitudeOrigin, double falseEasting, double falseNorthing) double longitudeOrigin, double falseEasting, double falseNorthing)
{ {
@ -226,8 +226,8 @@ LambertConic2::LambertConic2(const Ellipsoid &ellipsoid,
sp2 = deg2rad(standardParallel2); sp2 = deg2rad(standardParallel2);
if (fabs(sp1 - sp2) > 1.0e-10) { if (fabs(sp1 - sp2) > 1.0e-10) {
es2 = 2 * ellipsoid.flattening() - ellipsoid.flattening() es2 = 2 * ellipsoid->flattening() - ellipsoid->flattening()
* ellipsoid.flattening(); * ellipsoid->flattening();
es = sqrt(es2); es = sqrt(es2);
es_over_2 = es / 2.0; es_over_2 = es / 2.0;
@ -252,7 +252,7 @@ LambertConic2::LambertConic2(const Ellipsoid &ellipsoid,
k0 = (m1 / m0) * (pow(t0 / t1, n)); k0 = (m1 / m0) * (pow(t0 / t1, n));
const_value = ((ellipsoid.radius() * m2) / (n * pow(t2, n))); const_value = ((ellipsoid->radius() * m2) / (n * pow(t2, n)));
falseNorthing += (const_value * pow(t_olat, n)) - (const_value falseNorthing += (const_value * pow(t_olat, n)) - (const_value
* pow(t0, n)); * pow(t0, n));

View File

@ -8,7 +8,7 @@ class LambertConic1 : public Projection
{ {
public: public:
LambertConic1() {} LambertConic1() {}
LambertConic1(const Ellipsoid &ellipsoid, double latitudeOrigin, LambertConic1(const Ellipsoid *ellipsoid, double latitudeOrigin,
double longitudeOrigin, double scale, double falseEasting, double longitudeOrigin, double scale, double falseEasting,
double falseNorthing); double falseNorthing);
@ -31,7 +31,7 @@ private:
class LambertConic2 : public Projection class LambertConic2 : public Projection
{ {
public: public:
LambertConic2(const Ellipsoid &ellipsoid, double standardParallel1, LambertConic2(const Ellipsoid *ellipsoid, double standardParallel1,
double standardParallel2, double latitudeOrigin, double longitudeOrigin, double standardParallel2, double latitudeOrigin, double longitudeOrigin,
double falseEasting, double falseNorthing); double falseEasting, double falseNorthing);

View File

@ -2,14 +2,20 @@
#define LATLON_H #define LATLON_H
#include "projection.h" #include "projection.h"
#include "angularunits.h"
class LatLon : public Projection class LatLon : public Projection
{ {
public: public:
LatLon(const AngularUnits &au) : _au(au) {}
virtual QPointF ll2xy(const Coordinates &c) const virtual QPointF ll2xy(const Coordinates &c) const
{return QPointF(c.lon(), c.lat());} {return QPointF(_au.fromDegrees(c.lon()), _au.fromDegrees(c.lat()));}
virtual Coordinates xy2ll(const QPointF &p) const virtual Coordinates xy2ll(const QPointF &p) const
{return Coordinates(p.x(), p.y());} {return Coordinates(_au.toDegrees(p.x()), _au.toDegrees(p.y()));}
private:
AngularUnits _au;
}; };
#endif // LATLON_H #endif // LATLON_H

View File

@ -1,5 +1,6 @@
#include "latlon.h" #include "latlon.h"
#include "utm.h" #include "utm.h"
#include "gcs.h"
#include "mapfile.h" #include "mapfile.h"
@ -151,8 +152,7 @@ bool MapFile::parseMapFile(QIODevice &device, QList<CalibrationPoint> &points,
bool MapFile::createDatum(const QString &datum) bool MapFile::createDatum(const QString &datum)
{ {
_datum = Datum(datum); if (!(_gcs = GCS::gcs(datum))) {
if (_datum.isNull()) {
_errorString = QString("%1: Unknown datum").arg(datum); _errorString = QString("%1: Unknown datum").arg(datum);
return false; return false;
} }
@ -164,17 +164,17 @@ bool MapFile::createProjection(const QString &name,
const Projection::Setup &setup, QList<CalibrationPoint> &points) const Projection::Setup &setup, QList<CalibrationPoint> &points)
{ {
if (name == "Mercator") if (name == "Mercator")
_projection = Projection::projection(_datum, 1024, setup); _projection = Projection::projection(_gcs->datum(), 1024, setup);
else if (name == "Transverse Mercator") else if (name == "Transverse Mercator")
_projection = Projection::projection(_datum, 9807, setup); _projection = Projection::projection(_gcs->datum(), 9807, setup);
else if (name == "Latitude/Longitude") else if (name == "Latitude/Longitude")
_projection = new LatLon(); _projection = new LatLon(9102);
else if (name == "Lambert Conformal Conic") else if (name == "Lambert Conformal Conic")
_projection = Projection::projection(_datum, 9802, setup); _projection = Projection::projection(_gcs->datum(), 9802, setup);
else if (name == "Albers Equal Area") else if (name == "Albers Equal Area")
_projection = Projection::projection(_datum, 9822, setup); _projection = Projection::projection(_gcs->datum(), 9822, setup);
else if (name == "(A)Lambert Azimuthual Equal Area") else if (name == "(A)Lambert Azimuthual Equal Area")
_projection = Projection::projection(_datum, 9820, setup); _projection = Projection::projection(_gcs->datum(), 9820, setup);
else if (name == "(UTM) Universal Transverse Mercator") { else if (name == "(UTM) Universal Transverse Mercator") {
int zone; int zone;
if (points.first().zone) if (points.first().zone)
@ -185,37 +185,42 @@ bool MapFile::createProjection(const QString &name,
_errorString = "Can not determine UTM zone"; _errorString = "Can not determine UTM zone";
return 0; return 0;
} }
_projection = Projection::projection(_datum, 9807, UTM::setup(zone)); _projection = Projection::projection(_gcs->datum(), 9807,
UTM::setup(zone));
} else if (name == "(NZTM2) New Zealand TM 2000") } else if (name == "(NZTM2) New Zealand TM 2000")
_projection = Projection::projection(_datum, 9807, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9807,
0, 173.0, 0.9996, 1600000, 10000000, NAN, NAN)); Projection::Setup(0, 173.0, 0.9996, 1600000, 10000000, NAN, NAN));
else if (name == "(BNG) British National Grid") else if (name == "(BNG) British National Grid")
_projection = Projection::projection(_datum, 9807, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9807,
49, -2, 0.999601, 400000, -100000, NAN, NAN)); Projection::Setup(49, -2, 0.999601, 400000, -100000, NAN, NAN));
else if (name == "(IG) Irish Grid") else if (name == "(IG) Irish Grid")
_projection = Projection::projection(_datum, 9807, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9807,
53.5, -8, 1.000035, 200000, 250000, NAN, NAN)); Projection::Setup(53.5, -8, 1.000035, 200000, 250000, NAN, NAN));
else if (name == "(SG) Swedish Grid") else if (name == "(SG) Swedish Grid")
_projection = Projection::projection(_datum, 9807, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9807,
0, 15.808278, 1, 1500000, 0, NAN, NAN)); Projection::Setup(0, 15.808278, 1, 1500000, 0, NAN, NAN));
else if (name == "(I) France Zone I") else if (name == "(I) France Zone I")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
49.5, 2.337229, NAN, 600000, 1200000, 48.598523, 50.395912)); Projection::Setup(49.5, 2.337229, NAN, 600000, 1200000, 48.598523,
50.395912));
else if (name == "(II) France Zone II") else if (name == "(II) France Zone II")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
46.8, 2.337229, NAN, 600000, 2200000, 45.898919, 47.696014)); Projection::Setup(46.8, 2.337229, NAN, 600000, 2200000, 45.898919,
47.696014));
else if (name == "(III) France Zone III") else if (name == "(III) France Zone III")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
44.1, 2.337229, NAN, 600000, 3200000, 43.199291, 44.996094)); Projection::Setup(44.1, 2.337229, NAN, 600000, 3200000, 43.199291,
44.996094));
else if (name == "(IV) France Zone IV") else if (name == "(IV) France Zone IV")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
42.165, 2.337229, NAN, 234.358, 4185861.369, 41.560388, 42.767663)); Projection::Setup(42.165, 2.337229, NAN, 234.358, 4185861.369,
41.560388, 42.767663));
else if (name == "(VICGRID) Victoria Australia") else if (name == "(VICGRID) Victoria Australia")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
-37, 145, NAN, 2500000, 4500000, -36, -38)); Projection::Setup(-37, 145, NAN, 2500000, 4500000, -36, -38));
else if (name == "(VG94) VICGRID94 Victoria Australia") else if (name == "(VG94) VICGRID94 Victoria Australia")
_projection = Projection::projection(_datum, 9802, Projection::Setup( _projection = Projection::projection(_gcs->datum(), 9802,
-37, 145, NAN, 2500000, 2500000, -36, -38)); Projection::Setup(-37, 145, NAN, 2500000, 2500000, -36, -38));
else { else {
_errorString = QString("%1: Unknown map projection").arg(name); _errorString = QString("%1: Unknown map projection").arg(name);
return false; return false;

View File

@ -3,7 +3,7 @@
#include <QIODevice> #include <QIODevice>
#include <QTransform> #include <QTransform>
#include "datum.h" #include "gcs.h"
#include "transform.h" #include "transform.h"
#include "projection.h" #include "projection.h"
@ -12,7 +12,7 @@ class MapFile
public: public:
bool load(QIODevice &file); bool load(QIODevice &file);
const Datum &datum() const {return _datum;} const GCS *gcs() const {return _gcs;}
Projection *projection() const {return _projection;} Projection *projection() const {return _projection;}
const QTransform &transform() const {return _transform;} const QTransform &transform() const {return _transform;}
@ -42,9 +42,9 @@ private:
QString _image; QString _image;
QSize _size; QSize _size;
Datum _datum; const GCS *_gcs;
QTransform _transform;
Projection *_projection; Projection *_projection;
QTransform _transform;
QString _errorString; QString _errorString;
}; };

View File

@ -138,7 +138,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
_name = mf.name(); _name = mf.name();
_size = mf.size(); _size = mf.size();
_imgPath = mf.image(); _imgPath = mf.image();
_datum = mf.datum(); _gcs = mf.gcs();
_projection = mf.projection(); _projection = mf.projection();
_transform = mf.transform(); _transform = mf.transform();
} }
@ -152,7 +152,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
_name = mf.name(); _name = mf.name();
_size = mf.size(); _size = mf.size();
_imgPath = mf.image(); _imgPath = mf.image();
_datum = mf.datum(); _gcs = mf.gcs();
_projection = mf.projection(); _projection = mf.projection();
_transform = mf.transform(); _transform = mf.transform();
} }
@ -164,7 +164,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
} else { } else {
_name = fi.fileName(); _name = fi.fileName();
_imgPath = fileName; _imgPath = fileName;
_datum = gt.datum(); _gcs = gt.gcs();
_projection = gt.projection(); _projection = gt.projection();
_transform = gt.transform(); _transform = gt.transform();
} }
@ -230,7 +230,7 @@ OfflineMap::OfflineMap(const QString &fileName, Tar &tar, QObject *parent)
_name = mf.name(); _name = mf.name();
_size = mf.size(); _size = mf.size();
_datum = mf.datum(); _gcs = mf.gcs();
_projection = mf.projection(); _projection = mf.projection();
_transform = mf.transform(); _transform = mf.transform();
@ -363,19 +363,19 @@ void OfflineMap::draw(QPainter *painter, const QRectF &rect)
QPointF OfflineMap::ll2xy(const Coordinates &c) QPointF OfflineMap::ll2xy(const Coordinates &c)
{ {
if (_ozf.isOpen()) { if (_ozf.isOpen()) {
QPointF p(_transform.map(_projection->ll2xy(_datum.fromWGS84(c)))); QPointF p(_transform.map(_projection->ll2xy(_gcs->fromWGS84(c))));
return QPointF(p.x() * _scale.x(), p.y() * _scale.y()); return QPointF(p.x() * _scale.x(), p.y() * _scale.y());
} else } else
return _transform.map(_projection->ll2xy(_datum.fromWGS84(c))); return _transform.map(_projection->ll2xy(_gcs->fromWGS84(c)));
} }
Coordinates OfflineMap::xy2ll(const QPointF &p) Coordinates OfflineMap::xy2ll(const QPointF &p)
{ {
if (_ozf.isOpen()) { if (_ozf.isOpen()) {
return _datum.toWGS84(_projection->xy2ll(_inverted.map(QPointF(p.x() return _gcs->toWGS84(_projection->xy2ll(_inverted.map(QPointF(p.x()
/ _scale.x(), p.y() / _scale.y())))); / _scale.x(), p.y() / _scale.y()))));
} else } else
return _datum.toWGS84(_projection->xy2ll(_inverted.map(p))); return _gcs->toWGS84(_projection->xy2ll(_inverted.map(p)));
} }
QRectF OfflineMap::bounds() const QRectF OfflineMap::bounds() const

View File

@ -3,7 +3,7 @@
#include <QTransform> #include <QTransform>
#include "common/coordinates.h" #include "common/coordinates.h"
#include "datum.h" #include "gcs.h"
#include "projection.h" #include "projection.h"
#include "transform.h" #include "transform.h"
#include "map.h" #include "map.h"
@ -66,7 +66,7 @@ private:
QString _name; QString _name;
QSize _size; QSize _size;
Datum _datum; const GCS *_gcs;
Projection *_projection; Projection *_projection;
QTransform _transform, _inverted; QTransform _transform, _inverted;

View File

@ -4,24 +4,18 @@
class PCS::Entry { class PCS::Entry {
public: public:
Entry(int id, int gcs, int proj, const PCS &pcs) Entry(int id, int proj, const PCS &pcs) : _id(id), _proj(proj), _pcs(pcs) {}
: _id(id), _gcs(gcs), _proj(proj), _pcs(pcs) {}
int id() const {return _id;} int id() const {return _id;}
int gcs() const {return _gcs;}
int proj() const {return _proj;} int proj() const {return _proj;}
const PCS &pcs() const {return _pcs;} const PCS &pcs() const {return _pcs;}
private: private:
int _id; int _id, _proj;
int _gcs;
int _proj;
PCS _pcs; PCS _pcs;
}; };
QList<PCS::Entry> PCS::_pcss; QList<PCS::Entry> PCS::_pcss;
QString PCS::_errorString;
int PCS::_errorLine;
static double parameter(const QString &str, bool *res) static double parameter(const QString &str, bool *res)
{ {
@ -34,99 +28,114 @@ static double parameter(const QString &str, bool *res)
return field.toDouble(res); return field.toDouble(res);
} }
PCS::PCS(int id)
const PCS *PCS::pcs(int id)
{ {
for (int i = 0; i < _pcss.size(); i++) { for (int i = 0; i < _pcss.size(); i++)
if (_pcss.at(i).id() == id) { if (_pcss.at(i).id() == id)
*this = _pcss.at(i).pcs(); return &(_pcss.at(i).pcs());
return;
} return 0;
} }
*this = PCS(); const PCS *PCS::pcs(const GCS *gcs, int proj)
}
PCS::PCS(int gcs, int proj)
{ {
for (int i = 0; i < _pcss.size(); i++) { for (int i = 0; i < _pcss.size(); i++)
if (_pcss.at(i).gcs() == gcs && _pcss.at(i).proj() == proj) { if (_pcss.at(i).proj() == proj && *(_pcss.at(i).pcs().gcs()) == *gcs)
*this = _pcss.at(i).pcs(); return &(_pcss.at(i).pcs());
return;
} return 0;
} }
*this = PCS(); void PCS::loadList(const QString &path)
}
void PCS::error(const QString &str)
{
_errorString = str;
_pcss.clear();
}
bool PCS::loadList(const QString &path)
{ {
QFile file(path); QFile file(path);
bool res[12]; bool res;
int id, gcs, proj, transform; int ln = 0;
if (!file.open(QFile::ReadOnly)) { if (!file.open(QFile::ReadOnly)) {
error(file.errorString()); qWarning("Error opening PCS file: %s: %s", qPrintable(path),
return false; qPrintable(file.errorString()));
return;
} }
_errorLine = 1;
_errorString.clear();
while (!file.atEnd()) { while (!file.atEnd()) {
ln++;
QByteArray line = file.readLine(); QByteArray line = file.readLine();
QList<QByteArray> list = line.split(','); QList<QByteArray> list = line.split(',');
if (list.size() != 12) { if (list.size() != 12) {
error("Format error"); qWarning("%s: %d: Format error", qPrintable(path), ln);
return false; continue;
} }
id = list[1].trimmed().toInt(&res[1]);; int id = list[1].trimmed().toInt(&res);
gcs = list[2].trimmed().toInt(&res[2]); if (!res) {
proj = list[3].trimmed().toInt(&res[3]); qWarning("%s: %d: Invalid PCS code", qPrintable(path), ln);
transform = list[4].trimmed().toInt(&res[4]); continue;
Projection::Setup setup(
parameter(list[5], &res[5]), parameter(list[6], &res[6]),
parameter(list[7], &res[7]), parameter(list[8], &res[8]),
parameter(list[9], &res[9]), parameter(list[10], &res[10]),
parameter(list[11], &res[11]));
for (int i = 1; i < 12; i++) {
if (!res[i]) {
error("Parse error");
return false;
} }
int gcs = list[2].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid GCS code", qPrintable(path), ln);
continue;
}
int proj = list[3].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid projection code", qPrintable(path), ln);
continue;
}
int transform = list[4].trimmed().toInt(&res);
if (!res) {
qWarning("%s: %d: Invalid coordinate transformation code",
qPrintable(path), ln);
continue;
}
double lat0 = parameter(list[5], &res);
if (!res) {
qWarning("%s: %d: Invalid latitude origin", qPrintable(path), ln);
continue;
}
double lon0 = parameter(list[6], &res);
if (!res) {
qWarning("%s: %d: Invalid longitude origin", qPrintable(path), ln);
continue;
}
double scale = parameter(list[7], &res);
if (!res) {
qWarning("%s: %d: Invalid scale", qPrintable(path), ln);
continue;
}
double fe = parameter(list[8], &res);
if (!res) {
qWarning("%s: %d: Invalid false easting", qPrintable(path), ln);
continue;
}
double fn = parameter(list[9], &res);
if (!res) {
qWarning("%s: %d: Invalid false northing", qPrintable(path), ln);
continue;
}
double sp1 = parameter(list[10], &res);
if (!res) {
qWarning("%s: %d: Invalid standard parallel #1", qPrintable(path),
ln);
continue;
}
double sp2 = parameter(list[11], &res);
if (!res) {
qWarning("%s: %d: Invalid standard parallel #2", qPrintable(path),
ln);
continue;
} }
Datum datum(gcs); _pcss.append(Entry(id, proj, PCS(GCS::gcs(gcs), transform,
if (datum.isNull()) { Projection::Setup(lat0, lon0, scale, fe, fn, sp1, sp2))));
error("Unknown datum");
return false;
} }
Projection::Method method(transform);
if (method.isNull()) {
error("Unknown coordinates transformation method");
return false;
}
_pcss.append(Entry(id, gcs, proj, PCS(datum, method, setup)));
_errorLine++;
}
return true;
} }
QDebug operator<<(QDebug dbg, const PCS &pcs) QDebug operator<<(QDebug dbg, const PCS &pcs)
{ {
dbg.nospace() << "PCS(" << pcs.datum() << ", " << pcs.method() dbg.nospace() << "PCS(" << *pcs.gcs() << ", " << pcs.method()
<< ", " << pcs.setup() << ")"; << ", " << pcs.setup() << ")";
return dbg.space(); return dbg.maybeSpace();
} }

View File

@ -3,44 +3,37 @@
#include <QDebug> #include <QDebug>
#include <QList> #include <QList>
#include "datum.h" #include "gcs.h"
#include "projection.h" #include "projection.h"
class PCS class PCS
{ {
public: public:
PCS() {} PCS() : _gcs(0) {}
PCS(const Datum &datum, const Projection::Method &method, PCS(const GCS *gcs, const Projection::Method &m, const Projection::Setup &s)
const Projection::Setup &setup) : _gcs(gcs), _method(m), _setup(s) {}
: _datum(datum), _method(method), _setup(setup) {} PCS(const GCS *gcs, int proj);
PCS(int id);
PCS(int gcs, int proj);
const Datum &datum() const {return _datum;} const GCS *gcs() const {return _gcs;}
const Projection::Method &method() const {return _method;} const Projection::Method &method() const {return _method;}
const Projection::Setup &setup() const {return _setup;} const Projection::Setup &setup() const {return _setup;}
bool isNull() const bool isNull() const
{return (_datum.isNull() && _method.isNull());} {return (_gcs->isNull() && _method.isNull() && _setup.isNull());}
bool isValid() const
{return !(_datum.isNull() || _method.isNull());}
static bool loadList(const QString &path); static void loadList(const QString &path);
static const QString &errorString() {return _errorString;} static const PCS *pcs(int id);
static int errorLine() {return _errorLine;} static const PCS *pcs(const GCS *gcs, int proj);
private: private:
class Entry; class Entry;
static void error(const QString &str); const GCS *_gcs;
Datum _datum;
Projection::Method _method; Projection::Method _method;
Projection::Setup _setup; Projection::Setup _setup;
static QList<Entry> _pcss; static QList<Entry> _pcss;
static QString _errorString; static GCS _nullGCS;
static int _errorLine;
}; };
QDebug operator<<(QDebug dbg, const PCS &pcs); QDebug operator<<(QDebug dbg, const PCS &pcs);

73
src/map/primemeridian.cpp Normal file
View File

@ -0,0 +1,73 @@
#include "primemeridian.h"
static double shift(double lon, double offset)
{
double ret = lon + offset;
if (ret > 180.0)
ret -= 360.0;
if (ret < -180)
ret += 360.0;
return ret;
}
PrimeMeridian::PrimeMeridian(int code)
{
switch (code) {
case 8901:
_pm = 0.0;
break;
case 8902:
_pm = -9.1319061111;
break;
case 8903:
_pm = 2.3372291666;
break;
case 8904:
_pm = -74.0809166666;
break;
case 8905:
_pm = -3.6879388888;
break;
case 8906:
_pm = 12.4523333333;
break;
case 8907:
_pm = 7.4395833333;
break;
case 8908:
_pm = 106.8077194444;
break;
case 8909:
_pm = -17.6666666666;
break;
case 8910:
_pm = 4.3679750000;
break;
case 8911:
_pm = 18.0582777777;
break;
case 8913:
_pm = 10.7229166666;
break;
default:
_pm = NAN;
}
}
double PrimeMeridian::toGreenwich(double val) const
{
return shift(val, _pm);
}
double PrimeMeridian::fromGreenwich(double val) const
{
return shift(val, -_pm);
}
QDebug operator<<(QDebug dbg, const PrimeMeridian &pm)
{
dbg.nospace() << "PrimeMeridian(" << pm._pm << ")";
return dbg.maybeSpace();
}

31
src/map/primemeridian.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef PRIMEMERIDIAN_H
#define PRIMEMERIDIAN_H
#include <cmath>
#include <QDebug>
class PrimeMeridian
{
public:
PrimeMeridian() : _pm(NAN) {}
PrimeMeridian(int code);
bool isNull() const {return std::isnan(_pm);}
bool isValid() const {return !std::isnan(_pm);}
double toGreenwich(double val) const;
double fromGreenwich(double val) const;
friend bool operator==(const PrimeMeridian &pm1, const PrimeMeridian &pm2);
friend QDebug operator<<(QDebug dbg, const PrimeMeridian &pm);
private:
double _pm;
};
inline bool operator==(const PrimeMeridian &pm1, const PrimeMeridian &pm2)
{return (pm1._pm == pm2._pm);}
QDebug operator<<(QDebug dbg, const PrimeMeridian &pm);
#endif // PRIMEMERIDIAN_H

View File

@ -27,7 +27,7 @@ Projection::Method::Method(int id)
Projection *Projection::projection(const Datum &datum, const Method &method, Projection *Projection::projection(const Datum &datum, const Method &method,
const Setup &setup) const Setup &setup)
{ {
const Ellipsoid &ellipsoid = datum.ellipsoid(); const Ellipsoid *ellipsoid = datum.ellipsoid();
switch (method.id()) { switch (method.id()) {
case 9807: case 9807:
@ -66,11 +66,11 @@ QDebug operator<<(QDebug dbg, const Projection::Setup &setup)
<< setup.longitudeOrigin() << ", " << setup.scale() << ", " << setup.longitudeOrigin() << ", " << setup.scale() << ", "
<< setup.falseEasting() << ", " << setup.falseNorthing() << ", " << setup.falseEasting() << ", " << setup.falseNorthing() << ", "
<< setup.standardParallel1() << ", " << setup.standardParallel2() << ")"; << setup.standardParallel1() << ", " << setup.standardParallel2() << ")";
return dbg.space(); return dbg.maybeSpace();
} }
QDebug operator<<(QDebug dbg, const Projection::Method &method) QDebug operator<<(QDebug dbg, const Projection::Method &method)
{ {
dbg.nospace() << "Method(" << method.id() << ")"; dbg.nospace() << "Method(" << method.id() << ")";
return dbg.space(); return dbg.maybeSpace();
} }

View File

@ -30,6 +30,11 @@ public:
double standardParallel1() const {return _standardParallel1;} double standardParallel1() const {return _standardParallel1;}
double standardParallel2() const {return _standardParallel2;} double standardParallel2() const {return _standardParallel2;}
bool isNull() const {return std::isnan(_latitudeOrigin)
&& std::isnan(_longitudeOrigin) && std::isnan(_scale)
&& std::isnan(_falseEasting) && std::isnan(_falseNorthing)
&& std::isnan(_standardParallel1) && std::isnan(_standardParallel2);}
private: private:
double _latitudeOrigin; double _latitudeOrigin;
double _longitudeOrigin; double _longitudeOrigin;

View File

@ -47,17 +47,17 @@ Defense.
#define SPHSN(lat) \ #define SPHSN(lat) \
((double)(_e.radius() / sqrt(1.e0 - _es * pow(sin(lat), 2)))) ((double)(_e->radius() / sqrt(1.e0 - _es * pow(sin(lat), 2))))
#define SPHTMD(lat) \ #define SPHTMD(lat) \
((double)(_ap * lat - _bp * sin(2.e0 * lat) + _cp * sin(4.e0 * lat) \ ((double)(_ap * lat - _bp * sin(2.e0 * lat) + _cp * sin(4.e0 * lat) \
- _dp * sin(6.e0 * lat) + _ep * sin(8.e0 * lat))) - _dp * sin(6.e0 * lat) + _ep * sin(8.e0 * lat)))
#define DENOM(lat) \ #define DENOM(lat) \
((double)(sqrt(1.e0 - _es * pow(sin(lat),2)))) ((double)(sqrt(1.e0 - _es * pow(sin(lat),2))))
#define SPHSR(lat) \ #define SPHSR(lat) \
((double)(_e.radius() * (1.e0 - _es) / pow(DENOM(lat), 3))) ((double)(_e->radius() * (1.e0 - _es) / pow(DENOM(lat), 3)))
TransverseMercator::TransverseMercator(const Ellipsoid &ellipsoid, TransverseMercator::TransverseMercator(const Ellipsoid *ellipsoid,
double latitudeOrigin, double longitudeOrigin, double scale, double latitudeOrigin, double longitudeOrigin, double scale,
double falseEasting, double falseNorthing) double falseEasting, double falseNorthing)
{ {
@ -72,24 +72,24 @@ TransverseMercator::TransverseMercator(const Ellipsoid &ellipsoid,
_falseEasting = falseEasting; _falseEasting = falseEasting;
_falseNorthing = falseNorthing; _falseNorthing = falseNorthing;
_es = 2 * _e.flattening() - _e.flattening() * _e.flattening(); _es = 2 * _e->flattening() - _e->flattening() * _e->flattening();
_ebs = (1 / (1 - _es)) - 1; _ebs = (1 / (1 - _es)) - 1;
b = _e.radius() * (1 - _e.flattening()); b = _e->radius() * (1 - _e->flattening());
tn = (_e.radius() - b) / (_e.radius() + b); tn = (_e->radius() - b) / (_e->radius() + b);
tn2 = tn * tn; tn2 = tn * tn;
tn3 = tn2 * tn; tn3 = tn2 * tn;
tn4 = tn3 * tn; tn4 = tn3 * tn;
tn5 = tn4 * tn; tn5 = tn4 * tn;
_ap = _e.radius() * (1.e0 - tn + 5.e0 * (tn2 - tn3) / 4.e0 + 81.e0 _ap = _e->radius() * (1.e0 - tn + 5.e0 * (tn2 - tn3) / 4.e0 + 81.e0
* (tn4 - tn5) / 64.e0); * (tn4 - tn5) / 64.e0);
_bp = 3.e0 * _e.radius() * (tn - tn2 + 7.e0 * (tn3 - tn4) / 8.e0 + 55.e0 _bp = 3.e0 * _e->radius() * (tn - tn2 + 7.e0 * (tn3 - tn4) / 8.e0 + 55.e0
* tn5 / 64.e0 ) / 2.e0; * tn5 / 64.e0 ) / 2.e0;
_cp = 15.e0 * _e.radius() * (tn2 - tn3 + 3.e0 * (tn4 - tn5 ) / 4.e0) / 16.0; _cp = 15.e0 * _e->radius() * (tn2 - tn3 + 3.e0 * (tn4 - tn5 ) / 4.e0) / 16.0;
_dp = 35.e0 * _e.radius() * (tn3 - tn4 + 11.e0 * tn5 / 16.e0) / 48.e0; _dp = 35.e0 * _e->radius() * (tn3 - tn4 + 11.e0 * tn5 / 16.e0) / 48.e0;
_ep = 315.e0 * _e.radius() * (tn4 - tn5) / 512.e0; _ep = 315.e0 * _e->radius() * (tn4 - tn5) / 512.e0;
} }
QPointF TransverseMercator::ll2xy(const Coordinates &c) const QPointF TransverseMercator::ll2xy(const Coordinates &c) const

View File

@ -7,7 +7,7 @@
class TransverseMercator : public Projection class TransverseMercator : public Projection
{ {
public: public:
TransverseMercator(const Ellipsoid &ellipsoid, double latitudeOrigin, TransverseMercator(const Ellipsoid *ellipsoid, double latitudeOrigin,
double longitudeOrigin, double scale, double falseEasting, double longitudeOrigin, double scale, double falseEasting,
double falseNorthing); double falseNorthing);
@ -15,7 +15,7 @@ public:
virtual Coordinates xy2ll(const QPointF &p) const; virtual Coordinates xy2ll(const QPointF &p) const;
private: private:
Ellipsoid _e; const Ellipsoid *_e;
double _longitudeOrigin; double _longitudeOrigin;
double _latitudeOrigin; double _latitudeOrigin;
double _scale; double _scale;