mirage2d 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/MirageHttp.es.js +5268 -0
  2. package/dist/MirageHttp.es.js.map +1 -0
  3. package/dist/MirageHttp.umd.js +2 -0
  4. package/dist/MirageHttp.umd.js.map +1 -0
  5. package/dist/assets/js/basedecoder-fa2b8e8d.js +107 -0
  6. package/dist/assets/js/decoder-f19e05cf.js +6 -0
  7. package/dist/assets/js/deflate-adb9a67b.js +8 -0
  8. package/dist/{js/dist/_html2canvas@1.4.1@html2canvas.e8006fee.js → assets/js/html2canvas.esm-3dd231c5.js} +0 -0
  9. package/dist/assets/js/index-3263db85.js +1 -0
  10. package/dist/assets/js/index-a9db46a5.js +212968 -0
  11. package/dist/{js/lib/_canvg@3.0.10@canvg.bd557ac8.js → assets/js/index.es-38f73a27.js} +2179 -351
  12. package/dist/assets/js/jpeg-3bf23728.js +835 -0
  13. package/dist/{js/_lerc@3.0.0@lerc/_lerc@3.0.0@lerc.dc2ff398.js → assets/js/lerc-4c39f39b.js} +26 -1
  14. package/dist/assets/js/lzw-d0cad8af.js +123 -0
  15. package/dist/assets/js/packbits-d75b4cce.js +25 -0
  16. package/dist/{js/_pako@2.0.4@pako/_pako@2.0.4@pako.52d6b320.js → assets/js/pako.esm-49deb4d7.js} +0 -0
  17. package/dist/{js/dist/_dompurify@2.4.0@dompurify.e7ba523e.js → assets/js/purify.es-1915dfae.js} +0 -0
  18. package/dist/assets/js/raw-9656f9cc.js +7 -0
  19. package/dist/assets/js/webimage-edb7156c.js +27 -0
  20. package/package.json +1 -1
  21. package/dist/js/_@babel_runtime@7.18.9@@babel/_@babel_runtime@7.18.9@@babel.e0126ca2.js +0 -51
  22. package/dist/js/_@petamoriken_float16@3.6.6@@petamoriken/_@petamoriken_float16@3.6.6@@petamoriken.c5188241.js +0 -217
  23. package/dist/js/_@turf_along@6.5.0@@turf/_@turf_along@6.5.0@@turf.18dbc1a3.js +0 -31
  24. package/dist/js/_@turf_angle@6.5.0@@turf/_@turf_angle@6.5.0@@turf.554ac9bf.js +0 -1
  25. package/dist/js/_@turf_area@6.5.0@@turf/_@turf_area@6.5.0@@turf.6cbf0cc1.js +0 -74
  26. package/dist/js/_@turf_bbox-clip@6.5.0@@turf/_@turf_bbox-clip@6.5.0@@turf.e491cb90.js +0 -1
  27. package/dist/js/_@turf_bbox-polygon@6.5.0@@turf/_@turf_bbox-polygon@6.5.0@@turf.523f1c20.js +0 -19
  28. package/dist/js/_@turf_bbox@6.5.0@@turf/_@turf_bbox@6.5.0@@turf.4c59feee.js +0 -48
  29. package/dist/js/_@turf_bearing@6.5.0@@turf/_@turf_bearing@6.5.0@@turf.f2555a09.js +0 -25
  30. package/dist/js/_@turf_bezier-spline@6.5.0@@turf/_@turf_bezier-spline@6.5.0@@turf.fa7991dd.js +0 -137
  31. package/dist/js/_@turf_boolean-clockwise@6.5.0@@turf/_@turf_boolean-clockwise@6.5.0@@turf.4031f280.js +0 -1
  32. package/dist/js/_@turf_boolean-contains@6.5.0@@turf/_@turf_boolean-contains@6.5.0@@turf.836d55d8.js +0 -191
  33. package/dist/js/_@turf_boolean-crosses@6.5.0@@turf/_@turf_boolean-crosses@6.5.0@@turf.c5f65a28.js +0 -125
  34. package/dist/js/_@turf_boolean-disjoint@6.5.0@@turf/_@turf_boolean-disjoint@6.5.0@@turf.bbd60872.js +0 -122
  35. package/dist/js/_@turf_boolean-equal@6.5.0@@turf/_@turf_boolean-equal@6.5.0@@turf.341ffa01.js +0 -1
  36. package/dist/js/_@turf_boolean-intersects@6.5.0@@turf/_@turf_boolean-intersects@6.5.0@@turf.05fc28b3.js +0 -15
  37. package/dist/js/_@turf_boolean-overlap@6.5.0@@turf/_@turf_boolean-overlap@6.5.0@@turf.a519db25.js +0 -53
  38. package/dist/js/_@turf_boolean-parallel@6.5.0@@turf/_@turf_boolean-parallel@6.5.0@@turf.dbf2bc2d.js +0 -1
  39. package/dist/js/_@turf_boolean-point-in-polygon@6.5.0@@turf/_@turf_boolean-point-in-polygon@6.5.0@@turf.62a2d48a.js +0 -65
  40. package/dist/js/_@turf_boolean-point-on-line@6.5.0@@turf/_@turf_boolean-point-on-line@6.5.0@@turf.3cf3aaa1.js +0 -69
  41. package/dist/js/_@turf_boolean-within@6.5.0@@turf/_@turf_boolean-within@6.5.0@@turf.d70d6bfc.js +0 -172
  42. package/dist/js/_@turf_buffer@6.5.0@@turf/_@turf_buffer@6.5.0@@turf.88330dfe.js +0 -99
  43. package/dist/js/_@turf_center-mean@6.5.0@@turf/_@turf_center-mean@6.5.0@@turf.b3d7c917.js +0 -1
  44. package/dist/js/_@turf_center-median@6.5.0@@turf/_@turf_center-median@6.5.0@@turf.44c4669e.js +0 -1
  45. package/dist/js/_@turf_center-of-mass@6.5.0@@turf/_@turf_center-of-mass@6.5.0@@turf.63ce279e.js +0 -1
  46. package/dist/js/_@turf_center@6.5.0@@turf/_@turf_center@6.5.0@@turf.a45495b5.js +0 -12
  47. package/dist/js/_@turf_centroid@6.5.0@@turf/_@turf_centroid@6.5.0@@turf.0a5be869.js +0 -17
  48. package/dist/js/_@turf_circle@6.5.0@@turf/_@turf_circle@6.5.0@@turf.0166b8c2.js +0 -16
  49. package/dist/js/_@turf_clean-coords@6.5.0@@turf/_@turf_clean-coords@6.5.0@@turf.8c76bd63.js +0 -111
  50. package/dist/js/_@turf_clone@6.5.0@@turf/_@turf_clone@6.5.0@@turf.cd05b1f8.js +0 -100
  51. package/dist/js/_@turf_clusters-dbscan@6.5.0@@turf/_@turf_clusters-dbscan@6.5.0@@turf.6bbee7e9.js +0 -1
  52. package/dist/js/_@turf_clusters-kmeans@6.5.0@@turf/_@turf_clusters-kmeans@6.5.0@@turf.505415df.js +0 -1
  53. package/dist/js/_@turf_clusters@6.5.0@@turf/_@turf_clusters@6.5.0@@turf.84cb9680.js +0 -1
  54. package/dist/js/_@turf_collect@6.5.0@@turf/_@turf_collect@6.5.0@@turf.93e41b5f.js +0 -1
  55. package/dist/js/_@turf_combine@6.5.0@@turf/_@turf_combine@6.5.0@@turf.33ee6336.js +0 -1
  56. package/dist/js/_@turf_concave@6.5.0@@turf/_@turf_concave@6.5.0@@turf.6fb6a8be.js +0 -179
  57. package/dist/js/_@turf_convex@6.5.0@@turf/_@turf_convex@6.5.0@@turf.24600ac2.js +0 -1
  58. package/dist/js/_@turf_destination@6.5.0@@turf/_@turf_destination@6.5.0@@turf.2621651e.js +0 -18
  59. package/dist/js/_@turf_difference@6.5.0@@turf/_@turf_difference@6.5.0@@turf.70df5e79.js +0 -18
  60. package/dist/js/_@turf_dissolve@6.5.0@@turf/_@turf_dissolve@6.5.0@@turf.edb28fc1.js +0 -1
  61. package/dist/js/_@turf_distance-weight@6.5.0@@turf/_@turf_distance-weight@6.5.0@@turf.e168af7f.js +0 -1
  62. package/dist/js/_@turf_distance@6.5.0@@turf/_@turf_distance@6.5.0@@turf.0c7b8aea.js +0 -22
  63. package/dist/js/_@turf_ellipse@6.5.0@@turf/_@turf_ellipse@6.5.0@@turf.37986056.js +0 -1
  64. package/dist/js/_@turf_envelope@6.5.0@@turf/_@turf_envelope@6.5.0@@turf.599c5772.js +0 -1
  65. package/dist/js/_@turf_explode@6.5.0@@turf/_@turf_explode@6.5.0@@turf.5c768db5.js +0 -24
  66. package/dist/js/_@turf_flatten@6.5.0@@turf/_@turf_flatten@6.5.0@@turf.57e9114c.js +0 -1
  67. package/dist/js/_@turf_flip@6.5.0@@turf/_@turf_flip@6.5.0@@turf.1f02101f.js +0 -1
  68. package/dist/js/_@turf_great-circle@6.5.0@@turf/_@turf_great-circle@6.5.0@@turf.2ca021a8.js +0 -1
  69. package/dist/js/_@turf_helpers@6.5.0@@turf/_@turf_helpers@6.5.0@@turf.f1480aa1.js +0 -364
  70. package/dist/js/_@turf_hex-grid@6.5.0@@turf/_@turf_hex-grid@6.5.0@@turf.a6a45778.js +0 -99
  71. package/dist/js/_@turf_interpolate@6.5.0@@turf/_@turf_interpolate@6.5.0@@turf.4d39bd8c.js +0 -1
  72. package/dist/js/_@turf_intersect@6.5.0@@turf/_@turf_intersect@6.5.0@@turf.34082cdf.js +0 -17
  73. package/dist/js/_@turf_invariant@6.5.0@@turf/_@turf_invariant@6.5.0@@turf.0ef69f8c.js +0 -71
  74. package/dist/js/_@turf_isobands@6.5.0@@turf/_@turf_isobands@6.5.0@@turf.def019df.js +0 -3109
  75. package/dist/js/_@turf_isolines@6.5.0@@turf/_@turf_isolines@6.5.0@@turf.da623b25.js +0 -1
  76. package/dist/js/_@turf_kinks@6.5.0@@turf/_@turf_kinks@6.5.0@@turf.ee61685b.js +0 -87
  77. package/dist/js/_@turf_length@6.5.0@@turf/_@turf_length@6.5.0@@turf.f73f6c98.js +0 -12
  78. package/dist/js/_@turf_line-arc@6.5.0@@turf/_@turf_line-arc@6.5.0@@turf.3dc57055.js +0 -37
  79. package/dist/js/_@turf_line-chunk@6.5.0@@turf/_@turf_line-chunk@6.5.0@@turf.1867af48.js +0 -43
  80. package/dist/js/_@turf_line-intersect@6.5.0@@turf/_@turf_line-intersect@6.5.0@@turf.c4d81948.js +0 -73
  81. package/dist/js/_@turf_line-offset@6.5.0@@turf/_@turf_line-offset@6.5.0@@turf.e6846793.js +0 -116
  82. package/dist/js/_@turf_line-overlap@6.5.0@@turf/_@turf_line-overlap@6.5.0@@turf.addba9a5.js +0 -76
  83. package/dist/js/_@turf_line-segment@6.5.0@@turf/_@turf_line-segment@6.5.0@@turf.18ce3010.js +0 -55
  84. package/dist/js/_@turf_line-slice-along@6.5.0@@turf/_@turf_line-slice-along@6.5.0@@turf.2b802464.js +0 -57
  85. package/dist/js/_@turf_line-slice@6.5.0@@turf/_@turf_line-slice@6.5.0@@turf.6423a053.js +0 -23
  86. package/dist/js/_@turf_line-split@6.5.0@@turf/_@turf_line-split@6.5.0@@turf.2022f104.js +0 -125
  87. package/dist/js/_@turf_line-to-polygon@6.5.0@@turf/_@turf_line-to-polygon@6.5.0@@turf.83f5e69f.js +0 -1
  88. package/dist/js/_@turf_mask@6.5.0@@turf/_@turf_mask@6.5.0@@turf.96cd5a94.js +0 -1
  89. package/dist/js/_@turf_meta@6.5.0@@turf/_@turf_meta@6.5.0@@turf.1b9d5da5.js +0 -611
  90. package/dist/js/_@turf_midpoint@6.5.0@@turf/_@turf_midpoint@6.5.0@@turf.67c14f94.js +0 -1
  91. package/dist/js/_@turf_moran-index@6.5.0@@turf/_@turf_moran-index@6.5.0@@turf.2ad5365a.js +0 -1
  92. package/dist/js/_@turf_nearest-point-on-line@6.5.0@@turf/_@turf_nearest-point-on-line@6.5.0@@turf.095c8c0d.js +0 -57
  93. package/dist/js/_@turf_nearest-point-to-line@6.5.0@@turf/_@turf_nearest-point-to-line@6.5.0@@turf.68484097.js +0 -1
  94. package/dist/js/_@turf_nearest-point@6.5.0@@turf/_@turf_nearest-point@6.5.0@@turf.e0d2f509.js +0 -24
  95. package/dist/js/_@turf_planepoint@6.5.0@@turf/_@turf_planepoint@6.5.0@@turf.56fc70b3.js +0 -1
  96. package/dist/js/_@turf_point-grid@6.5.0@@turf/_@turf_point-grid@6.5.0@@turf.2d278644.js +0 -42
  97. package/dist/js/_@turf_point-on-feature@6.5.0@@turf/_@turf_point-on-feature@6.5.0@@turf.0c740874.js +0 -1
  98. package/dist/js/_@turf_point-to-line-distance@6.5.0@@turf/_@turf_point-to-line-distance@6.5.0@@turf.33105d82.js +0 -1
  99. package/dist/js/_@turf_points-within-polygon@6.5.0@@turf/_@turf_points-within-polygon@6.5.0@@turf.659cd335.js +0 -35
  100. package/dist/js/_@turf_polygon-smooth@6.5.0@@turf/_@turf_polygon-smooth@6.5.0@@turf.43a7c33e.js +0 -1
  101. package/dist/js/_@turf_polygon-tangents@6.5.0@@turf/_@turf_polygon-tangents@6.5.0@@turf.a2c3a7b6.js +0 -1
  102. package/dist/js/_@turf_polygon-to-line@6.5.0@@turf/_@turf_polygon-to-line@6.5.0@@turf.3177cfb1.js +0 -48
  103. package/dist/js/_@turf_polygonize@6.5.0@@turf/_@turf_polygonize@6.5.0@@turf.f7cc4910.js +0 -1
  104. package/dist/js/_@turf_projection@6.5.0@@turf/_@turf_projection@6.5.0@@turf.ffdd3321.js +0 -1
  105. package/dist/js/_@turf_random@6.5.0@@turf/_@turf_random@6.5.0@@turf.f65251e4.js +0 -130
  106. package/dist/js/_@turf_rectangle-grid@6.5.0@@turf/_@turf_rectangle-grid@6.5.0@@turf.7e8b1a1f.js +0 -49
  107. package/dist/js/_@turf_rewind@6.5.0@@turf/_@turf_rewind@6.5.0@@turf.5d137ee9.js +0 -1
  108. package/dist/js/_@turf_rhumb-bearing@6.5.0@@turf/_@turf_rhumb-bearing@6.5.0@@turf.fb8f6ade.js +0 -30
  109. package/dist/js/_@turf_rhumb-destination@6.5.0@@turf/_@turf_rhumb-destination@6.5.0@@turf.dc0e4753.js +0 -36
  110. package/dist/js/_@turf_rhumb-distance@6.5.0@@turf/_@turf_rhumb-distance@6.5.0@@turf.94e475b8.js +0 -30
  111. package/dist/js/_@turf_sample@6.5.0@@turf/_@turf_sample@6.5.0@@turf.7181d7a7.js +0 -1
  112. package/dist/js/_@turf_sector@6.5.0@@turf/_@turf_sector@6.5.0@@turf.04ffddfe.js +0 -39
  113. package/dist/js/_@turf_shortest-path@6.5.0@@turf/_@turf_shortest-path@6.5.0@@turf.0c1b62a8.js +0 -367
  114. package/dist/js/_@turf_simplify@6.5.0@@turf/_@turf_simplify@6.5.0@@turf.46703d2e.js +0 -1
  115. package/dist/js/_@turf_square-grid@6.5.0@@turf/_@turf_square-grid@6.5.0@@turf.38bd2eaa.js +0 -8
  116. package/dist/js/_@turf_square@6.5.0@@turf/_@turf_square@6.5.0@@turf.2705289a.js +0 -27
  117. package/dist/js/_@turf_standard-deviational-ellipse@6.5.0@@turf/_@turf_standard-deviational-ellipse@6.5.0@@turf.7094e432.js +0 -1
  118. package/dist/js/_@turf_tag@6.5.0@@turf/_@turf_tag@6.5.0@@turf.cb60b0c1.js +0 -1
  119. package/dist/js/_@turf_tesselate@6.5.0@@turf/_@turf_tesselate@6.5.0@@turf.330e4aae.js +0 -1
  120. package/dist/js/_@turf_tin@6.5.0@@turf/_@turf_tin@6.5.0@@turf.077204c4.js +0 -173
  121. package/dist/js/_@turf_transform-rotate@6.5.0@@turf/_@turf_transform-rotate@6.5.0@@turf.6d350d36.js +0 -1
  122. package/dist/js/_@turf_transform-scale@6.5.0@@turf/_@turf_transform-scale@6.5.0@@turf.d6f65671.js +0 -90
  123. package/dist/js/_@turf_transform-translate@6.5.0@@turf/_@turf_transform-translate@6.5.0@@turf.9296b81a.js +0 -1
  124. package/dist/js/_@turf_triangle-grid@6.5.0@@turf/_@turf_triangle-grid@6.5.0@@turf.939f94ab.js +0 -107
  125. package/dist/js/_@turf_truncate@6.5.0@@turf/_@turf_truncate@6.5.0@@turf.ed70ebcb.js +0 -33
  126. package/dist/js/_@turf_turf@6.4.0@@turf/_@turf_turf@6.4.0@@turf.34fde8ec.js +0 -1
  127. package/dist/js/_@turf_union@6.5.0@@turf/_@turf_union@6.5.0@@turf.386ee2eb.js +0 -1
  128. package/dist/js/_@turf_unkink-polygon@6.5.0@@turf/_@turf_unkink-polygon@6.5.0@@turf.cb446e47.js +0 -1
  129. package/dist/js/_@turf_voronoi@6.5.0@@turf/_@turf_voronoi@6.5.0@@turf.c30d929e.js +0 -30
  130. package/dist/js/_call-bind@1.0.2@call-bind/_call-bind@1.0.2@call-bind.3811d387.js +0 -53
  131. package/dist/js/_concaveman@1.2.1@concaveman/_concaveman@1.2.1@concaveman.e747f731.js +0 -1
  132. package/dist/js/_core-js@3.25.0@core-js/_core-js@3.25.0@core-js.003355ed.js +0 -5029
  133. package/dist/js/_crypto-js@4.1.1@crypto-js/_crypto-js@4.1.1@crypto-js.e2f7f158.js +0 -1823
  134. package/dist/js/_d3-array@1.2.4@d3-array/_d3-array@1.2.4@d3-array.d606df6b.js +0 -58
  135. package/dist/js/_d3-geo@1.7.1@d3-geo/_d3-geo@1.7.1@d3-geo.7d357be1.js +0 -1094
  136. package/dist/js/_d3-voronoi@1.1.2@d3-voronoi/_d3-voronoi@1.1.2@d3-voronoi.072f12a6.js +0 -816
  137. package/dist/js/_deep-equal@1.1.1@deep-equal/_deep-equal@1.1.1@deep-equal.98576c17.js +0 -108
  138. package/dist/js/_define-properties@1.1.4@define-properties/_define-properties@1.1.4@define-properties.647c3367.js +0 -40
  139. package/dist/js/_density-clustering@1.3.0@density-clustering/_density-clustering@1.3.0@density-clustering.a07fc6ae.js +0 -1
  140. package/dist/js/_earcut@2.2.4@earcut/_earcut@2.2.4@earcut.972ebfd3.js +0 -1
  141. package/dist/js/_echarts-gl@1.1.2@echarts-gl/_echarts-gl@1.1.2@echarts-gl.1e3964b9.js +0 -36533
  142. package/dist/js/_echarts@4.9.0@echarts/_echarts@4.9.0@echarts.7d74ba77.js +0 -44219
  143. package/dist/js/_fflate@0.4.8@fflate/_fflate@0.4.8@fflate.d8111196.js +0 -571
  144. package/dist/js/_function-bind@1.1.1@function-bind/_function-bind@1.1.1@function-bind.de3cf11d.js +0 -46
  145. package/dist/js/_functions-have-names@1.2.3@functions-have-names/_functions-have-names@1.2.3@functions-have-names.7def2408.js +0 -27
  146. package/dist/js/_geojson-equality@0.1.6@geojson-equality/_geojson-equality@0.1.6@geojson-equality.09ffa121.js +0 -133
  147. package/dist/js/_geojson-path-finder@1.5.3@geojson-path-finder/_geojson-path-finder@1.5.3@geojson-path-finder.7a10eb99.js +0 -348
  148. package/dist/js/_geojson-rbush@3.2.0@geojson-rbush/_geojson-rbush@3.2.0@geojson-rbush.2adaeedb.js +0 -93
  149. package/dist/js/_geotiff@2.0.4@geotiff/_geotiff@2.0.4@geotiff.5b08f79e.js +0 -3663
  150. package/dist/js/_get-intrinsic@1.1.2@get-intrinsic/_get-intrinsic@1.1.2@get-intrinsic.a633bd68.js +0 -291
  151. package/dist/js/_has-property-descriptors@1.0.0@has-property-descriptors/_has-property-descriptors@1.0.0@has-property-descriptors.6bd2d302.js +0 -26
  152. package/dist/js/_has-symbols@1.0.3@has-symbols/_has-symbols@1.0.3@has-symbols.70406077.js +0 -63
  153. package/dist/js/_has-tostringtag@1.0.0@has-tostringtag/_has-tostringtag@1.0.0@has-tostringtag.2d502422.js +0 -6
  154. package/dist/js/_has@1.0.3@has/_has@1.0.3@has.ddd2eb68.js +0 -4
  155. package/dist/js/_ieee754@1.2.1@ieee754/_ieee754@1.2.1@ieee754.56426503.js +0 -80
  156. package/dist/js/_is-arguments@1.1.1@is-arguments/_is-arguments@1.1.1@is-arguments.7d77e24a.js +0 -23
  157. package/dist/js/_is-date-object@1.0.5@is-date-object/_is-date-object@1.0.5@is-date-object.08cc2543.js +0 -20
  158. package/dist/js/_is-regex@1.1.4@is-regex/_is-regex@1.1.4@is-regex.6417e007.js +0 -47
  159. package/dist/js/_jspdf@2.5.1@jspdf/_jspdf@2.5.1@jspdf.e927dbd8.js +0 -8494
  160. package/dist/js/_kml-geojson@1.2.0@kml-geojson/_kml-geojson@1.2.0@kml-geojson.f1ae86e4.js +0 -7858
  161. package/dist/js/_lru-cache@6.0.0@lru-cache/_lru-cache@6.0.0@lru-cache.dd72cc1b.js +0 -263
  162. package/dist/js/_mgrs@1.0.0@mgrs/_mgrs@1.0.0@mgrs.12d1da3e.js +0 -432
  163. package/dist/js/_object-assign@4.1.1@object-assign/_object-assign@4.1.1@object-assign.e4009c1c.js +0 -69
  164. package/dist/js/_object-is@1.1.5@object-is/_object-is@1.1.5@object-is.e47f5d65.js +0 -45
  165. package/dist/js/_object-keys@1.1.1@object-keys/_object-keys@1.1.1@object-keys.4b1d0a99.js +0 -151
  166. package/dist/js/_ol-echarts@2.0.6@ol-echarts/_ol-echarts@2.0.6@ol-echarts.658aaf82.js +0 -841
  167. package/dist/js/_ol-ext@3.2.30@ol-ext/_ol-ext@3.2.30@ol-ext.b94220dd.js +0 -4614
  168. package/dist/js/_ol-mapbox-style@8.2.1@ol-mapbox-style/_ol-mapbox-style@8.2.1@ol-mapbox-style.795310f3.js +0 -1
  169. package/dist/js/_ol@6.15.1@ol/_ol@6.15.1@ol.8fd0cbb5.js +0 -31823
  170. package/dist/js/_pbf@3.2.1@pbf/_pbf@3.2.1@pbf.330acf55.js +0 -647
  171. package/dist/js/_performance-now@2.1.0@performance-now/_performance-now@2.1.0@performance-now.a51379c2.js +0 -34
  172. package/dist/js/_point-in-polygon@1.1.0@point-in-polygon/_point-in-polygon@1.1.0@point-in-polygon.2cc4306e.js +0 -1
  173. package/dist/js/_polygon-clipping@0.15.3@polygon-clipping/_polygon-clipping@0.15.3@polygon-clipping.c0e9ec57.js +0 -1363
  174. package/dist/js/_proj4@2.8.0@proj4/_proj4@2.8.0@proj4.1600352c.js +0 -4885
  175. package/dist/js/_quickselect@1.1.1@quickselect/_quickselect@1.1.1@quickselect.8afce154.js +0 -1
  176. package/dist/js/_quickselect@2.0.0@quickselect/_quickselect@2.0.0@quickselect.9f5c1e48.js +0 -51
  177. package/dist/js/_raf@3.4.1@raf/_raf@3.4.1@raf.ac0d6c66.js +0 -60
  178. package/dist/js/_rbush@2.0.2@rbush/_rbush@2.0.2@rbush.7149e620.js +0 -1
  179. package/dist/js/_rbush@3.0.1@rbush/_rbush@3.0.1@rbush.57d33d95.js +0 -402
  180. package/dist/js/_regexp.prototype.flags@1.4.3@regexp.prototype.flags/_regexp.prototype.flags@1.4.3@regexp.prototype.flags.8b6921c6.js +0 -102
  181. package/dist/js/_rgbcolor@1.0.1@rgbcolor/_rgbcolor@1.0.1@rgbcolor.dd87e013.js +0 -272
  182. package/dist/js/_robust-predicates@2.0.4@robust-predicates/_robust-predicates@2.0.4@robust-predicates.564bf2f8.js +0 -1
  183. package/dist/js/_skmeans@0.9.7@skmeans/_skmeans@0.9.7@skmeans.933c6a76.js +0 -1
  184. package/dist/js/_splaytree@3.1.1@splaytree/_splaytree@3.1.1@splaytree.6cb55ed3.js +0 -671
  185. package/dist/js/_stackblur-canvas@2.5.0@stackblur-canvas/_stackblur-canvas@2.5.0@stackblur-canvas.dd883d14.js +0 -214
  186. package/dist/js/_svg-pathdata@6.0.3@svg-pathdata/_svg-pathdata@6.0.3@svg-pathdata.7e858a5f.js +0 -441
  187. package/dist/js/_tinyqueue@2.0.3@tinyqueue/_tinyqueue@2.0.3@tinyqueue.78918532.js +0 -73
  188. package/dist/js/_topojson-client@3.1.0@topojson-client/_topojson-client@3.1.0@topojson-client.aef4e2d5.js +0 -238
  189. package/dist/js/_topojson-server@3.0.1@topojson-server/_topojson-server@3.0.1@topojson-server.b521a412.js +0 -662
  190. package/dist/js/_turf-jsts@1.2.3@turf-jsts/_turf-jsts@1.2.3@turf-jsts.6ef42696.js +0 -18934
  191. package/dist/js/_web-worker@1.2.0@web-worker/_web-worker@1.2.0@web-worker.43288df7.js +0 -2
  192. package/dist/js/_wkt-parser@1.3.2@wkt-parser/_wkt-parser@1.3.2@wkt-parser.0e1cf374.js +0 -461
  193. package/dist/js/_xml-utils@1.2.0@xml-utils/_xml-utils@1.2.0@xml-utils.2a8ae655.js +0 -126
  194. package/dist/js/_yallist@4.0.0@yallist/_yallist@4.0.0@yallist.8350aafe.js +0 -363
  195. package/dist/js/_zrender@4.3.2@zrender/_zrender@4.3.2@zrender.1feea14d.js +0 -12455
  196. package/dist/mirage2d.es.js +0 -15894
@@ -1,4885 +0,0 @@
1
- import { w as wkt } from "../_wkt-parser@1.3.2@wkt-parser/_wkt-parser@1.3.2@wkt-parser.0e1cf374.js";
2
- import { t as toPoint, f as forward$u, m as mgrs } from "../_mgrs@1.0.0@mgrs/_mgrs@1.0.0@mgrs.12d1da3e.js";
3
- function globals(defs2) {
4
- defs2("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
5
- defs2("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
6
- defs2("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
7
- defs2.WGS84 = defs2["EPSG:4326"];
8
- defs2["EPSG:3785"] = defs2["EPSG:3857"];
9
- defs2.GOOGLE = defs2["EPSG:3857"];
10
- defs2["EPSG:900913"] = defs2["EPSG:3857"];
11
- defs2["EPSG:102113"] = defs2["EPSG:3857"];
12
- }
13
- var PJD_3PARAM = 1;
14
- var PJD_7PARAM = 2;
15
- var PJD_GRIDSHIFT = 3;
16
- var PJD_WGS84 = 4;
17
- var PJD_NODATUM = 5;
18
- var SRS_WGS84_SEMIMAJOR = 6378137;
19
- var SRS_WGS84_SEMIMINOR = 6356752314e-3;
20
- var SRS_WGS84_ESQUARED = 0.0066943799901413165;
21
- var SEC_TO_RAD = 484813681109536e-20;
22
- var HALF_PI = Math.PI / 2;
23
- var SIXTH = 0.16666666666666666;
24
- var RA4 = 0.04722222222222222;
25
- var RA6 = 0.022156084656084655;
26
- var EPSLN = 1e-10;
27
- var D2R = 0.017453292519943295;
28
- var R2D = 57.29577951308232;
29
- var FORTPI = Math.PI / 4;
30
- var TWO_PI = Math.PI * 2;
31
- var SPI = 3.14159265359;
32
- var exports$2 = {};
33
- exports$2.greenwich = 0;
34
- exports$2.lisbon = -9.131906111111;
35
- exports$2.paris = 2.337229166667;
36
- exports$2.bogota = -74.080916666667;
37
- exports$2.madrid = -3.687938888889;
38
- exports$2.rome = 12.452333333333;
39
- exports$2.bern = 7.439583333333;
40
- exports$2.jakarta = 106.807719444444;
41
- exports$2.ferro = -17.666666666667;
42
- exports$2.brussels = 4.367975;
43
- exports$2.stockholm = 18.058277777778;
44
- exports$2.athens = 23.7163375;
45
- exports$2.oslo = 10.722916666667;
46
- var units = {
47
- ft: { to_meter: 0.3048 },
48
- "us-ft": { to_meter: 1200 / 3937 }
49
- };
50
- var ignoredChar = /[\s_\-\/\(\)]/g;
51
- function match(obj, key) {
52
- if (obj[key]) {
53
- return obj[key];
54
- }
55
- var keys = Object.keys(obj);
56
- var lkey = key.toLowerCase().replace(ignoredChar, "");
57
- var i = -1;
58
- var testkey, processedKey;
59
- while (++i < keys.length) {
60
- testkey = keys[i];
61
- processedKey = testkey.toLowerCase().replace(ignoredChar, "");
62
- if (processedKey === lkey) {
63
- return obj[testkey];
64
- }
65
- }
66
- }
67
- function projStr(defData) {
68
- var self = {};
69
- var paramObj = defData.split("+").map(function(v) {
70
- return v.trim();
71
- }).filter(function(a) {
72
- return a;
73
- }).reduce(function(p, a) {
74
- var split = a.split("=");
75
- split.push(true);
76
- p[split[0].toLowerCase()] = split[1];
77
- return p;
78
- }, {});
79
- var paramName, paramVal, paramOutname;
80
- var params2 = {
81
- proj: "projName",
82
- datum: "datumCode",
83
- rf: function(v) {
84
- self.rf = parseFloat(v);
85
- },
86
- lat_0: function(v) {
87
- self.lat0 = v * D2R;
88
- },
89
- lat_1: function(v) {
90
- self.lat1 = v * D2R;
91
- },
92
- lat_2: function(v) {
93
- self.lat2 = v * D2R;
94
- },
95
- lat_ts: function(v) {
96
- self.lat_ts = v * D2R;
97
- },
98
- lon_0: function(v) {
99
- self.long0 = v * D2R;
100
- },
101
- lon_1: function(v) {
102
- self.long1 = v * D2R;
103
- },
104
- lon_2: function(v) {
105
- self.long2 = v * D2R;
106
- },
107
- alpha: function(v) {
108
- self.alpha = parseFloat(v) * D2R;
109
- },
110
- gamma: function(v) {
111
- self.rectified_grid_angle = parseFloat(v);
112
- },
113
- lonc: function(v) {
114
- self.longc = v * D2R;
115
- },
116
- x_0: function(v) {
117
- self.x0 = parseFloat(v);
118
- },
119
- y_0: function(v) {
120
- self.y0 = parseFloat(v);
121
- },
122
- k_0: function(v) {
123
- self.k0 = parseFloat(v);
124
- },
125
- k: function(v) {
126
- self.k0 = parseFloat(v);
127
- },
128
- a: function(v) {
129
- self.a = parseFloat(v);
130
- },
131
- b: function(v) {
132
- self.b = parseFloat(v);
133
- },
134
- r_a: function() {
135
- self.R_A = true;
136
- },
137
- zone: function(v) {
138
- self.zone = parseInt(v, 10);
139
- },
140
- south: function() {
141
- self.utmSouth = true;
142
- },
143
- towgs84: function(v) {
144
- self.datum_params = v.split(",").map(function(a) {
145
- return parseFloat(a);
146
- });
147
- },
148
- to_meter: function(v) {
149
- self.to_meter = parseFloat(v);
150
- },
151
- units: function(v) {
152
- self.units = v;
153
- var unit = match(units, v);
154
- if (unit) {
155
- self.to_meter = unit.to_meter;
156
- }
157
- },
158
- from_greenwich: function(v) {
159
- self.from_greenwich = v * D2R;
160
- },
161
- pm: function(v) {
162
- var pm = match(exports$2, v);
163
- self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
164
- },
165
- nadgrids: function(v) {
166
- if (v === "@null") {
167
- self.datumCode = "none";
168
- } else {
169
- self.nadgrids = v;
170
- }
171
- },
172
- axis: function(v) {
173
- var legalAxis = "ewnsud";
174
- if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
175
- self.axis = v;
176
- }
177
- },
178
- approx: function() {
179
- self.approx = true;
180
- }
181
- };
182
- for (paramName in paramObj) {
183
- paramVal = paramObj[paramName];
184
- if (paramName in params2) {
185
- paramOutname = params2[paramName];
186
- if (typeof paramOutname === "function") {
187
- paramOutname(paramVal);
188
- } else {
189
- self[paramOutname] = paramVal;
190
- }
191
- } else {
192
- self[paramName] = paramVal;
193
- }
194
- }
195
- if (typeof self.datumCode === "string" && self.datumCode !== "WGS84") {
196
- self.datumCode = self.datumCode.toLowerCase();
197
- }
198
- return self;
199
- }
200
- function defs(name) {
201
- var that = this;
202
- if (arguments.length === 2) {
203
- var def = arguments[1];
204
- if (typeof def === "string") {
205
- if (def.charAt(0) === "+") {
206
- defs[name] = projStr(arguments[1]);
207
- } else {
208
- defs[name] = wkt(arguments[1]);
209
- }
210
- } else {
211
- defs[name] = def;
212
- }
213
- } else if (arguments.length === 1) {
214
- if (Array.isArray(name)) {
215
- return name.map(function(v) {
216
- if (Array.isArray(v)) {
217
- defs.apply(that, v);
218
- } else {
219
- defs(v);
220
- }
221
- });
222
- } else if (typeof name === "string") {
223
- if (name in defs) {
224
- return defs[name];
225
- }
226
- } else if ("EPSG" in name) {
227
- defs["EPSG:" + name.EPSG] = name;
228
- } else if ("ESRI" in name) {
229
- defs["ESRI:" + name.ESRI] = name;
230
- } else if ("IAU2000" in name) {
231
- defs["IAU2000:" + name.IAU2000] = name;
232
- } else {
233
- console.log(name);
234
- }
235
- return;
236
- }
237
- }
238
- globals(defs);
239
- function testObj(code) {
240
- return typeof code === "string";
241
- }
242
- function testDef(code) {
243
- return code in defs;
244
- }
245
- var codeWords = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"];
246
- function testWKT(code) {
247
- return codeWords.some(function(word) {
248
- return code.indexOf(word) > -1;
249
- });
250
- }
251
- var codes = ["3857", "900913", "3785", "102113"];
252
- function checkMercator(item) {
253
- var auth = match(item, "authority");
254
- if (!auth) {
255
- return;
256
- }
257
- var code = match(auth, "epsg");
258
- return code && codes.indexOf(code) > -1;
259
- }
260
- function checkProjStr(item) {
261
- var ext = match(item, "extension");
262
- if (!ext) {
263
- return;
264
- }
265
- return match(ext, "proj4");
266
- }
267
- function testProj(code) {
268
- return code[0] === "+";
269
- }
270
- function parse(code) {
271
- if (testObj(code)) {
272
- if (testDef(code)) {
273
- return defs[code];
274
- }
275
- if (testWKT(code)) {
276
- var out = wkt(code);
277
- if (checkMercator(out)) {
278
- return defs["EPSG:3857"];
279
- }
280
- var maybeProjStr = checkProjStr(out);
281
- if (maybeProjStr) {
282
- return projStr(maybeProjStr);
283
- }
284
- return out;
285
- }
286
- if (testProj(code)) {
287
- return projStr(code);
288
- }
289
- } else {
290
- return code;
291
- }
292
- }
293
- function extend(destination, source) {
294
- destination = destination || {};
295
- var value, property;
296
- if (!source) {
297
- return destination;
298
- }
299
- for (property in source) {
300
- value = source[property];
301
- if (value !== void 0) {
302
- destination[property] = value;
303
- }
304
- }
305
- return destination;
306
- }
307
- function msfnz(eccent, sinphi, cosphi) {
308
- var con = eccent * sinphi;
309
- return cosphi / Math.sqrt(1 - con * con);
310
- }
311
- function sign(x) {
312
- return x < 0 ? -1 : 1;
313
- }
314
- function adjust_lon(x) {
315
- return Math.abs(x) <= SPI ? x : x - sign(x) * TWO_PI;
316
- }
317
- function tsfnz(eccent, phi, sinphi) {
318
- var con = eccent * sinphi;
319
- var com = 0.5 * eccent;
320
- con = Math.pow((1 - con) / (1 + con), com);
321
- return Math.tan(0.5 * (HALF_PI - phi)) / con;
322
- }
323
- function phi2z(eccent, ts) {
324
- var eccnth = 0.5 * eccent;
325
- var con, dphi;
326
- var phi = HALF_PI - 2 * Math.atan(ts);
327
- for (var i = 0; i <= 15; i++) {
328
- con = eccent * Math.sin(phi);
329
- dphi = HALF_PI - 2 * Math.atan(ts * Math.pow((1 - con) / (1 + con), eccnth)) - phi;
330
- phi += dphi;
331
- if (Math.abs(dphi) <= 1e-10) {
332
- return phi;
333
- }
334
- }
335
- return -9999;
336
- }
337
- function init$v() {
338
- var con = this.b / this.a;
339
- this.es = 1 - con * con;
340
- if (!("x0" in this)) {
341
- this.x0 = 0;
342
- }
343
- if (!("y0" in this)) {
344
- this.y0 = 0;
345
- }
346
- this.e = Math.sqrt(this.es);
347
- if (this.lat_ts) {
348
- if (this.sphere) {
349
- this.k0 = Math.cos(this.lat_ts);
350
- } else {
351
- this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
352
- }
353
- } else {
354
- if (!this.k0) {
355
- if (this.k) {
356
- this.k0 = this.k;
357
- } else {
358
- this.k0 = 1;
359
- }
360
- }
361
- }
362
- }
363
- function forward$t(p) {
364
- var lon = p.x;
365
- var lat = p.y;
366
- if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
367
- return null;
368
- }
369
- var x, y;
370
- if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
371
- return null;
372
- } else {
373
- if (this.sphere) {
374
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
375
- y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
376
- } else {
377
- var sinphi = Math.sin(lat);
378
- var ts = tsfnz(this.e, lat, sinphi);
379
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
380
- y = this.y0 - this.a * this.k0 * Math.log(ts);
381
- }
382
- p.x = x;
383
- p.y = y;
384
- return p;
385
- }
386
- }
387
- function inverse$t(p) {
388
- var x = p.x - this.x0;
389
- var y = p.y - this.y0;
390
- var lon, lat;
391
- if (this.sphere) {
392
- lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
393
- } else {
394
- var ts = Math.exp(-y / (this.a * this.k0));
395
- lat = phi2z(this.e, ts);
396
- if (lat === -9999) {
397
- return null;
398
- }
399
- }
400
- lon = adjust_lon(this.long0 + x / (this.a * this.k0));
401
- p.x = lon;
402
- p.y = lat;
403
- return p;
404
- }
405
- var names$w = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
406
- var merc = {
407
- init: init$v,
408
- forward: forward$t,
409
- inverse: inverse$t,
410
- names: names$w
411
- };
412
- function init$u() {
413
- }
414
- function identity(pt) {
415
- return pt;
416
- }
417
- var names$v = ["longlat", "identity"];
418
- var longlat = {
419
- init: init$u,
420
- forward: identity,
421
- inverse: identity,
422
- names: names$v
423
- };
424
- var projs = [merc, longlat];
425
- var names$u = {};
426
- var projStore = [];
427
- function add(proj, i) {
428
- var len = projStore.length;
429
- if (!proj.names) {
430
- console.log(i);
431
- return true;
432
- }
433
- projStore[len] = proj;
434
- proj.names.forEach(function(n) {
435
- names$u[n.toLowerCase()] = len;
436
- });
437
- return this;
438
- }
439
- function get(name) {
440
- if (!name) {
441
- return false;
442
- }
443
- var n = name.toLowerCase();
444
- if (typeof names$u[n] !== "undefined" && projStore[names$u[n]]) {
445
- return projStore[names$u[n]];
446
- }
447
- }
448
- function start() {
449
- projs.forEach(add);
450
- }
451
- var projections = {
452
- start,
453
- add,
454
- get
455
- };
456
- var exports$1 = {};
457
- exports$1.MERIT = {
458
- a: 6378137,
459
- rf: 298.257,
460
- ellipseName: "MERIT 1983"
461
- };
462
- exports$1.SGS85 = {
463
- a: 6378136,
464
- rf: 298.257,
465
- ellipseName: "Soviet Geodetic System 85"
466
- };
467
- exports$1.GRS80 = {
468
- a: 6378137,
469
- rf: 298.257222101,
470
- ellipseName: "GRS 1980(IUGG, 1980)"
471
- };
472
- exports$1.IAU76 = {
473
- a: 6378140,
474
- rf: 298.257,
475
- ellipseName: "IAU 1976"
476
- };
477
- exports$1.airy = {
478
- a: 6377563396e-3,
479
- b: 635625691e-2,
480
- ellipseName: "Airy 1830"
481
- };
482
- exports$1.APL4 = {
483
- a: 6378137,
484
- rf: 298.25,
485
- ellipseName: "Appl. Physics. 1965"
486
- };
487
- exports$1.NWL9D = {
488
- a: 6378145,
489
- rf: 298.25,
490
- ellipseName: "Naval Weapons Lab., 1965"
491
- };
492
- exports$1.mod_airy = {
493
- a: 6377340189e-3,
494
- b: 6356034446e-3,
495
- ellipseName: "Modified Airy"
496
- };
497
- exports$1.andrae = {
498
- a: 637710443e-2,
499
- rf: 300,
500
- ellipseName: "Andrae 1876 (Den., Iclnd.)"
501
- };
502
- exports$1.aust_SA = {
503
- a: 6378160,
504
- rf: 298.25,
505
- ellipseName: "Australian Natl & S. Amer. 1969"
506
- };
507
- exports$1.GRS67 = {
508
- a: 6378160,
509
- rf: 298.247167427,
510
- ellipseName: "GRS 67(IUGG 1967)"
511
- };
512
- exports$1.bessel = {
513
- a: 6377397155e-3,
514
- rf: 299.1528128,
515
- ellipseName: "Bessel 1841"
516
- };
517
- exports$1.bess_nam = {
518
- a: 6377483865e-3,
519
- rf: 299.1528128,
520
- ellipseName: "Bessel 1841 (Namibia)"
521
- };
522
- exports$1.clrk66 = {
523
- a: 63782064e-1,
524
- b: 63565838e-1,
525
- ellipseName: "Clarke 1866"
526
- };
527
- exports$1.clrk80 = {
528
- a: 6378249145e-3,
529
- rf: 293.4663,
530
- ellipseName: "Clarke 1880 mod."
531
- };
532
- exports$1.clrk58 = {
533
- a: 6378293645208759e-9,
534
- rf: 294.2606763692654,
535
- ellipseName: "Clarke 1858"
536
- };
537
- exports$1.CPM = {
538
- a: 63757387e-1,
539
- rf: 334.29,
540
- ellipseName: "Comm. des Poids et Mesures 1799"
541
- };
542
- exports$1.delmbr = {
543
- a: 6376428,
544
- rf: 311.5,
545
- ellipseName: "Delambre 1810 (Belgium)"
546
- };
547
- exports$1.engelis = {
548
- a: 637813605e-2,
549
- rf: 298.2566,
550
- ellipseName: "Engelis 1985"
551
- };
552
- exports$1.evrst30 = {
553
- a: 6377276345e-3,
554
- rf: 300.8017,
555
- ellipseName: "Everest 1830"
556
- };
557
- exports$1.evrst48 = {
558
- a: 6377304063e-3,
559
- rf: 300.8017,
560
- ellipseName: "Everest 1948"
561
- };
562
- exports$1.evrst56 = {
563
- a: 6377301243e-3,
564
- rf: 300.8017,
565
- ellipseName: "Everest 1956"
566
- };
567
- exports$1.evrst69 = {
568
- a: 6377295664e-3,
569
- rf: 300.8017,
570
- ellipseName: "Everest 1969"
571
- };
572
- exports$1.evrstSS = {
573
- a: 6377298556e-3,
574
- rf: 300.8017,
575
- ellipseName: "Everest (Sabah & Sarawak)"
576
- };
577
- exports$1.fschr60 = {
578
- a: 6378166,
579
- rf: 298.3,
580
- ellipseName: "Fischer (Mercury Datum) 1960"
581
- };
582
- exports$1.fschr60m = {
583
- a: 6378155,
584
- rf: 298.3,
585
- ellipseName: "Fischer 1960"
586
- };
587
- exports$1.fschr68 = {
588
- a: 6378150,
589
- rf: 298.3,
590
- ellipseName: "Fischer 1968"
591
- };
592
- exports$1.helmert = {
593
- a: 6378200,
594
- rf: 298.3,
595
- ellipseName: "Helmert 1906"
596
- };
597
- exports$1.hough = {
598
- a: 6378270,
599
- rf: 297,
600
- ellipseName: "Hough"
601
- };
602
- exports$1.intl = {
603
- a: 6378388,
604
- rf: 297,
605
- ellipseName: "International 1909 (Hayford)"
606
- };
607
- exports$1.kaula = {
608
- a: 6378163,
609
- rf: 298.24,
610
- ellipseName: "Kaula 1961"
611
- };
612
- exports$1.lerch = {
613
- a: 6378139,
614
- rf: 298.257,
615
- ellipseName: "Lerch 1979"
616
- };
617
- exports$1.mprts = {
618
- a: 6397300,
619
- rf: 191,
620
- ellipseName: "Maupertius 1738"
621
- };
622
- exports$1.new_intl = {
623
- a: 63781575e-1,
624
- b: 63567722e-1,
625
- ellipseName: "New International 1967"
626
- };
627
- exports$1.plessis = {
628
- a: 6376523,
629
- rf: 6355863,
630
- ellipseName: "Plessis 1817 (France)"
631
- };
632
- exports$1.krass = {
633
- a: 6378245,
634
- rf: 298.3,
635
- ellipseName: "Krassovsky, 1942"
636
- };
637
- exports$1.SEasia = {
638
- a: 6378155,
639
- b: 63567733205e-4,
640
- ellipseName: "Southeast Asia"
641
- };
642
- exports$1.walbeck = {
643
- a: 6376896,
644
- b: 63558348467e-4,
645
- ellipseName: "Walbeck"
646
- };
647
- exports$1.WGS60 = {
648
- a: 6378165,
649
- rf: 298.3,
650
- ellipseName: "WGS 60"
651
- };
652
- exports$1.WGS66 = {
653
- a: 6378145,
654
- rf: 298.25,
655
- ellipseName: "WGS 66"
656
- };
657
- exports$1.WGS7 = {
658
- a: 6378135,
659
- rf: 298.26,
660
- ellipseName: "WGS 72"
661
- };
662
- var WGS84 = exports$1.WGS84 = {
663
- a: 6378137,
664
- rf: 298.257223563,
665
- ellipseName: "WGS 84"
666
- };
667
- exports$1.sphere = {
668
- a: 6370997,
669
- b: 6370997,
670
- ellipseName: "Normal Sphere (r=6370997)"
671
- };
672
- function eccentricity(a, b, rf, R_A) {
673
- var a2 = a * a;
674
- var b2 = b * b;
675
- var es = (a2 - b2) / a2;
676
- var e = 0;
677
- if (R_A) {
678
- a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
679
- a2 = a * a;
680
- es = 0;
681
- } else {
682
- e = Math.sqrt(es);
683
- }
684
- var ep2 = (a2 - b2) / b2;
685
- return {
686
- es,
687
- e,
688
- ep2
689
- };
690
- }
691
- function sphere(a, b, rf, ellps, sphere2) {
692
- if (!a) {
693
- var ellipse = match(exports$1, ellps);
694
- if (!ellipse) {
695
- ellipse = WGS84;
696
- }
697
- a = ellipse.a;
698
- b = ellipse.b;
699
- rf = ellipse.rf;
700
- }
701
- if (rf && !b) {
702
- b = (1 - 1 / rf) * a;
703
- }
704
- if (rf === 0 || Math.abs(a - b) < EPSLN) {
705
- sphere2 = true;
706
- b = a;
707
- }
708
- return {
709
- a,
710
- b,
711
- rf,
712
- sphere: sphere2
713
- };
714
- }
715
- var exports = {};
716
- exports.wgs84 = {
717
- towgs84: "0,0,0",
718
- ellipse: "WGS84",
719
- datumName: "WGS84"
720
- };
721
- exports.ch1903 = {
722
- towgs84: "674.374,15.056,405.346",
723
- ellipse: "bessel",
724
- datumName: "swiss"
725
- };
726
- exports.ggrs87 = {
727
- towgs84: "-199.87,74.79,246.62",
728
- ellipse: "GRS80",
729
- datumName: "Greek_Geodetic_Reference_System_1987"
730
- };
731
- exports.nad83 = {
732
- towgs84: "0,0,0",
733
- ellipse: "GRS80",
734
- datumName: "North_American_Datum_1983"
735
- };
736
- exports.nad27 = {
737
- nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
738
- ellipse: "clrk66",
739
- datumName: "North_American_Datum_1927"
740
- };
741
- exports.potsdam = {
742
- towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
743
- ellipse: "bessel",
744
- datumName: "Potsdam Rauenberg 1950 DHDN"
745
- };
746
- exports.carthage = {
747
- towgs84: "-263.0,6.0,431.0",
748
- ellipse: "clark80",
749
- datumName: "Carthage 1934 Tunisia"
750
- };
751
- exports.hermannskogel = {
752
- towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
753
- ellipse: "bessel",
754
- datumName: "Hermannskogel"
755
- };
756
- exports.osni52 = {
757
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
758
- ellipse: "airy",
759
- datumName: "Irish National"
760
- };
761
- exports.ire65 = {
762
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
763
- ellipse: "mod_airy",
764
- datumName: "Ireland 1965"
765
- };
766
- exports.rassadiran = {
767
- towgs84: "-133.63,-157.5,-158.62",
768
- ellipse: "intl",
769
- datumName: "Rassadiran"
770
- };
771
- exports.nzgd49 = {
772
- towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
773
- ellipse: "intl",
774
- datumName: "New Zealand Geodetic Datum 1949"
775
- };
776
- exports.osgb36 = {
777
- towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
778
- ellipse: "airy",
779
- datumName: "Airy 1830"
780
- };
781
- exports.s_jtsk = {
782
- towgs84: "589,76,480",
783
- ellipse: "bessel",
784
- datumName: "S-JTSK (Ferro)"
785
- };
786
- exports.beduaram = {
787
- towgs84: "-106,-87,188",
788
- ellipse: "clrk80",
789
- datumName: "Beduaram"
790
- };
791
- exports.gunung_segara = {
792
- towgs84: "-403,684,41",
793
- ellipse: "bessel",
794
- datumName: "Gunung Segara Jakarta"
795
- };
796
- exports.rnb72 = {
797
- towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
798
- ellipse: "intl",
799
- datumName: "Reseau National Belge 1972"
800
- };
801
- function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
802
- var out = {};
803
- if (datumCode === void 0 || datumCode === "none") {
804
- out.datum_type = PJD_NODATUM;
805
- } else {
806
- out.datum_type = PJD_WGS84;
807
- }
808
- if (datum_params) {
809
- out.datum_params = datum_params.map(parseFloat);
810
- if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
811
- out.datum_type = PJD_3PARAM;
812
- }
813
- if (out.datum_params.length > 3) {
814
- if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
815
- out.datum_type = PJD_7PARAM;
816
- out.datum_params[3] *= SEC_TO_RAD;
817
- out.datum_params[4] *= SEC_TO_RAD;
818
- out.datum_params[5] *= SEC_TO_RAD;
819
- out.datum_params[6] = out.datum_params[6] / 1e6 + 1;
820
- }
821
- }
822
- }
823
- if (nadgrids) {
824
- out.datum_type = PJD_GRIDSHIFT;
825
- out.grids = nadgrids;
826
- }
827
- out.a = a;
828
- out.b = b;
829
- out.es = es;
830
- out.ep2 = ep2;
831
- return out;
832
- }
833
- var loadedNadgrids = {};
834
- function nadgrid(key, data) {
835
- var view = new DataView(data);
836
- var isLittleEndian = detectLittleEndian(view);
837
- var header = readHeader(view, isLittleEndian);
838
- if (header.nSubgrids > 1) {
839
- console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");
840
- }
841
- var subgrids = readSubgrids(view, header, isLittleEndian);
842
- var nadgrid2 = { header, subgrids };
843
- loadedNadgrids[key] = nadgrid2;
844
- return nadgrid2;
845
- }
846
- function getNadgrids(nadgrids) {
847
- if (nadgrids === void 0) {
848
- return null;
849
- }
850
- var grids = nadgrids.split(",");
851
- return grids.map(parseNadgridString);
852
- }
853
- function parseNadgridString(value) {
854
- if (value.length === 0) {
855
- return null;
856
- }
857
- var optional = value[0] === "@";
858
- if (optional) {
859
- value = value.slice(1);
860
- }
861
- if (value === "null") {
862
- return { name: "null", mandatory: !optional, grid: null, isNull: true };
863
- }
864
- return {
865
- name: value,
866
- mandatory: !optional,
867
- grid: loadedNadgrids[value] || null,
868
- isNull: false
869
- };
870
- }
871
- function secondsToRadians(seconds) {
872
- return seconds / 3600 * Math.PI / 180;
873
- }
874
- function detectLittleEndian(view) {
875
- var nFields = view.getInt32(8, false);
876
- if (nFields === 11) {
877
- return false;
878
- }
879
- nFields = view.getInt32(8, true);
880
- if (nFields !== 11) {
881
- console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");
882
- }
883
- return true;
884
- }
885
- function readHeader(view, isLittleEndian) {
886
- return {
887
- nFields: view.getInt32(8, isLittleEndian),
888
- nSubgridFields: view.getInt32(24, isLittleEndian),
889
- nSubgrids: view.getInt32(40, isLittleEndian),
890
- shiftType: decodeString(view, 56, 56 + 8).trim(),
891
- fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),
892
- fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),
893
- toSemiMajorAxis: view.getFloat64(152, isLittleEndian),
894
- toSemiMinorAxis: view.getFloat64(168, isLittleEndian)
895
- };
896
- }
897
- function decodeString(view, start2, end) {
898
- return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start2, end)));
899
- }
900
- function readSubgrids(view, header, isLittleEndian) {
901
- var gridOffset = 176;
902
- var grids = [];
903
- for (var i = 0; i < header.nSubgrids; i++) {
904
- var subHeader = readGridHeader(view, gridOffset, isLittleEndian);
905
- var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);
906
- var lngColumnCount = Math.round(
907
- 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval
908
- );
909
- var latColumnCount = Math.round(
910
- 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval
911
- );
912
- grids.push({
913
- ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],
914
- del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],
915
- lim: [lngColumnCount, latColumnCount],
916
- count: subHeader.gridNodeCount,
917
- cvs: mapNodes(nodes)
918
- });
919
- }
920
- return grids;
921
- }
922
- function mapNodes(nodes) {
923
- return nodes.map(function(r) {
924
- return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];
925
- });
926
- }
927
- function readGridHeader(view, offset, isLittleEndian) {
928
- return {
929
- name: decodeString(view, offset + 8, offset + 16).trim(),
930
- parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),
931
- lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),
932
- upperLatitude: view.getFloat64(offset + 88, isLittleEndian),
933
- lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),
934
- upperLongitude: view.getFloat64(offset + 120, isLittleEndian),
935
- latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),
936
- longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),
937
- gridNodeCount: view.getInt32(offset + 168, isLittleEndian)
938
- };
939
- }
940
- function readGridNodes(view, offset, gridHeader, isLittleEndian) {
941
- var nodesOffset = offset + 176;
942
- var gridRecordLength = 16;
943
- var gridShiftRecords = [];
944
- for (var i = 0; i < gridHeader.gridNodeCount; i++) {
945
- var record = {
946
- latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),
947
- longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),
948
- latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),
949
- longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian)
950
- };
951
- gridShiftRecords.push(record);
952
- }
953
- return gridShiftRecords;
954
- }
955
- function Projection(srsCode, callback) {
956
- if (!(this instanceof Projection)) {
957
- return new Projection(srsCode);
958
- }
959
- callback = callback || function(error) {
960
- if (error) {
961
- throw error;
962
- }
963
- };
964
- var json = parse(srsCode);
965
- if (typeof json !== "object") {
966
- callback(srsCode);
967
- return;
968
- }
969
- var ourProj = Projection.projections.get(json.projName);
970
- if (!ourProj) {
971
- callback(srsCode);
972
- return;
973
- }
974
- if (json.datumCode && json.datumCode !== "none") {
975
- var datumDef = match(exports, json.datumCode);
976
- if (datumDef) {
977
- json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(",") : null);
978
- json.ellps = datumDef.ellipse;
979
- json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
980
- }
981
- }
982
- json.k0 = json.k0 || 1;
983
- json.axis = json.axis || "enu";
984
- json.ellps = json.ellps || "wgs84";
985
- json.lat1 = json.lat1 || json.lat0;
986
- var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
987
- var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
988
- var nadgrids = getNadgrids(json.nadgrids);
989
- var datumObj = json.datum || datum(
990
- json.datumCode,
991
- json.datum_params,
992
- sphere_.a,
993
- sphere_.b,
994
- ecc.es,
995
- ecc.ep2,
996
- nadgrids
997
- );
998
- extend(this, json);
999
- extend(this, ourProj);
1000
- this.a = sphere_.a;
1001
- this.b = sphere_.b;
1002
- this.rf = sphere_.rf;
1003
- this.sphere = sphere_.sphere;
1004
- this.es = ecc.es;
1005
- this.e = ecc.e;
1006
- this.ep2 = ecc.ep2;
1007
- this.datum = datumObj;
1008
- this.init();
1009
- callback(null, this);
1010
- }
1011
- Projection.projections = projections;
1012
- Projection.projections.start();
1013
- function compareDatums(source, dest) {
1014
- if (source.datum_type !== dest.datum_type) {
1015
- return false;
1016
- } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 5e-11) {
1017
- return false;
1018
- } else if (source.datum_type === PJD_3PARAM) {
1019
- return source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2];
1020
- } else if (source.datum_type === PJD_7PARAM) {
1021
- return source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6];
1022
- } else {
1023
- return true;
1024
- }
1025
- }
1026
- function geodeticToGeocentric(p, es, a) {
1027
- var Longitude = p.x;
1028
- var Latitude = p.y;
1029
- var Height = p.z ? p.z : 0;
1030
- var Rn;
1031
- var Sin_Lat;
1032
- var Sin2_Lat;
1033
- var Cos_Lat;
1034
- if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
1035
- Latitude = -HALF_PI;
1036
- } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
1037
- Latitude = HALF_PI;
1038
- } else if (Latitude < -HALF_PI) {
1039
- return { x: -Infinity, y: -Infinity, z: p.z };
1040
- } else if (Latitude > HALF_PI) {
1041
- return { x: Infinity, y: Infinity, z: p.z };
1042
- }
1043
- if (Longitude > Math.PI) {
1044
- Longitude -= 2 * Math.PI;
1045
- }
1046
- Sin_Lat = Math.sin(Latitude);
1047
- Cos_Lat = Math.cos(Latitude);
1048
- Sin2_Lat = Sin_Lat * Sin_Lat;
1049
- Rn = a / Math.sqrt(1 - es * Sin2_Lat);
1050
- return {
1051
- x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
1052
- y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
1053
- z: (Rn * (1 - es) + Height) * Sin_Lat
1054
- };
1055
- }
1056
- function geocentricToGeodetic(p, es, a, b) {
1057
- var genau = 1e-12;
1058
- var genau2 = genau * genau;
1059
- var maxiter = 30;
1060
- var P;
1061
- var RR;
1062
- var CT;
1063
- var ST;
1064
- var RX;
1065
- var RK;
1066
- var RN;
1067
- var CPHI0;
1068
- var SPHI0;
1069
- var CPHI;
1070
- var SPHI;
1071
- var SDPHI;
1072
- var iter;
1073
- var X = p.x;
1074
- var Y = p.y;
1075
- var Z = p.z ? p.z : 0;
1076
- var Longitude;
1077
- var Latitude;
1078
- var Height;
1079
- P = Math.sqrt(X * X + Y * Y);
1080
- RR = Math.sqrt(X * X + Y * Y + Z * Z);
1081
- if (P / a < genau) {
1082
- Longitude = 0;
1083
- if (RR / a < genau) {
1084
- Latitude = HALF_PI;
1085
- Height = -b;
1086
- return {
1087
- x: p.x,
1088
- y: p.y,
1089
- z: p.z
1090
- };
1091
- }
1092
- } else {
1093
- Longitude = Math.atan2(Y, X);
1094
- }
1095
- CT = Z / RR;
1096
- ST = P / RR;
1097
- RX = 1 / Math.sqrt(1 - es * (2 - es) * ST * ST);
1098
- CPHI0 = ST * (1 - es) * RX;
1099
- SPHI0 = CT * RX;
1100
- iter = 0;
1101
- do {
1102
- iter++;
1103
- RN = a / Math.sqrt(1 - es * SPHI0 * SPHI0);
1104
- Height = P * CPHI0 + Z * SPHI0 - RN * (1 - es * SPHI0 * SPHI0);
1105
- RK = es * RN / (RN + Height);
1106
- RX = 1 / Math.sqrt(1 - RK * (2 - RK) * ST * ST);
1107
- CPHI = ST * (1 - RK) * RX;
1108
- SPHI = CT * RX;
1109
- SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
1110
- CPHI0 = CPHI;
1111
- SPHI0 = SPHI;
1112
- } while (SDPHI * SDPHI > genau2 && iter < maxiter);
1113
- Latitude = Math.atan(SPHI / Math.abs(CPHI));
1114
- return {
1115
- x: Longitude,
1116
- y: Latitude,
1117
- z: Height
1118
- };
1119
- }
1120
- function geocentricToWgs84(p, datum_type, datum_params) {
1121
- if (datum_type === PJD_3PARAM) {
1122
- return {
1123
- x: p.x + datum_params[0],
1124
- y: p.y + datum_params[1],
1125
- z: p.z + datum_params[2]
1126
- };
1127
- } else if (datum_type === PJD_7PARAM) {
1128
- var Dx_BF = datum_params[0];
1129
- var Dy_BF = datum_params[1];
1130
- var Dz_BF = datum_params[2];
1131
- var Rx_BF = datum_params[3];
1132
- var Ry_BF = datum_params[4];
1133
- var Rz_BF = datum_params[5];
1134
- var M_BF = datum_params[6];
1135
- return {
1136
- x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
1137
- y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
1138
- z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
1139
- };
1140
- }
1141
- }
1142
- function geocentricFromWgs84(p, datum_type, datum_params) {
1143
- if (datum_type === PJD_3PARAM) {
1144
- return {
1145
- x: p.x - datum_params[0],
1146
- y: p.y - datum_params[1],
1147
- z: p.z - datum_params[2]
1148
- };
1149
- } else if (datum_type === PJD_7PARAM) {
1150
- var Dx_BF = datum_params[0];
1151
- var Dy_BF = datum_params[1];
1152
- var Dz_BF = datum_params[2];
1153
- var Rx_BF = datum_params[3];
1154
- var Ry_BF = datum_params[4];
1155
- var Rz_BF = datum_params[5];
1156
- var M_BF = datum_params[6];
1157
- var x_tmp = (p.x - Dx_BF) / M_BF;
1158
- var y_tmp = (p.y - Dy_BF) / M_BF;
1159
- var z_tmp = (p.z - Dz_BF) / M_BF;
1160
- return {
1161
- x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
1162
- y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
1163
- z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
1164
- };
1165
- }
1166
- }
1167
- function checkParams(type) {
1168
- return type === PJD_3PARAM || type === PJD_7PARAM;
1169
- }
1170
- function datum_transform(source, dest, point) {
1171
- if (compareDatums(source, dest)) {
1172
- return point;
1173
- }
1174
- if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
1175
- return point;
1176
- }
1177
- var source_a = source.a;
1178
- var source_es = source.es;
1179
- if (source.datum_type === PJD_GRIDSHIFT) {
1180
- var gridShiftCode = applyGridShift(source, false, point);
1181
- if (gridShiftCode !== 0) {
1182
- return void 0;
1183
- }
1184
- source_a = SRS_WGS84_SEMIMAJOR;
1185
- source_es = SRS_WGS84_ESQUARED;
1186
- }
1187
- var dest_a = dest.a;
1188
- var dest_b = dest.b;
1189
- var dest_es = dest.es;
1190
- if (dest.datum_type === PJD_GRIDSHIFT) {
1191
- dest_a = SRS_WGS84_SEMIMAJOR;
1192
- dest_b = SRS_WGS84_SEMIMINOR;
1193
- dest_es = SRS_WGS84_ESQUARED;
1194
- }
1195
- if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
1196
- return point;
1197
- }
1198
- point = geodeticToGeocentric(point, source_es, source_a);
1199
- if (checkParams(source.datum_type)) {
1200
- point = geocentricToWgs84(point, source.datum_type, source.datum_params);
1201
- }
1202
- if (checkParams(dest.datum_type)) {
1203
- point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
1204
- }
1205
- point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);
1206
- if (dest.datum_type === PJD_GRIDSHIFT) {
1207
- var destGridShiftResult = applyGridShift(dest, true, point);
1208
- if (destGridShiftResult !== 0) {
1209
- return void 0;
1210
- }
1211
- }
1212
- return point;
1213
- }
1214
- function applyGridShift(source, inverse2, point) {
1215
- if (source.grids === null || source.grids.length === 0) {
1216
- console.log("Grid shift grids not found");
1217
- return -1;
1218
- }
1219
- var input = { x: -point.x, y: point.y };
1220
- var output = { x: Number.NaN, y: Number.NaN };
1221
- var attemptedGrids = [];
1222
- for (var i = 0; i < source.grids.length; i++) {
1223
- var grid = source.grids[i];
1224
- attemptedGrids.push(grid.name);
1225
- if (grid.isNull) {
1226
- output = input;
1227
- break;
1228
- }
1229
- grid.mandatory;
1230
- if (grid.grid === null) {
1231
- if (grid.mandatory) {
1232
- console.log("Unable to find mandatory grid '" + grid.name + "'");
1233
- return -1;
1234
- }
1235
- continue;
1236
- }
1237
- var subgrid = grid.grid.subgrids[0];
1238
- var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 1e4;
1239
- var minX = subgrid.ll[0] - epsilon;
1240
- var minY = subgrid.ll[1] - epsilon;
1241
- var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;
1242
- var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;
1243
- if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x) {
1244
- continue;
1245
- }
1246
- output = applySubgridShift(input, inverse2, subgrid);
1247
- if (!isNaN(output.x)) {
1248
- break;
1249
- }
1250
- }
1251
- if (isNaN(output.x)) {
1252
- console.log("Failed to find a grid shift table for location '" + -input.x * R2D + " " + input.y * R2D + " tried: '" + attemptedGrids + "'");
1253
- return -1;
1254
- }
1255
- point.x = -output.x;
1256
- point.y = output.y;
1257
- return 0;
1258
- }
1259
- function applySubgridShift(pin, inverse2, ct) {
1260
- var val = { x: Number.NaN, y: Number.NaN };
1261
- if (isNaN(pin.x)) {
1262
- return val;
1263
- }
1264
- var tb = { x: pin.x, y: pin.y };
1265
- tb.x -= ct.ll[0];
1266
- tb.y -= ct.ll[1];
1267
- tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;
1268
- var t = nadInterpolate(tb, ct);
1269
- if (inverse2) {
1270
- if (isNaN(t.x)) {
1271
- return val;
1272
- }
1273
- t.x = tb.x - t.x;
1274
- t.y = tb.y - t.y;
1275
- var i = 9, tol = 1e-12;
1276
- var dif, del;
1277
- do {
1278
- del = nadInterpolate(t, ct);
1279
- if (isNaN(del.x)) {
1280
- console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");
1281
- break;
1282
- }
1283
- dif = { x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y) };
1284
- t.x += dif.x;
1285
- t.y += dif.y;
1286
- } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);
1287
- if (i < 0) {
1288
- console.log("Inverse grid shift iterator failed to converge.");
1289
- return val;
1290
- }
1291
- val.x = adjust_lon(t.x + ct.ll[0]);
1292
- val.y = t.y + ct.ll[1];
1293
- } else {
1294
- if (!isNaN(t.x)) {
1295
- val.x = pin.x + t.x;
1296
- val.y = pin.y + t.y;
1297
- }
1298
- }
1299
- return val;
1300
- }
1301
- function nadInterpolate(pin, ct) {
1302
- var t = { x: pin.x / ct.del[0], y: pin.y / ct.del[1] };
1303
- var indx = { x: Math.floor(t.x), y: Math.floor(t.y) };
1304
- var frct = { x: t.x - 1 * indx.x, y: t.y - 1 * indx.y };
1305
- var val = { x: Number.NaN, y: Number.NaN };
1306
- var inx;
1307
- if (indx.x < 0 || indx.x >= ct.lim[0]) {
1308
- return val;
1309
- }
1310
- if (indx.y < 0 || indx.y >= ct.lim[1]) {
1311
- return val;
1312
- }
1313
- inx = indx.y * ct.lim[0] + indx.x;
1314
- var f00 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };
1315
- inx++;
1316
- var f10 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };
1317
- inx += ct.lim[0];
1318
- var f11 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };
1319
- inx--;
1320
- var f01 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };
1321
- var m11 = frct.x * frct.y, m10 = frct.x * (1 - frct.y), m00 = (1 - frct.x) * (1 - frct.y), m01 = (1 - frct.x) * frct.y;
1322
- val.x = m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x;
1323
- val.y = m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y;
1324
- return val;
1325
- }
1326
- function adjust_axis(crs, denorm, point) {
1327
- var xin = point.x, yin = point.y, zin = point.z || 0;
1328
- var v, t, i;
1329
- var out = {};
1330
- for (i = 0; i < 3; i++) {
1331
- if (denorm && i === 2 && point.z === void 0) {
1332
- continue;
1333
- }
1334
- if (i === 0) {
1335
- v = xin;
1336
- if ("ew".indexOf(crs.axis[i]) !== -1) {
1337
- t = "x";
1338
- } else {
1339
- t = "y";
1340
- }
1341
- } else if (i === 1) {
1342
- v = yin;
1343
- if ("ns".indexOf(crs.axis[i]) !== -1) {
1344
- t = "y";
1345
- } else {
1346
- t = "x";
1347
- }
1348
- } else {
1349
- v = zin;
1350
- t = "z";
1351
- }
1352
- switch (crs.axis[i]) {
1353
- case "e":
1354
- out[t] = v;
1355
- break;
1356
- case "w":
1357
- out[t] = -v;
1358
- break;
1359
- case "n":
1360
- out[t] = v;
1361
- break;
1362
- case "s":
1363
- out[t] = -v;
1364
- break;
1365
- case "u":
1366
- if (point[t] !== void 0) {
1367
- out.z = v;
1368
- }
1369
- break;
1370
- case "d":
1371
- if (point[t] !== void 0) {
1372
- out.z = -v;
1373
- }
1374
- break;
1375
- default:
1376
- return null;
1377
- }
1378
- }
1379
- return out;
1380
- }
1381
- function common(array) {
1382
- var out = {
1383
- x: array[0],
1384
- y: array[1]
1385
- };
1386
- if (array.length > 2) {
1387
- out.z = array[2];
1388
- }
1389
- if (array.length > 3) {
1390
- out.m = array[3];
1391
- }
1392
- return out;
1393
- }
1394
- function checkSanity(point) {
1395
- checkCoord(point.x);
1396
- checkCoord(point.y);
1397
- }
1398
- function checkCoord(num) {
1399
- if (typeof Number.isFinite === "function") {
1400
- if (Number.isFinite(num)) {
1401
- return;
1402
- }
1403
- throw new TypeError("coordinates must be finite numbers");
1404
- }
1405
- if (typeof num !== "number" || num !== num || !isFinite(num)) {
1406
- throw new TypeError("coordinates must be finite numbers");
1407
- }
1408
- }
1409
- function checkNotWGS(source, dest) {
1410
- return (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== "WGS84" || (dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== "WGS84";
1411
- }
1412
- function transform(source, dest, point, enforceAxis) {
1413
- var wgs842;
1414
- if (Array.isArray(point)) {
1415
- point = common(point);
1416
- }
1417
- checkSanity(point);
1418
- if (source.datum && dest.datum && checkNotWGS(source, dest)) {
1419
- wgs842 = new Projection("WGS84");
1420
- point = transform(source, wgs842, point, enforceAxis);
1421
- source = wgs842;
1422
- }
1423
- if (enforceAxis && source.axis !== "enu") {
1424
- point = adjust_axis(source, false, point);
1425
- }
1426
- if (source.projName === "longlat") {
1427
- point = {
1428
- x: point.x * D2R,
1429
- y: point.y * D2R,
1430
- z: point.z || 0
1431
- };
1432
- } else {
1433
- if (source.to_meter) {
1434
- point = {
1435
- x: point.x * source.to_meter,
1436
- y: point.y * source.to_meter,
1437
- z: point.z || 0
1438
- };
1439
- }
1440
- point = source.inverse(point);
1441
- if (!point) {
1442
- return;
1443
- }
1444
- }
1445
- if (source.from_greenwich) {
1446
- point.x += source.from_greenwich;
1447
- }
1448
- point = datum_transform(source.datum, dest.datum, point);
1449
- if (!point) {
1450
- return;
1451
- }
1452
- if (dest.from_greenwich) {
1453
- point = {
1454
- x: point.x - dest.from_greenwich,
1455
- y: point.y,
1456
- z: point.z || 0
1457
- };
1458
- }
1459
- if (dest.projName === "longlat") {
1460
- point = {
1461
- x: point.x * R2D,
1462
- y: point.y * R2D,
1463
- z: point.z || 0
1464
- };
1465
- } else {
1466
- point = dest.forward(point);
1467
- if (dest.to_meter) {
1468
- point = {
1469
- x: point.x / dest.to_meter,
1470
- y: point.y / dest.to_meter,
1471
- z: point.z || 0
1472
- };
1473
- }
1474
- }
1475
- if (enforceAxis && dest.axis !== "enu") {
1476
- return adjust_axis(dest, true, point);
1477
- }
1478
- return point;
1479
- }
1480
- var wgs84 = Projection("WGS84");
1481
- function transformer(from, to, coords, enforceAxis) {
1482
- var transformedArray, out, keys;
1483
- if (Array.isArray(coords)) {
1484
- transformedArray = transform(from, to, coords, enforceAxis) || { x: NaN, y: NaN };
1485
- if (coords.length > 2) {
1486
- if (typeof from.name !== "undefined" && from.name === "geocent" || typeof to.name !== "undefined" && to.name === "geocent") {
1487
- if (typeof transformedArray.z === "number") {
1488
- return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
1489
- } else {
1490
- return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
1491
- }
1492
- } else {
1493
- return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
1494
- }
1495
- } else {
1496
- return [transformedArray.x, transformedArray.y];
1497
- }
1498
- } else {
1499
- out = transform(from, to, coords, enforceAxis);
1500
- keys = Object.keys(coords);
1501
- if (keys.length === 2) {
1502
- return out;
1503
- }
1504
- keys.forEach(function(key) {
1505
- if (typeof from.name !== "undefined" && from.name === "geocent" || typeof to.name !== "undefined" && to.name === "geocent") {
1506
- if (key === "x" || key === "y" || key === "z") {
1507
- return;
1508
- }
1509
- } else {
1510
- if (key === "x" || key === "y") {
1511
- return;
1512
- }
1513
- }
1514
- out[key] = coords[key];
1515
- });
1516
- return out;
1517
- }
1518
- }
1519
- function checkProj(item) {
1520
- if (item instanceof Projection) {
1521
- return item;
1522
- }
1523
- if (item.oProj) {
1524
- return item.oProj;
1525
- }
1526
- return Projection(item);
1527
- }
1528
- function proj4(fromProj, toProj, coord) {
1529
- fromProj = checkProj(fromProj);
1530
- var single = false;
1531
- var obj;
1532
- if (typeof toProj === "undefined") {
1533
- toProj = fromProj;
1534
- fromProj = wgs84;
1535
- single = true;
1536
- } else if (typeof toProj.x !== "undefined" || Array.isArray(toProj)) {
1537
- coord = toProj;
1538
- toProj = fromProj;
1539
- fromProj = wgs84;
1540
- single = true;
1541
- }
1542
- toProj = checkProj(toProj);
1543
- if (coord) {
1544
- return transformer(fromProj, toProj, coord);
1545
- } else {
1546
- obj = {
1547
- forward: function(coords, enforceAxis) {
1548
- return transformer(fromProj, toProj, coords, enforceAxis);
1549
- },
1550
- inverse: function(coords, enforceAxis) {
1551
- return transformer(toProj, fromProj, coords, enforceAxis);
1552
- }
1553
- };
1554
- if (single) {
1555
- obj.oProj = toProj;
1556
- }
1557
- return obj;
1558
- }
1559
- }
1560
- function Point(x, y, z) {
1561
- if (!(this instanceof Point)) {
1562
- return new Point(x, y, z);
1563
- }
1564
- if (Array.isArray(x)) {
1565
- this.x = x[0];
1566
- this.y = x[1];
1567
- this.z = x[2] || 0;
1568
- } else if (typeof x === "object") {
1569
- this.x = x.x;
1570
- this.y = x.y;
1571
- this.z = x.z || 0;
1572
- } else if (typeof x === "string" && typeof y === "undefined") {
1573
- var coords = x.split(",");
1574
- this.x = parseFloat(coords[0], 10);
1575
- this.y = parseFloat(coords[1], 10);
1576
- this.z = parseFloat(coords[2], 10) || 0;
1577
- } else {
1578
- this.x = x;
1579
- this.y = y;
1580
- this.z = z || 0;
1581
- }
1582
- console.warn("proj4.Point will be removed in version 3, use proj4.toPoint");
1583
- }
1584
- Point.fromMGRS = function(mgrsStr) {
1585
- return new Point(toPoint(mgrsStr));
1586
- };
1587
- Point.prototype.toMGRS = function(accuracy) {
1588
- return forward$u([this.x, this.y], accuracy);
1589
- };
1590
- var C00 = 1;
1591
- var C02 = 0.25;
1592
- var C04 = 0.046875;
1593
- var C06 = 0.01953125;
1594
- var C08 = 0.01068115234375;
1595
- var C22 = 0.75;
1596
- var C44 = 0.46875;
1597
- var C46 = 0.013020833333333334;
1598
- var C48 = 0.007120768229166667;
1599
- var C66 = 0.3645833333333333;
1600
- var C68 = 0.005696614583333333;
1601
- var C88 = 0.3076171875;
1602
- function pj_enfn(es) {
1603
- var en = [];
1604
- en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
1605
- en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
1606
- var t = es * es;
1607
- en[2] = t * (C44 - es * (C46 + es * C48));
1608
- t *= es;
1609
- en[3] = t * (C66 - es * C68);
1610
- en[4] = t * es * C88;
1611
- return en;
1612
- }
1613
- function pj_mlfn(phi, sphi, cphi, en) {
1614
- cphi *= sphi;
1615
- sphi *= sphi;
1616
- return en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4])));
1617
- }
1618
- var MAX_ITER$3 = 20;
1619
- function pj_inv_mlfn(arg, es, en) {
1620
- var k = 1 / (1 - es);
1621
- var phi = arg;
1622
- for (var i = MAX_ITER$3; i; --i) {
1623
- var s = Math.sin(phi);
1624
- var t = 1 - es * s * s;
1625
- t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
1626
- phi -= t;
1627
- if (Math.abs(t) < EPSLN) {
1628
- return phi;
1629
- }
1630
- }
1631
- return phi;
1632
- }
1633
- function init$t() {
1634
- this.x0 = this.x0 !== void 0 ? this.x0 : 0;
1635
- this.y0 = this.y0 !== void 0 ? this.y0 : 0;
1636
- this.long0 = this.long0 !== void 0 ? this.long0 : 0;
1637
- this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0;
1638
- if (this.es) {
1639
- this.en = pj_enfn(this.es);
1640
- this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
1641
- }
1642
- }
1643
- function forward$s(p) {
1644
- var lon = p.x;
1645
- var lat = p.y;
1646
- var delta_lon = adjust_lon(lon - this.long0);
1647
- var con;
1648
- var x, y;
1649
- var sin_phi = Math.sin(lat);
1650
- var cos_phi = Math.cos(lat);
1651
- if (!this.es) {
1652
- var b = cos_phi * Math.sin(delta_lon);
1653
- if (Math.abs(Math.abs(b) - 1) < EPSLN) {
1654
- return 93;
1655
- } else {
1656
- x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
1657
- y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
1658
- b = Math.abs(y);
1659
- if (b >= 1) {
1660
- if (b - 1 > EPSLN) {
1661
- return 93;
1662
- } else {
1663
- y = 0;
1664
- }
1665
- } else {
1666
- y = Math.acos(y);
1667
- }
1668
- if (lat < 0) {
1669
- y = -y;
1670
- }
1671
- y = this.a * this.k0 * (y - this.lat0) + this.y0;
1672
- }
1673
- } else {
1674
- var al = cos_phi * delta_lon;
1675
- var als = Math.pow(al, 2);
1676
- var c = this.ep2 * Math.pow(cos_phi, 2);
1677
- var cs = Math.pow(c, 2);
1678
- var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
1679
- var t = Math.pow(tq, 2);
1680
- var ts = Math.pow(t, 2);
1681
- con = 1 - this.es * Math.pow(sin_phi, 2);
1682
- al = al / Math.sqrt(con);
1683
- var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
1684
- x = this.a * (this.k0 * al * (1 + als / 6 * (1 - t + c + als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c + als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) + this.x0;
1685
- y = this.a * (this.k0 * (ml - this.ml0 + sin_phi * delta_lon * al / 2 * (1 + als / 12 * (5 - t + 9 * c + 4 * cs + als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c + als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) + this.y0;
1686
- }
1687
- p.x = x;
1688
- p.y = y;
1689
- return p;
1690
- }
1691
- function inverse$s(p) {
1692
- var con, phi;
1693
- var lat, lon;
1694
- var x = (p.x - this.x0) * (1 / this.a);
1695
- var y = (p.y - this.y0) * (1 / this.a);
1696
- if (!this.es) {
1697
- var f = Math.exp(x / this.k0);
1698
- var g = 0.5 * (f - 1 / f);
1699
- var temp = this.lat0 + y / this.k0;
1700
- var h = Math.cos(temp);
1701
- con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
1702
- lat = Math.asin(con);
1703
- if (y < 0) {
1704
- lat = -lat;
1705
- }
1706
- if (g === 0 && h === 0) {
1707
- lon = 0;
1708
- } else {
1709
- lon = adjust_lon(Math.atan2(g, h) + this.long0);
1710
- }
1711
- } else {
1712
- con = this.ml0 + y / this.k0;
1713
- phi = pj_inv_mlfn(con, this.es, this.en);
1714
- if (Math.abs(phi) < HALF_PI) {
1715
- var sin_phi = Math.sin(phi);
1716
- var cos_phi = Math.cos(phi);
1717
- var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
1718
- var c = this.ep2 * Math.pow(cos_phi, 2);
1719
- var cs = Math.pow(c, 2);
1720
- var t = Math.pow(tan_phi, 2);
1721
- var ts = Math.pow(t, 2);
1722
- con = 1 - this.es * Math.pow(sin_phi, 2);
1723
- var d = x * Math.sqrt(con) / this.k0;
1724
- var ds = Math.pow(d, 2);
1725
- con = con * tan_phi;
1726
- lat = phi - con * ds / (1 - this.es) * 0.5 * (1 - ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs - ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c - ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
1727
- lon = adjust_lon(this.long0 + d * (1 - ds / 6 * (1 + 2 * t + c - ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c - ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi);
1728
- } else {
1729
- lat = HALF_PI * sign(y);
1730
- lon = 0;
1731
- }
1732
- }
1733
- p.x = lon;
1734
- p.y = lat;
1735
- return p;
1736
- }
1737
- var names$t = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"];
1738
- var tmerc = {
1739
- init: init$t,
1740
- forward: forward$s,
1741
- inverse: inverse$s,
1742
- names: names$t
1743
- };
1744
- function sinh(x) {
1745
- var r = Math.exp(x);
1746
- r = (r - 1 / r) / 2;
1747
- return r;
1748
- }
1749
- function hypot(x, y) {
1750
- x = Math.abs(x);
1751
- y = Math.abs(y);
1752
- var a = Math.max(x, y);
1753
- var b = Math.min(x, y) / (a ? a : 1);
1754
- return a * Math.sqrt(1 + Math.pow(b, 2));
1755
- }
1756
- function log1py(x) {
1757
- var y = 1 + x;
1758
- var z = y - 1;
1759
- return z === 0 ? x : x * Math.log(y) / z;
1760
- }
1761
- function asinhy(x) {
1762
- var y = Math.abs(x);
1763
- y = log1py(y * (1 + y / (hypot(1, y) + 1)));
1764
- return x < 0 ? -y : y;
1765
- }
1766
- function gatg(pp, B) {
1767
- var cos_2B = 2 * Math.cos(2 * B);
1768
- var i = pp.length - 1;
1769
- var h1 = pp[i];
1770
- var h2 = 0;
1771
- var h;
1772
- while (--i >= 0) {
1773
- h = -h2 + cos_2B * h1 + pp[i];
1774
- h2 = h1;
1775
- h1 = h;
1776
- }
1777
- return B + h * Math.sin(2 * B);
1778
- }
1779
- function clens(pp, arg_r) {
1780
- var r = 2 * Math.cos(arg_r);
1781
- var i = pp.length - 1;
1782
- var hr1 = pp[i];
1783
- var hr2 = 0;
1784
- var hr;
1785
- while (--i >= 0) {
1786
- hr = -hr2 + r * hr1 + pp[i];
1787
- hr2 = hr1;
1788
- hr1 = hr;
1789
- }
1790
- return Math.sin(arg_r) * hr;
1791
- }
1792
- function cosh(x) {
1793
- var r = Math.exp(x);
1794
- r = (r + 1 / r) / 2;
1795
- return r;
1796
- }
1797
- function clens_cmplx(pp, arg_r, arg_i) {
1798
- var sin_arg_r = Math.sin(arg_r);
1799
- var cos_arg_r = Math.cos(arg_r);
1800
- var sinh_arg_i = sinh(arg_i);
1801
- var cosh_arg_i = cosh(arg_i);
1802
- var r = 2 * cos_arg_r * cosh_arg_i;
1803
- var i = -2 * sin_arg_r * sinh_arg_i;
1804
- var j = pp.length - 1;
1805
- var hr = pp[j];
1806
- var hi1 = 0;
1807
- var hr1 = 0;
1808
- var hi = 0;
1809
- var hr2;
1810
- var hi2;
1811
- while (--j >= 0) {
1812
- hr2 = hr1;
1813
- hi2 = hi1;
1814
- hr1 = hr;
1815
- hi1 = hi;
1816
- hr = -hr2 + r * hr1 - i * hi1 + pp[j];
1817
- hi = -hi2 + i * hr1 + r * hi1;
1818
- }
1819
- r = sin_arg_r * cosh_arg_i;
1820
- i = cos_arg_r * sinh_arg_i;
1821
- return [r * hr - i * hi, r * hi + i * hr];
1822
- }
1823
- function init$s() {
1824
- if (!this.approx && (isNaN(this.es) || this.es <= 0)) {
1825
- throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
1826
- }
1827
- if (this.approx) {
1828
- tmerc.init.apply(this);
1829
- this.forward = tmerc.forward;
1830
- this.inverse = tmerc.inverse;
1831
- }
1832
- this.x0 = this.x0 !== void 0 ? this.x0 : 0;
1833
- this.y0 = this.y0 !== void 0 ? this.y0 : 0;
1834
- this.long0 = this.long0 !== void 0 ? this.long0 : 0;
1835
- this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0;
1836
- this.cgb = [];
1837
- this.cbg = [];
1838
- this.utg = [];
1839
- this.gtu = [];
1840
- var f = this.es / (1 + Math.sqrt(1 - this.es));
1841
- var n = f / (2 - f);
1842
- var np = n;
1843
- this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675))))));
1844
- this.cbg[0] = n * (-2 + n * (2 / 3 + n * (4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
1845
- np = np * n;
1846
- this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
1847
- this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * (-13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
1848
- np = np * n;
1849
- this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
1850
- this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
1851
- np = np * n;
1852
- this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
1853
- this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * (-24832 / 14175)));
1854
- np = np * n;
1855
- this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
1856
- this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
1857
- np = np * n;
1858
- this.cgb[5] = np * (601676 / 22275);
1859
- this.cbg[5] = np * (444337 / 155925);
1860
- np = Math.pow(n, 2);
1861
- this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
1862
- this.utg[0] = n * (-0.5 + n * (2 / 3 + n * (-37 / 96 + n * (1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
1863
- this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
1864
- this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
1865
- this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
1866
- np = np * n;
1867
- this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720))));
1868
- this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
1869
- np = np * n;
1870
- this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
1871
- this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
1872
- np = np * n;
1873
- this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
1874
- this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
1875
- np = np * n;
1876
- this.utg[5] = np * (-20648693 / 638668800);
1877
- this.gtu[5] = np * (212378941 / 319334400);
1878
- var Z = gatg(this.cbg, this.lat0);
1879
- this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
1880
- }
1881
- function forward$r(p) {
1882
- var Ce = adjust_lon(p.x - this.long0);
1883
- var Cn = p.y;
1884
- Cn = gatg(this.cbg, Cn);
1885
- var sin_Cn = Math.sin(Cn);
1886
- var cos_Cn = Math.cos(Cn);
1887
- var sin_Ce = Math.sin(Ce);
1888
- var cos_Ce = Math.cos(Ce);
1889
- Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
1890
- Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
1891
- Ce = asinhy(Math.tan(Ce));
1892
- var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
1893
- Cn = Cn + tmp[0];
1894
- Ce = Ce + tmp[1];
1895
- var x;
1896
- var y;
1897
- if (Math.abs(Ce) <= 2.623395162778) {
1898
- x = this.a * (this.Qn * Ce) + this.x0;
1899
- y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
1900
- } else {
1901
- x = Infinity;
1902
- y = Infinity;
1903
- }
1904
- p.x = x;
1905
- p.y = y;
1906
- return p;
1907
- }
1908
- function inverse$r(p) {
1909
- var Ce = (p.x - this.x0) * (1 / this.a);
1910
- var Cn = (p.y - this.y0) * (1 / this.a);
1911
- Cn = (Cn - this.Zb) / this.Qn;
1912
- Ce = Ce / this.Qn;
1913
- var lon;
1914
- var lat;
1915
- if (Math.abs(Ce) <= 2.623395162778) {
1916
- var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
1917
- Cn = Cn + tmp[0];
1918
- Ce = Ce + tmp[1];
1919
- Ce = Math.atan(sinh(Ce));
1920
- var sin_Cn = Math.sin(Cn);
1921
- var cos_Cn = Math.cos(Cn);
1922
- var sin_Ce = Math.sin(Ce);
1923
- var cos_Ce = Math.cos(Ce);
1924
- Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
1925
- Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
1926
- lon = adjust_lon(Ce + this.long0);
1927
- lat = gatg(this.cgb, Cn);
1928
- } else {
1929
- lon = Infinity;
1930
- lat = Infinity;
1931
- }
1932
- p.x = lon;
1933
- p.y = lat;
1934
- return p;
1935
- }
1936
- var names$s = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"];
1937
- var etmerc = {
1938
- init: init$s,
1939
- forward: forward$r,
1940
- inverse: inverse$r,
1941
- names: names$s
1942
- };
1943
- function adjust_zone(zone, lon) {
1944
- if (zone === void 0) {
1945
- zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
1946
- if (zone < 0) {
1947
- return 0;
1948
- } else if (zone > 60) {
1949
- return 60;
1950
- }
1951
- }
1952
- return zone;
1953
- }
1954
- var dependsOn = "etmerc";
1955
- function init$r() {
1956
- var zone = adjust_zone(this.zone, this.long0);
1957
- if (zone === void 0) {
1958
- throw new Error("unknown utm zone");
1959
- }
1960
- this.lat0 = 0;
1961
- this.long0 = (6 * Math.abs(zone) - 183) * D2R;
1962
- this.x0 = 5e5;
1963
- this.y0 = this.utmSouth ? 1e7 : 0;
1964
- this.k0 = 0.9996;
1965
- etmerc.init.apply(this);
1966
- this.forward = etmerc.forward;
1967
- this.inverse = etmerc.inverse;
1968
- }
1969
- var names$r = ["Universal Transverse Mercator System", "utm"];
1970
- var utm = {
1971
- init: init$r,
1972
- names: names$r,
1973
- dependsOn
1974
- };
1975
- function srat(esinp, exp) {
1976
- return Math.pow((1 - esinp) / (1 + esinp), exp);
1977
- }
1978
- var MAX_ITER$2 = 20;
1979
- function init$q() {
1980
- var sphi = Math.sin(this.lat0);
1981
- var cphi = Math.cos(this.lat0);
1982
- cphi *= cphi;
1983
- this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
1984
- this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
1985
- this.phic0 = Math.asin(sphi / this.C);
1986
- this.ratexp = 0.5 * this.C * this.e;
1987
- this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
1988
- }
1989
- function forward$q(p) {
1990
- var lon = p.x;
1991
- var lat = p.y;
1992
- p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
1993
- p.x = this.C * lon;
1994
- return p;
1995
- }
1996
- function inverse$q(p) {
1997
- var DEL_TOL = 1e-14;
1998
- var lon = p.x / this.C;
1999
- var lat = p.y;
2000
- var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
2001
- for (var i = MAX_ITER$2; i > 0; --i) {
2002
- lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), -0.5 * this.e)) - HALF_PI;
2003
- if (Math.abs(lat - p.y) < DEL_TOL) {
2004
- break;
2005
- }
2006
- p.y = lat;
2007
- }
2008
- if (!i) {
2009
- return null;
2010
- }
2011
- p.x = lon;
2012
- p.y = lat;
2013
- return p;
2014
- }
2015
- var names$q = ["gauss"];
2016
- var gauss = {
2017
- init: init$q,
2018
- forward: forward$q,
2019
- inverse: inverse$q,
2020
- names: names$q
2021
- };
2022
- function init$p() {
2023
- gauss.init.apply(this);
2024
- if (!this.rc) {
2025
- return;
2026
- }
2027
- this.sinc0 = Math.sin(this.phic0);
2028
- this.cosc0 = Math.cos(this.phic0);
2029
- this.R2 = 2 * this.rc;
2030
- if (!this.title) {
2031
- this.title = "Oblique Stereographic Alternative";
2032
- }
2033
- }
2034
- function forward$p(p) {
2035
- var sinc, cosc, cosl, k;
2036
- p.x = adjust_lon(p.x - this.long0);
2037
- gauss.forward.apply(this, [p]);
2038
- sinc = Math.sin(p.y);
2039
- cosc = Math.cos(p.y);
2040
- cosl = Math.cos(p.x);
2041
- k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
2042
- p.x = k * cosc * Math.sin(p.x);
2043
- p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
2044
- p.x = this.a * p.x + this.x0;
2045
- p.y = this.a * p.y + this.y0;
2046
- return p;
2047
- }
2048
- function inverse$p(p) {
2049
- var sinc, cosc, lon, lat, rho;
2050
- p.x = (p.x - this.x0) / this.a;
2051
- p.y = (p.y - this.y0) / this.a;
2052
- p.x /= this.k0;
2053
- p.y /= this.k0;
2054
- if (rho = Math.sqrt(p.x * p.x + p.y * p.y)) {
2055
- var c = 2 * Math.atan2(rho, this.R2);
2056
- sinc = Math.sin(c);
2057
- cosc = Math.cos(c);
2058
- lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
2059
- lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
2060
- } else {
2061
- lat = this.phic0;
2062
- lon = 0;
2063
- }
2064
- p.x = lon;
2065
- p.y = lat;
2066
- gauss.inverse.apply(this, [p]);
2067
- p.x = adjust_lon(p.x + this.long0);
2068
- return p;
2069
- }
2070
- var names$p = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea", "Oblique Stereographic Alternative", "Double_Stereographic"];
2071
- var sterea = {
2072
- init: init$p,
2073
- forward: forward$p,
2074
- inverse: inverse$p,
2075
- names: names$p
2076
- };
2077
- function ssfn_(phit, sinphi, eccen) {
2078
- sinphi *= eccen;
2079
- return Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen);
2080
- }
2081
- function init$o() {
2082
- this.coslat0 = Math.cos(this.lat0);
2083
- this.sinlat0 = Math.sin(this.lat0);
2084
- if (this.sphere) {
2085
- if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
2086
- this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
2087
- }
2088
- } else {
2089
- if (Math.abs(this.coslat0) <= EPSLN) {
2090
- if (this.lat0 > 0) {
2091
- this.con = 1;
2092
- } else {
2093
- this.con = -1;
2094
- }
2095
- }
2096
- this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
2097
- if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
2098
- this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
2099
- }
2100
- this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
2101
- this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
2102
- this.cosX0 = Math.cos(this.X0);
2103
- this.sinX0 = Math.sin(this.X0);
2104
- }
2105
- }
2106
- function forward$o(p) {
2107
- var lon = p.x;
2108
- var lat = p.y;
2109
- var sinlat = Math.sin(lat);
2110
- var coslat = Math.cos(lat);
2111
- var A, X, sinX, cosX, ts, rh;
2112
- var dlon = adjust_lon(lon - this.long0);
2113
- if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
2114
- p.x = NaN;
2115
- p.y = NaN;
2116
- return p;
2117
- }
2118
- if (this.sphere) {
2119
- A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
2120
- p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
2121
- p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
2122
- return p;
2123
- } else {
2124
- X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
2125
- cosX = Math.cos(X);
2126
- sinX = Math.sin(X);
2127
- if (Math.abs(this.coslat0) <= EPSLN) {
2128
- ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
2129
- rh = 2 * this.a * this.k0 * ts / this.cons;
2130
- p.x = this.x0 + rh * Math.sin(lon - this.long0);
2131
- p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
2132
- return p;
2133
- } else if (Math.abs(this.sinlat0) < EPSLN) {
2134
- A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
2135
- p.y = A * sinX;
2136
- } else {
2137
- A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
2138
- p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
2139
- }
2140
- p.x = A * cosX * Math.sin(dlon) + this.x0;
2141
- }
2142
- return p;
2143
- }
2144
- function inverse$o(p) {
2145
- p.x -= this.x0;
2146
- p.y -= this.y0;
2147
- var lon, lat, ts, ce, Chi;
2148
- var rh = Math.sqrt(p.x * p.x + p.y * p.y);
2149
- if (this.sphere) {
2150
- var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
2151
- lon = this.long0;
2152
- lat = this.lat0;
2153
- if (rh <= EPSLN) {
2154
- p.x = lon;
2155
- p.y = lat;
2156
- return p;
2157
- }
2158
- lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
2159
- if (Math.abs(this.coslat0) < EPSLN) {
2160
- if (this.lat0 > 0) {
2161
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));
2162
- } else {
2163
- lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
2164
- }
2165
- } else {
2166
- lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
2167
- }
2168
- p.x = lon;
2169
- p.y = lat;
2170
- return p;
2171
- } else {
2172
- if (Math.abs(this.coslat0) <= EPSLN) {
2173
- if (rh <= EPSLN) {
2174
- lat = this.lat0;
2175
- lon = this.long0;
2176
- p.x = lon;
2177
- p.y = lat;
2178
- return p;
2179
- }
2180
- p.x *= this.con;
2181
- p.y *= this.con;
2182
- ts = rh * this.cons / (2 * this.a * this.k0);
2183
- lat = this.con * phi2z(this.e, ts);
2184
- lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -1 * p.y));
2185
- } else {
2186
- ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
2187
- lon = this.long0;
2188
- if (rh <= EPSLN) {
2189
- Chi = this.X0;
2190
- } else {
2191
- Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
2192
- lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
2193
- }
2194
- lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
2195
- }
2196
- }
2197
- p.x = lon;
2198
- p.y = lat;
2199
- return p;
2200
- }
2201
- var names$o = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
2202
- var stere = {
2203
- init: init$o,
2204
- forward: forward$o,
2205
- inverse: inverse$o,
2206
- names: names$o,
2207
- ssfn_
2208
- };
2209
- function init$n() {
2210
- var phy0 = this.lat0;
2211
- this.lambda0 = this.long0;
2212
- var sinPhy0 = Math.sin(phy0);
2213
- var semiMajorAxis = this.a;
2214
- var invF = this.rf;
2215
- var flattening = 1 / invF;
2216
- var e2 = 2 * flattening - Math.pow(flattening, 2);
2217
- var e = this.e = Math.sqrt(e2);
2218
- this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
2219
- this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
2220
- this.b0 = Math.asin(sinPhy0 / this.alpha);
2221
- var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
2222
- var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
2223
- var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
2224
- this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
2225
- }
2226
- function forward$n(p) {
2227
- var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
2228
- var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
2229
- var S = -this.alpha * (Sa1 + Sa2) + this.K;
2230
- var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
2231
- var I = this.alpha * (p.x - this.lambda0);
2232
- var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
2233
- var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
2234
- p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
2235
- p.x = this.R * rotI + this.x0;
2236
- return p;
2237
- }
2238
- function inverse$n(p) {
2239
- var Y = p.x - this.x0;
2240
- var X = p.y - this.y0;
2241
- var rotI = Y / this.R;
2242
- var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
2243
- var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
2244
- var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
2245
- var lambda = this.lambda0 + I / this.alpha;
2246
- var S = 0;
2247
- var phy = b;
2248
- var prevPhy = -1e3;
2249
- var iteration = 0;
2250
- while (Math.abs(phy - prevPhy) > 1e-7) {
2251
- if (++iteration > 20) {
2252
- return;
2253
- }
2254
- S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
2255
- prevPhy = phy;
2256
- phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
2257
- }
2258
- p.x = lambda;
2259
- p.y = phy;
2260
- return p;
2261
- }
2262
- var names$n = ["somerc"];
2263
- var somerc = {
2264
- init: init$n,
2265
- forward: forward$n,
2266
- inverse: inverse$n,
2267
- names: names$n
2268
- };
2269
- var TOL = 1e-7;
2270
- function isTypeA(P) {
2271
- var typeAProjections = ["Hotine_Oblique_Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin"];
2272
- var projectionName = typeof P.PROJECTION === "object" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;
2273
- return "no_uoff" in P || "no_off" in P || typeAProjections.indexOf(projectionName) !== -1;
2274
- }
2275
- function init$m() {
2276
- var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0, gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;
2277
- this.no_off = isTypeA(this);
2278
- this.no_rot = "no_rot" in this;
2279
- var alp = false;
2280
- if ("alpha" in this) {
2281
- alp = true;
2282
- }
2283
- var gam = false;
2284
- if ("rectified_grid_angle" in this) {
2285
- gam = true;
2286
- }
2287
- if (alp) {
2288
- alpha_c = this.alpha;
2289
- }
2290
- if (gam) {
2291
- gamma = this.rectified_grid_angle * D2R;
2292
- }
2293
- if (alp || gam) {
2294
- lamc = this.longc;
2295
- } else {
2296
- lam1 = this.long1;
2297
- phi1 = this.lat1;
2298
- lam2 = this.long2;
2299
- phi2 = this.lat2;
2300
- if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL || Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL || Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {
2301
- throw new Error();
2302
- }
2303
- }
2304
- var one_es = 1 - this.es;
2305
- com = Math.sqrt(one_es);
2306
- if (Math.abs(this.lat0) > EPSLN) {
2307
- sinph0 = Math.sin(this.lat0);
2308
- cosph0 = Math.cos(this.lat0);
2309
- con = 1 - this.es * sinph0 * sinph0;
2310
- this.B = cosph0 * cosph0;
2311
- this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);
2312
- this.A = this.B * this.k0 * com / con;
2313
- D = this.B * com / (cosph0 * Math.sqrt(con));
2314
- F = D * D - 1;
2315
- if (F <= 0) {
2316
- F = 0;
2317
- } else {
2318
- F = Math.sqrt(F);
2319
- if (this.lat0 < 0) {
2320
- F = -F;
2321
- }
2322
- }
2323
- this.E = F += D;
2324
- this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);
2325
- } else {
2326
- this.B = 1 / com;
2327
- this.A = this.k0;
2328
- this.E = D = F = 1;
2329
- }
2330
- if (alp || gam) {
2331
- if (alp) {
2332
- gamma0 = Math.asin(Math.sin(alpha_c) / D);
2333
- if (!gam) {
2334
- gamma = alpha_c;
2335
- }
2336
- } else {
2337
- gamma0 = gamma;
2338
- alpha_c = Math.asin(D * Math.sin(gamma0));
2339
- }
2340
- this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;
2341
- } else {
2342
- H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);
2343
- L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);
2344
- F = this.E / H;
2345
- p = (L - H) / (L + H);
2346
- J = this.E * this.E;
2347
- J = (J - L * H) / (J + L * H);
2348
- con = lam1 - lam2;
2349
- if (con < -Math.pi) {
2350
- lam2 -= TWO_PI;
2351
- } else if (con > Math.pi) {
2352
- lam2 += TWO_PI;
2353
- }
2354
- this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);
2355
- gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));
2356
- gamma = alpha_c = Math.asin(D * Math.sin(gamma0));
2357
- }
2358
- this.singam = Math.sin(gamma0);
2359
- this.cosgam = Math.cos(gamma0);
2360
- this.sinrot = Math.sin(gamma);
2361
- this.cosrot = Math.cos(gamma);
2362
- this.rB = 1 / this.B;
2363
- this.ArB = this.A * this.rB;
2364
- this.BrA = 1 / this.ArB;
2365
- this.A * this.B;
2366
- if (this.no_off) {
2367
- this.u_0 = 0;
2368
- } else {
2369
- this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));
2370
- if (this.lat0 < 0) {
2371
- this.u_0 = -this.u_0;
2372
- }
2373
- }
2374
- F = 0.5 * gamma0;
2375
- this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));
2376
- this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));
2377
- }
2378
- function forward$m(p) {
2379
- var coords = {};
2380
- var S, T, U, V, W, temp, u, v;
2381
- p.x = p.x - this.lam0;
2382
- if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {
2383
- W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);
2384
- temp = 1 / W;
2385
- S = 0.5 * (W - temp);
2386
- T = 0.5 * (W + temp);
2387
- V = Math.sin(this.B * p.x);
2388
- U = (S * this.singam - V * this.cosgam) / T;
2389
- if (Math.abs(Math.abs(U) - 1) < EPSLN) {
2390
- throw new Error();
2391
- }
2392
- v = 0.5 * this.ArB * Math.log((1 - U) / (1 + U));
2393
- temp = Math.cos(this.B * p.x);
2394
- if (Math.abs(temp) < TOL) {
2395
- u = this.A * p.x;
2396
- } else {
2397
- u = this.ArB * Math.atan2(S * this.cosgam + V * this.singam, temp);
2398
- }
2399
- } else {
2400
- v = p.y > 0 ? this.v_pole_n : this.v_pole_s;
2401
- u = this.ArB * p.y;
2402
- }
2403
- if (this.no_rot) {
2404
- coords.x = u;
2405
- coords.y = v;
2406
- } else {
2407
- u -= this.u_0;
2408
- coords.x = v * this.cosrot + u * this.sinrot;
2409
- coords.y = u * this.cosrot - v * this.sinrot;
2410
- }
2411
- coords.x = this.a * coords.x + this.x0;
2412
- coords.y = this.a * coords.y + this.y0;
2413
- return coords;
2414
- }
2415
- function inverse$m(p) {
2416
- var u, v, Qp, Sp, Tp, Vp, Up;
2417
- var coords = {};
2418
- p.x = (p.x - this.x0) * (1 / this.a);
2419
- p.y = (p.y - this.y0) * (1 / this.a);
2420
- if (this.no_rot) {
2421
- v = p.y;
2422
- u = p.x;
2423
- } else {
2424
- v = p.x * this.cosrot - p.y * this.sinrot;
2425
- u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;
2426
- }
2427
- Qp = Math.exp(-this.BrA * v);
2428
- Sp = 0.5 * (Qp - 1 / Qp);
2429
- Tp = 0.5 * (Qp + 1 / Qp);
2430
- Vp = Math.sin(this.BrA * u);
2431
- Up = (Vp * this.cosgam + Sp * this.singam) / Tp;
2432
- if (Math.abs(Math.abs(Up) - 1) < EPSLN) {
2433
- coords.x = 0;
2434
- coords.y = Up < 0 ? -HALF_PI : HALF_PI;
2435
- } else {
2436
- coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));
2437
- coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));
2438
- if (coords.y === Infinity) {
2439
- throw new Error();
2440
- }
2441
- coords.x = -this.rB * Math.atan2(Sp * this.cosgam - Vp * this.singam, Math.cos(this.BrA * u));
2442
- }
2443
- coords.x += this.lam0;
2444
- return coords;
2445
- }
2446
- var names$m = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"];
2447
- var omerc = {
2448
- init: init$m,
2449
- forward: forward$m,
2450
- inverse: inverse$m,
2451
- names: names$m
2452
- };
2453
- function init$l() {
2454
- if (!this.lat2) {
2455
- this.lat2 = this.lat1;
2456
- }
2457
- if (!this.k0) {
2458
- this.k0 = 1;
2459
- }
2460
- this.x0 = this.x0 || 0;
2461
- this.y0 = this.y0 || 0;
2462
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
2463
- return;
2464
- }
2465
- var temp = this.b / this.a;
2466
- this.e = Math.sqrt(1 - temp * temp);
2467
- var sin1 = Math.sin(this.lat1);
2468
- var cos1 = Math.cos(this.lat1);
2469
- var ms1 = msfnz(this.e, sin1, cos1);
2470
- var ts1 = tsfnz(this.e, this.lat1, sin1);
2471
- var sin2 = Math.sin(this.lat2);
2472
- var cos2 = Math.cos(this.lat2);
2473
- var ms2 = msfnz(this.e, sin2, cos2);
2474
- var ts2 = tsfnz(this.e, this.lat2, sin2);
2475
- var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
2476
- if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
2477
- this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
2478
- } else {
2479
- this.ns = sin1;
2480
- }
2481
- if (isNaN(this.ns)) {
2482
- this.ns = sin1;
2483
- }
2484
- this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
2485
- this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
2486
- if (!this.title) {
2487
- this.title = "Lambert Conformal Conic";
2488
- }
2489
- }
2490
- function forward$l(p) {
2491
- var lon = p.x;
2492
- var lat = p.y;
2493
- if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
2494
- lat = sign(lat) * (HALF_PI - 2 * EPSLN);
2495
- }
2496
- var con = Math.abs(Math.abs(lat) - HALF_PI);
2497
- var ts, rh1;
2498
- if (con > EPSLN) {
2499
- ts = tsfnz(this.e, lat, Math.sin(lat));
2500
- rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
2501
- } else {
2502
- con = lat * this.ns;
2503
- if (con <= 0) {
2504
- return null;
2505
- }
2506
- rh1 = 0;
2507
- }
2508
- var theta = this.ns * adjust_lon(lon - this.long0);
2509
- p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
2510
- p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
2511
- return p;
2512
- }
2513
- function inverse$l(p) {
2514
- var rh1, con, ts;
2515
- var lat, lon;
2516
- var x = (p.x - this.x0) / this.k0;
2517
- var y = this.rh - (p.y - this.y0) / this.k0;
2518
- if (this.ns > 0) {
2519
- rh1 = Math.sqrt(x * x + y * y);
2520
- con = 1;
2521
- } else {
2522
- rh1 = -Math.sqrt(x * x + y * y);
2523
- con = -1;
2524
- }
2525
- var theta = 0;
2526
- if (rh1 !== 0) {
2527
- theta = Math.atan2(con * x, con * y);
2528
- }
2529
- if (rh1 !== 0 || this.ns > 0) {
2530
- con = 1 / this.ns;
2531
- ts = Math.pow(rh1 / (this.a * this.f0), con);
2532
- lat = phi2z(this.e, ts);
2533
- if (lat === -9999) {
2534
- return null;
2535
- }
2536
- } else {
2537
- lat = -HALF_PI;
2538
- }
2539
- lon = adjust_lon(theta / this.ns + this.long0);
2540
- p.x = lon;
2541
- p.y = lat;
2542
- return p;
2543
- }
2544
- var names$l = [
2545
- "Lambert Tangential Conformal Conic Projection",
2546
- "Lambert_Conformal_Conic",
2547
- "Lambert_Conformal_Conic_1SP",
2548
- "Lambert_Conformal_Conic_2SP",
2549
- "lcc",
2550
- "Lambert Conic Conformal (1SP)",
2551
- "Lambert Conic Conformal (2SP)"
2552
- ];
2553
- var lcc = {
2554
- init: init$l,
2555
- forward: forward$l,
2556
- inverse: inverse$l,
2557
- names: names$l
2558
- };
2559
- function init$k() {
2560
- this.a = 6377397155e-3;
2561
- this.es = 0.006674372230614;
2562
- this.e = Math.sqrt(this.es);
2563
- if (!this.lat0) {
2564
- this.lat0 = 0.863937979737193;
2565
- }
2566
- if (!this.long0) {
2567
- this.long0 = 0.7417649320975901 - 0.308341501185665;
2568
- }
2569
- if (!this.k0) {
2570
- this.k0 = 0.9999;
2571
- }
2572
- this.s45 = 0.785398163397448;
2573
- this.s90 = 2 * this.s45;
2574
- this.fi0 = this.lat0;
2575
- this.e2 = this.es;
2576
- this.e = Math.sqrt(this.e2);
2577
- this.alfa = Math.sqrt(1 + this.e2 * Math.pow(Math.cos(this.fi0), 4) / (1 - this.e2));
2578
- this.uq = 1.04216856380474;
2579
- this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
2580
- this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
2581
- this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
2582
- this.k1 = this.k0;
2583
- this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
2584
- this.s0 = 1.37008346281555;
2585
- this.n = Math.sin(this.s0);
2586
- this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
2587
- this.ad = this.s90 - this.uq;
2588
- }
2589
- function forward$k(p) {
2590
- var gfi, u, deltav, s, d, eps, ro;
2591
- var lon = p.x;
2592
- var lat = p.y;
2593
- var delta_lon = adjust_lon(lon - this.long0);
2594
- gfi = Math.pow((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat)), this.alfa * this.e / 2);
2595
- u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
2596
- deltav = -delta_lon * this.alfa;
2597
- s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
2598
- d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
2599
- eps = this.n * d;
2600
- ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
2601
- p.y = ro * Math.cos(eps) / 1;
2602
- p.x = ro * Math.sin(eps) / 1;
2603
- if (!this.czech) {
2604
- p.y *= -1;
2605
- p.x *= -1;
2606
- }
2607
- return p;
2608
- }
2609
- function inverse$k(p) {
2610
- var u, deltav, s, d, eps, ro, fi1;
2611
- var ok;
2612
- var tmp = p.x;
2613
- p.x = p.y;
2614
- p.y = tmp;
2615
- if (!this.czech) {
2616
- p.y *= -1;
2617
- p.x *= -1;
2618
- }
2619
- ro = Math.sqrt(p.x * p.x + p.y * p.y);
2620
- eps = Math.atan2(p.y, p.x);
2621
- d = eps / Math.sin(this.s0);
2622
- s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
2623
- u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
2624
- deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
2625
- p.x = this.long0 - deltav / this.alfa;
2626
- fi1 = u;
2627
- ok = 0;
2628
- var iter = 0;
2629
- do {
2630
- p.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
2631
- if (Math.abs(fi1 - p.y) < 1e-10) {
2632
- ok = 1;
2633
- }
2634
- fi1 = p.y;
2635
- iter += 1;
2636
- } while (ok === 0 && iter < 15);
2637
- if (iter >= 15) {
2638
- return null;
2639
- }
2640
- return p;
2641
- }
2642
- var names$k = ["Krovak", "krovak"];
2643
- var krovak = {
2644
- init: init$k,
2645
- forward: forward$k,
2646
- inverse: inverse$k,
2647
- names: names$k
2648
- };
2649
- function mlfn(e0, e1, e2, e3, phi) {
2650
- return e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi);
2651
- }
2652
- function e0fn(x) {
2653
- return 1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x));
2654
- }
2655
- function e1fn(x) {
2656
- return 0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x));
2657
- }
2658
- function e2fn(x) {
2659
- return 0.05859375 * x * x * (1 + 0.75 * x);
2660
- }
2661
- function e3fn(x) {
2662
- return x * x * x * (35 / 3072);
2663
- }
2664
- function gN(a, e, sinphi) {
2665
- var temp = e * sinphi;
2666
- return a / Math.sqrt(1 - temp * temp);
2667
- }
2668
- function adjust_lat(x) {
2669
- return Math.abs(x) < HALF_PI ? x : x - sign(x) * Math.PI;
2670
- }
2671
- function imlfn(ml, e0, e1, e2, e3) {
2672
- var phi;
2673
- var dphi;
2674
- phi = ml / e0;
2675
- for (var i = 0; i < 15; i++) {
2676
- dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
2677
- phi += dphi;
2678
- if (Math.abs(dphi) <= 1e-10) {
2679
- return phi;
2680
- }
2681
- }
2682
- return NaN;
2683
- }
2684
- function init$j() {
2685
- if (!this.sphere) {
2686
- this.e0 = e0fn(this.es);
2687
- this.e1 = e1fn(this.es);
2688
- this.e2 = e2fn(this.es);
2689
- this.e3 = e3fn(this.es);
2690
- this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
2691
- }
2692
- }
2693
- function forward$j(p) {
2694
- var x, y;
2695
- var lam = p.x;
2696
- var phi = p.y;
2697
- lam = adjust_lon(lam - this.long0);
2698
- if (this.sphere) {
2699
- x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
2700
- y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
2701
- } else {
2702
- var sinphi = Math.sin(phi);
2703
- var cosphi = Math.cos(phi);
2704
- var nl = gN(this.a, this.e, sinphi);
2705
- var tl = Math.tan(phi) * Math.tan(phi);
2706
- var al = lam * Math.cos(phi);
2707
- var asq = al * al;
2708
- var cl = this.es * cosphi * cosphi / (1 - this.es);
2709
- var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
2710
- x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
2711
- y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
2712
- }
2713
- p.x = x + this.x0;
2714
- p.y = y + this.y0;
2715
- return p;
2716
- }
2717
- function inverse$j(p) {
2718
- p.x -= this.x0;
2719
- p.y -= this.y0;
2720
- var x = p.x / this.a;
2721
- var y = p.y / this.a;
2722
- var phi, lam;
2723
- if (this.sphere) {
2724
- var dd = y + this.lat0;
2725
- phi = Math.asin(Math.sin(dd) * Math.cos(x));
2726
- lam = Math.atan2(Math.tan(x), Math.cos(dd));
2727
- } else {
2728
- var ml1 = this.ml0 / this.a + y;
2729
- var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
2730
- if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
2731
- p.x = this.long0;
2732
- p.y = HALF_PI;
2733
- if (y < 0) {
2734
- p.y *= -1;
2735
- }
2736
- return p;
2737
- }
2738
- var nl1 = gN(this.a, this.e, Math.sin(phi1));
2739
- var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
2740
- var tl1 = Math.pow(Math.tan(phi1), 2);
2741
- var dl = x * this.a / nl1;
2742
- var dsq = dl * dl;
2743
- phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
2744
- lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
2745
- }
2746
- p.x = adjust_lon(lam + this.long0);
2747
- p.y = adjust_lat(phi);
2748
- return p;
2749
- }
2750
- var names$j = ["Cassini", "Cassini_Soldner", "cass"];
2751
- var cass = {
2752
- init: init$j,
2753
- forward: forward$j,
2754
- inverse: inverse$j,
2755
- names: names$j
2756
- };
2757
- function qsfnz(eccent, sinphi) {
2758
- var con;
2759
- if (eccent > 1e-7) {
2760
- con = eccent * sinphi;
2761
- return (1 - eccent * eccent) * (sinphi / (1 - con * con) - 0.5 / eccent * Math.log((1 - con) / (1 + con)));
2762
- } else {
2763
- return 2 * sinphi;
2764
- }
2765
- }
2766
- var S_POLE = 1;
2767
- var N_POLE = 2;
2768
- var EQUIT = 3;
2769
- var OBLIQ = 4;
2770
- function init$i() {
2771
- var t = Math.abs(this.lat0);
2772
- if (Math.abs(t - HALF_PI) < EPSLN) {
2773
- this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
2774
- } else if (Math.abs(t) < EPSLN) {
2775
- this.mode = this.EQUIT;
2776
- } else {
2777
- this.mode = this.OBLIQ;
2778
- }
2779
- if (this.es > 0) {
2780
- var sinphi;
2781
- this.qp = qsfnz(this.e, 1);
2782
- this.mmf = 0.5 / (1 - this.es);
2783
- this.apa = authset(this.es);
2784
- switch (this.mode) {
2785
- case this.N_POLE:
2786
- this.dd = 1;
2787
- break;
2788
- case this.S_POLE:
2789
- this.dd = 1;
2790
- break;
2791
- case this.EQUIT:
2792
- this.rq = Math.sqrt(0.5 * this.qp);
2793
- this.dd = 1 / this.rq;
2794
- this.xmf = 1;
2795
- this.ymf = 0.5 * this.qp;
2796
- break;
2797
- case this.OBLIQ:
2798
- this.rq = Math.sqrt(0.5 * this.qp);
2799
- sinphi = Math.sin(this.lat0);
2800
- this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
2801
- this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
2802
- this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
2803
- this.ymf = (this.xmf = this.rq) / this.dd;
2804
- this.xmf *= this.dd;
2805
- break;
2806
- }
2807
- } else {
2808
- if (this.mode === this.OBLIQ) {
2809
- this.sinph0 = Math.sin(this.lat0);
2810
- this.cosph0 = Math.cos(this.lat0);
2811
- }
2812
- }
2813
- }
2814
- function forward$i(p) {
2815
- var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
2816
- var lam = p.x;
2817
- var phi = p.y;
2818
- lam = adjust_lon(lam - this.long0);
2819
- if (this.sphere) {
2820
- sinphi = Math.sin(phi);
2821
- cosphi = Math.cos(phi);
2822
- coslam = Math.cos(lam);
2823
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2824
- y = this.mode === this.EQUIT ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
2825
- if (y <= EPSLN) {
2826
- return null;
2827
- }
2828
- y = Math.sqrt(2 / y);
2829
- x = y * cosphi * Math.sin(lam);
2830
- y *= this.mode === this.EQUIT ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
2831
- } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2832
- if (this.mode === this.N_POLE) {
2833
- coslam = -coslam;
2834
- }
2835
- if (Math.abs(phi + this.lat0) < EPSLN) {
2836
- return null;
2837
- }
2838
- y = FORTPI - phi * 0.5;
2839
- y = 2 * (this.mode === this.S_POLE ? Math.cos(y) : Math.sin(y));
2840
- x = y * Math.sin(lam);
2841
- y *= coslam;
2842
- }
2843
- } else {
2844
- sinb = 0;
2845
- cosb = 0;
2846
- b = 0;
2847
- coslam = Math.cos(lam);
2848
- sinlam = Math.sin(lam);
2849
- sinphi = Math.sin(phi);
2850
- q = qsfnz(this.e, sinphi);
2851
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2852
- sinb = q / this.qp;
2853
- cosb = Math.sqrt(1 - sinb * sinb);
2854
- }
2855
- switch (this.mode) {
2856
- case this.OBLIQ:
2857
- b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
2858
- break;
2859
- case this.EQUIT:
2860
- b = 1 + cosb * coslam;
2861
- break;
2862
- case this.N_POLE:
2863
- b = HALF_PI + phi;
2864
- q = this.qp - q;
2865
- break;
2866
- case this.S_POLE:
2867
- b = phi - HALF_PI;
2868
- q = this.qp + q;
2869
- break;
2870
- }
2871
- if (Math.abs(b) < EPSLN) {
2872
- return null;
2873
- }
2874
- switch (this.mode) {
2875
- case this.OBLIQ:
2876
- case this.EQUIT:
2877
- b = Math.sqrt(2 / b);
2878
- if (this.mode === this.OBLIQ) {
2879
- y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
2880
- } else {
2881
- y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
2882
- }
2883
- x = this.xmf * b * cosb * sinlam;
2884
- break;
2885
- case this.N_POLE:
2886
- case this.S_POLE:
2887
- if (q >= 0) {
2888
- x = (b = Math.sqrt(q)) * sinlam;
2889
- y = coslam * (this.mode === this.S_POLE ? b : -b);
2890
- } else {
2891
- x = y = 0;
2892
- }
2893
- break;
2894
- }
2895
- }
2896
- p.x = this.a * x + this.x0;
2897
- p.y = this.a * y + this.y0;
2898
- return p;
2899
- }
2900
- function inverse$i(p) {
2901
- p.x -= this.x0;
2902
- p.y -= this.y0;
2903
- var x = p.x / this.a;
2904
- var y = p.y / this.a;
2905
- var lam, phi, cCe, sCe, q, rho, ab;
2906
- if (this.sphere) {
2907
- var cosz = 0, rh, sinz = 0;
2908
- rh = Math.sqrt(x * x + y * y);
2909
- phi = rh * 0.5;
2910
- if (phi > 1) {
2911
- return null;
2912
- }
2913
- phi = 2 * Math.asin(phi);
2914
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2915
- sinz = Math.sin(phi);
2916
- cosz = Math.cos(phi);
2917
- }
2918
- switch (this.mode) {
2919
- case this.EQUIT:
2920
- phi = Math.abs(rh) <= EPSLN ? 0 : Math.asin(y * sinz / rh);
2921
- x *= sinz;
2922
- y = cosz * rh;
2923
- break;
2924
- case this.OBLIQ:
2925
- phi = Math.abs(rh) <= EPSLN ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
2926
- x *= sinz * this.cosph0;
2927
- y = (cosz - Math.sin(phi) * this.sinph0) * rh;
2928
- break;
2929
- case this.N_POLE:
2930
- y = -y;
2931
- phi = HALF_PI - phi;
2932
- break;
2933
- case this.S_POLE:
2934
- phi -= HALF_PI;
2935
- break;
2936
- }
2937
- lam = y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : Math.atan2(x, y);
2938
- } else {
2939
- ab = 0;
2940
- if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2941
- x /= this.dd;
2942
- y *= this.dd;
2943
- rho = Math.sqrt(x * x + y * y);
2944
- if (rho < EPSLN) {
2945
- p.x = this.long0;
2946
- p.y = this.lat0;
2947
- return p;
2948
- }
2949
- sCe = 2 * Math.asin(0.5 * rho / this.rq);
2950
- cCe = Math.cos(sCe);
2951
- x *= sCe = Math.sin(sCe);
2952
- if (this.mode === this.OBLIQ) {
2953
- ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
2954
- q = this.qp * ab;
2955
- y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
2956
- } else {
2957
- ab = y * sCe / rho;
2958
- q = this.qp * ab;
2959
- y = rho * cCe;
2960
- }
2961
- } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2962
- if (this.mode === this.N_POLE) {
2963
- y = -y;
2964
- }
2965
- q = x * x + y * y;
2966
- if (!q) {
2967
- p.x = this.long0;
2968
- p.y = this.lat0;
2969
- return p;
2970
- }
2971
- ab = 1 - q / this.qp;
2972
- if (this.mode === this.S_POLE) {
2973
- ab = -ab;
2974
- }
2975
- }
2976
- lam = Math.atan2(x, y);
2977
- phi = authlat(Math.asin(ab), this.apa);
2978
- }
2979
- p.x = adjust_lon(this.long0 + lam);
2980
- p.y = phi;
2981
- return p;
2982
- }
2983
- var P00 = 0.3333333333333333;
2984
- var P01 = 0.17222222222222222;
2985
- var P02 = 0.10257936507936508;
2986
- var P10 = 0.06388888888888888;
2987
- var P11 = 0.0664021164021164;
2988
- var P20 = 0.016415012942191543;
2989
- function authset(es) {
2990
- var t;
2991
- var APA = [];
2992
- APA[0] = es * P00;
2993
- t = es * es;
2994
- APA[0] += t * P01;
2995
- APA[1] = t * P10;
2996
- t *= es;
2997
- APA[0] += t * P02;
2998
- APA[1] += t * P11;
2999
- APA[2] = t * P20;
3000
- return APA;
3001
- }
3002
- function authlat(beta, APA) {
3003
- var t = beta + beta;
3004
- return beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t);
3005
- }
3006
- var names$i = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
3007
- var laea = {
3008
- init: init$i,
3009
- forward: forward$i,
3010
- inverse: inverse$i,
3011
- names: names$i,
3012
- S_POLE,
3013
- N_POLE,
3014
- EQUIT,
3015
- OBLIQ
3016
- };
3017
- function asinz(x) {
3018
- if (Math.abs(x) > 1) {
3019
- x = x > 1 ? 1 : -1;
3020
- }
3021
- return Math.asin(x);
3022
- }
3023
- function init$h() {
3024
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
3025
- return;
3026
- }
3027
- this.temp = this.b / this.a;
3028
- this.es = 1 - Math.pow(this.temp, 2);
3029
- this.e3 = Math.sqrt(this.es);
3030
- this.sin_po = Math.sin(this.lat1);
3031
- this.cos_po = Math.cos(this.lat1);
3032
- this.t1 = this.sin_po;
3033
- this.con = this.sin_po;
3034
- this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
3035
- this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
3036
- this.sin_po = Math.sin(this.lat2);
3037
- this.cos_po = Math.cos(this.lat2);
3038
- this.t2 = this.sin_po;
3039
- this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
3040
- this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
3041
- this.sin_po = Math.sin(this.lat0);
3042
- this.cos_po = Math.cos(this.lat0);
3043
- this.t3 = this.sin_po;
3044
- this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
3045
- if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
3046
- this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
3047
- } else {
3048
- this.ns0 = this.con;
3049
- }
3050
- this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
3051
- this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
3052
- }
3053
- function forward$h(p) {
3054
- var lon = p.x;
3055
- var lat = p.y;
3056
- this.sin_phi = Math.sin(lat);
3057
- this.cos_phi = Math.cos(lat);
3058
- var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
3059
- var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
3060
- var theta = this.ns0 * adjust_lon(lon - this.long0);
3061
- var x = rh1 * Math.sin(theta) + this.x0;
3062
- var y = this.rh - rh1 * Math.cos(theta) + this.y0;
3063
- p.x = x;
3064
- p.y = y;
3065
- return p;
3066
- }
3067
- function inverse$h(p) {
3068
- var rh1, qs, con, theta, lon, lat;
3069
- p.x -= this.x0;
3070
- p.y = this.rh - p.y + this.y0;
3071
- if (this.ns0 >= 0) {
3072
- rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
3073
- con = 1;
3074
- } else {
3075
- rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
3076
- con = -1;
3077
- }
3078
- theta = 0;
3079
- if (rh1 !== 0) {
3080
- theta = Math.atan2(con * p.x, con * p.y);
3081
- }
3082
- con = rh1 * this.ns0 / this.a;
3083
- if (this.sphere) {
3084
- lat = Math.asin((this.c - con * con) / (2 * this.ns0));
3085
- } else {
3086
- qs = (this.c - con * con) / this.ns0;
3087
- lat = this.phi1z(this.e3, qs);
3088
- }
3089
- lon = adjust_lon(theta / this.ns0 + this.long0);
3090
- p.x = lon;
3091
- p.y = lat;
3092
- return p;
3093
- }
3094
- function phi1z(eccent, qs) {
3095
- var sinphi, cosphi, con, com, dphi;
3096
- var phi = asinz(0.5 * qs);
3097
- if (eccent < EPSLN) {
3098
- return phi;
3099
- }
3100
- var eccnts = eccent * eccent;
3101
- for (var i = 1; i <= 25; i++) {
3102
- sinphi = Math.sin(phi);
3103
- cosphi = Math.cos(phi);
3104
- con = eccent * sinphi;
3105
- com = 1 - con * con;
3106
- dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
3107
- phi = phi + dphi;
3108
- if (Math.abs(dphi) <= 1e-7) {
3109
- return phi;
3110
- }
3111
- }
3112
- return null;
3113
- }
3114
- var names$h = ["Albers_Conic_Equal_Area", "Albers", "aea"];
3115
- var aea = {
3116
- init: init$h,
3117
- forward: forward$h,
3118
- inverse: inverse$h,
3119
- names: names$h,
3120
- phi1z
3121
- };
3122
- function init$g() {
3123
- this.sin_p14 = Math.sin(this.lat0);
3124
- this.cos_p14 = Math.cos(this.lat0);
3125
- this.infinity_dist = 1e3 * this.a;
3126
- this.rc = 1;
3127
- }
3128
- function forward$g(p) {
3129
- var sinphi, cosphi;
3130
- var dlon;
3131
- var coslon;
3132
- var ksp;
3133
- var g;
3134
- var x, y;
3135
- var lon = p.x;
3136
- var lat = p.y;
3137
- dlon = adjust_lon(lon - this.long0);
3138
- sinphi = Math.sin(lat);
3139
- cosphi = Math.cos(lat);
3140
- coslon = Math.cos(dlon);
3141
- g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
3142
- ksp = 1;
3143
- if (g > 0 || Math.abs(g) <= EPSLN) {
3144
- x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
3145
- y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
3146
- } else {
3147
- x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
3148
- y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
3149
- }
3150
- p.x = x;
3151
- p.y = y;
3152
- return p;
3153
- }
3154
- function inverse$g(p) {
3155
- var rh;
3156
- var sinc, cosc;
3157
- var c;
3158
- var lon, lat;
3159
- p.x = (p.x - this.x0) / this.a;
3160
- p.y = (p.y - this.y0) / this.a;
3161
- p.x /= this.k0;
3162
- p.y /= this.k0;
3163
- if (rh = Math.sqrt(p.x * p.x + p.y * p.y)) {
3164
- c = Math.atan2(rh, this.rc);
3165
- sinc = Math.sin(c);
3166
- cosc = Math.cos(c);
3167
- lat = asinz(cosc * this.sin_p14 + p.y * sinc * this.cos_p14 / rh);
3168
- lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
3169
- lon = adjust_lon(this.long0 + lon);
3170
- } else {
3171
- lat = this.phic0;
3172
- lon = 0;
3173
- }
3174
- p.x = lon;
3175
- p.y = lat;
3176
- return p;
3177
- }
3178
- var names$g = ["gnom"];
3179
- var gnom = {
3180
- init: init$g,
3181
- forward: forward$g,
3182
- inverse: inverse$g,
3183
- names: names$g
3184
- };
3185
- function iqsfnz(eccent, q) {
3186
- var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
3187
- if (Math.abs(Math.abs(q) - temp) < 1e-6) {
3188
- if (q < 0) {
3189
- return -1 * HALF_PI;
3190
- } else {
3191
- return HALF_PI;
3192
- }
3193
- }
3194
- var phi = Math.asin(0.5 * q);
3195
- var dphi;
3196
- var sin_phi;
3197
- var cos_phi;
3198
- var con;
3199
- for (var i = 0; i < 30; i++) {
3200
- sin_phi = Math.sin(phi);
3201
- cos_phi = Math.cos(phi);
3202
- con = eccent * sin_phi;
3203
- dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
3204
- phi += dphi;
3205
- if (Math.abs(dphi) <= 1e-10) {
3206
- return phi;
3207
- }
3208
- }
3209
- return NaN;
3210
- }
3211
- function init$f() {
3212
- if (!this.sphere) {
3213
- this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
3214
- }
3215
- }
3216
- function forward$f(p) {
3217
- var lon = p.x;
3218
- var lat = p.y;
3219
- var x, y;
3220
- var dlon = adjust_lon(lon - this.long0);
3221
- if (this.sphere) {
3222
- x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
3223
- y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
3224
- } else {
3225
- var qs = qsfnz(this.e, Math.sin(lat));
3226
- x = this.x0 + this.a * this.k0 * dlon;
3227
- y = this.y0 + this.a * qs * 0.5 / this.k0;
3228
- }
3229
- p.x = x;
3230
- p.y = y;
3231
- return p;
3232
- }
3233
- function inverse$f(p) {
3234
- p.x -= this.x0;
3235
- p.y -= this.y0;
3236
- var lon, lat;
3237
- if (this.sphere) {
3238
- lon = adjust_lon(this.long0 + p.x / this.a / Math.cos(this.lat_ts));
3239
- lat = Math.asin(p.y / this.a * Math.cos(this.lat_ts));
3240
- } else {
3241
- lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
3242
- lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
3243
- }
3244
- p.x = lon;
3245
- p.y = lat;
3246
- return p;
3247
- }
3248
- var names$f = ["cea"];
3249
- var cea = {
3250
- init: init$f,
3251
- forward: forward$f,
3252
- inverse: inverse$f,
3253
- names: names$f
3254
- };
3255
- function init$e() {
3256
- this.x0 = this.x0 || 0;
3257
- this.y0 = this.y0 || 0;
3258
- this.lat0 = this.lat0 || 0;
3259
- this.long0 = this.long0 || 0;
3260
- this.lat_ts = this.lat_ts || 0;
3261
- this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
3262
- this.rc = Math.cos(this.lat_ts);
3263
- }
3264
- function forward$e(p) {
3265
- var lon = p.x;
3266
- var lat = p.y;
3267
- var dlon = adjust_lon(lon - this.long0);
3268
- var dlat = adjust_lat(lat - this.lat0);
3269
- p.x = this.x0 + this.a * dlon * this.rc;
3270
- p.y = this.y0 + this.a * dlat;
3271
- return p;
3272
- }
3273
- function inverse$e(p) {
3274
- var x = p.x;
3275
- var y = p.y;
3276
- p.x = adjust_lon(this.long0 + (x - this.x0) / (this.a * this.rc));
3277
- p.y = adjust_lat(this.lat0 + (y - this.y0) / this.a);
3278
- return p;
3279
- }
3280
- var names$e = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
3281
- var eqc = {
3282
- init: init$e,
3283
- forward: forward$e,
3284
- inverse: inverse$e,
3285
- names: names$e
3286
- };
3287
- var MAX_ITER$1 = 20;
3288
- function init$d() {
3289
- this.temp = this.b / this.a;
3290
- this.es = 1 - Math.pow(this.temp, 2);
3291
- this.e = Math.sqrt(this.es);
3292
- this.e0 = e0fn(this.es);
3293
- this.e1 = e1fn(this.es);
3294
- this.e2 = e2fn(this.es);
3295
- this.e3 = e3fn(this.es);
3296
- this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
3297
- }
3298
- function forward$d(p) {
3299
- var lon = p.x;
3300
- var lat = p.y;
3301
- var x, y, el;
3302
- var dlon = adjust_lon(lon - this.long0);
3303
- el = dlon * Math.sin(lat);
3304
- if (this.sphere) {
3305
- if (Math.abs(lat) <= EPSLN) {
3306
- x = this.a * dlon;
3307
- y = -1 * this.a * this.lat0;
3308
- } else {
3309
- x = this.a * Math.sin(el) / Math.tan(lat);
3310
- y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
3311
- }
3312
- } else {
3313
- if (Math.abs(lat) <= EPSLN) {
3314
- x = this.a * dlon;
3315
- y = -1 * this.ml0;
3316
- } else {
3317
- var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
3318
- x = nl * Math.sin(el);
3319
- y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
3320
- }
3321
- }
3322
- p.x = x + this.x0;
3323
- p.y = y + this.y0;
3324
- return p;
3325
- }
3326
- function inverse$d(p) {
3327
- var lon, lat, x, y, i;
3328
- var al, bl;
3329
- var phi, dphi;
3330
- x = p.x - this.x0;
3331
- y = p.y - this.y0;
3332
- if (this.sphere) {
3333
- if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
3334
- lon = adjust_lon(x / this.a + this.long0);
3335
- lat = 0;
3336
- } else {
3337
- al = this.lat0 + y / this.a;
3338
- bl = x * x / this.a / this.a + al * al;
3339
- phi = al;
3340
- var tanphi;
3341
- for (i = MAX_ITER$1; i; --i) {
3342
- tanphi = Math.tan(phi);
3343
- dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
3344
- phi += dphi;
3345
- if (Math.abs(dphi) <= EPSLN) {
3346
- lat = phi;
3347
- break;
3348
- }
3349
- }
3350
- lon = adjust_lon(this.long0 + Math.asin(x * Math.tan(phi) / this.a) / Math.sin(lat));
3351
- }
3352
- } else {
3353
- if (Math.abs(y + this.ml0) <= EPSLN) {
3354
- lat = 0;
3355
- lon = adjust_lon(this.long0 + x / this.a);
3356
- } else {
3357
- al = (this.ml0 + y) / this.a;
3358
- bl = x * x / this.a / this.a + al * al;
3359
- phi = al;
3360
- var cl, mln, mlnp, ma;
3361
- var con;
3362
- for (i = MAX_ITER$1; i; --i) {
3363
- con = this.e * Math.sin(phi);
3364
- cl = Math.sqrt(1 - con * con) * Math.tan(phi);
3365
- mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
3366
- mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
3367
- ma = mln / this.a;
3368
- dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
3369
- phi -= dphi;
3370
- if (Math.abs(dphi) <= EPSLN) {
3371
- lat = phi;
3372
- break;
3373
- }
3374
- }
3375
- cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
3376
- lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
3377
- }
3378
- }
3379
- p.x = lon;
3380
- p.y = lat;
3381
- return p;
3382
- }
3383
- var names$d = ["Polyconic", "poly"];
3384
- var poly = {
3385
- init: init$d,
3386
- forward: forward$d,
3387
- inverse: inverse$d,
3388
- names: names$d
3389
- };
3390
- function init$c() {
3391
- this.A = [];
3392
- this.A[1] = 0.6399175073;
3393
- this.A[2] = -0.1358797613;
3394
- this.A[3] = 0.063294409;
3395
- this.A[4] = -0.02526853;
3396
- this.A[5] = 0.0117879;
3397
- this.A[6] = -55161e-7;
3398
- this.A[7] = 26906e-7;
3399
- this.A[8] = -1333e-6;
3400
- this.A[9] = 67e-5;
3401
- this.A[10] = -34e-5;
3402
- this.B_re = [];
3403
- this.B_im = [];
3404
- this.B_re[1] = 0.7557853228;
3405
- this.B_im[1] = 0;
3406
- this.B_re[2] = 0.249204646;
3407
- this.B_im[2] = 3371507e-9;
3408
- this.B_re[3] = -1541739e-9;
3409
- this.B_im[3] = 0.04105856;
3410
- this.B_re[4] = -0.10162907;
3411
- this.B_im[4] = 0.01727609;
3412
- this.B_re[5] = -0.26623489;
3413
- this.B_im[5] = -0.36249218;
3414
- this.B_re[6] = -0.6870983;
3415
- this.B_im[6] = -1.1651967;
3416
- this.C_re = [];
3417
- this.C_im = [];
3418
- this.C_re[1] = 1.3231270439;
3419
- this.C_im[1] = 0;
3420
- this.C_re[2] = -0.577245789;
3421
- this.C_im[2] = -7809598e-9;
3422
- this.C_re[3] = 0.508307513;
3423
- this.C_im[3] = -0.112208952;
3424
- this.C_re[4] = -0.15094762;
3425
- this.C_im[4] = 0.18200602;
3426
- this.C_re[5] = 1.01418179;
3427
- this.C_im[5] = 1.64497696;
3428
- this.C_re[6] = 1.9660549;
3429
- this.C_im[6] = 2.5127645;
3430
- this.D = [];
3431
- this.D[1] = 1.5627014243;
3432
- this.D[2] = 0.5185406398;
3433
- this.D[3] = -0.03333098;
3434
- this.D[4] = -0.1052906;
3435
- this.D[5] = -0.0368594;
3436
- this.D[6] = 7317e-6;
3437
- this.D[7] = 0.0122;
3438
- this.D[8] = 394e-5;
3439
- this.D[9] = -13e-4;
3440
- }
3441
- function forward$c(p) {
3442
- var n;
3443
- var lon = p.x;
3444
- var lat = p.y;
3445
- var delta_lat = lat - this.lat0;
3446
- var delta_lon = lon - this.long0;
3447
- var d_phi = delta_lat / SEC_TO_RAD * 1e-5;
3448
- var d_lambda = delta_lon;
3449
- var d_phi_n = 1;
3450
- var d_psi = 0;
3451
- for (n = 1; n <= 10; n++) {
3452
- d_phi_n = d_phi_n * d_phi;
3453
- d_psi = d_psi + this.A[n] * d_phi_n;
3454
- }
3455
- var th_re = d_psi;
3456
- var th_im = d_lambda;
3457
- var th_n_re = 1;
3458
- var th_n_im = 0;
3459
- var th_n_re1;
3460
- var th_n_im1;
3461
- var z_re = 0;
3462
- var z_im = 0;
3463
- for (n = 1; n <= 6; n++) {
3464
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
3465
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
3466
- th_n_re = th_n_re1;
3467
- th_n_im = th_n_im1;
3468
- z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
3469
- z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
3470
- }
3471
- p.x = z_im * this.a + this.x0;
3472
- p.y = z_re * this.a + this.y0;
3473
- return p;
3474
- }
3475
- function inverse$c(p) {
3476
- var n;
3477
- var x = p.x;
3478
- var y = p.y;
3479
- var delta_x = x - this.x0;
3480
- var delta_y = y - this.y0;
3481
- var z_re = delta_y / this.a;
3482
- var z_im = delta_x / this.a;
3483
- var z_n_re = 1;
3484
- var z_n_im = 0;
3485
- var z_n_re1;
3486
- var z_n_im1;
3487
- var th_re = 0;
3488
- var th_im = 0;
3489
- for (n = 1; n <= 6; n++) {
3490
- z_n_re1 = z_n_re * z_re - z_n_im * z_im;
3491
- z_n_im1 = z_n_im * z_re + z_n_re * z_im;
3492
- z_n_re = z_n_re1;
3493
- z_n_im = z_n_im1;
3494
- th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
3495
- th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
3496
- }
3497
- for (var i = 0; i < this.iterations; i++) {
3498
- var th_n_re = th_re;
3499
- var th_n_im = th_im;
3500
- var th_n_re1;
3501
- var th_n_im1;
3502
- var num_re = z_re;
3503
- var num_im = z_im;
3504
- for (n = 2; n <= 6; n++) {
3505
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
3506
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
3507
- th_n_re = th_n_re1;
3508
- th_n_im = th_n_im1;
3509
- num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
3510
- num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
3511
- }
3512
- th_n_re = 1;
3513
- th_n_im = 0;
3514
- var den_re = this.B_re[1];
3515
- var den_im = this.B_im[1];
3516
- for (n = 2; n <= 6; n++) {
3517
- th_n_re1 = th_n_re * th_re - th_n_im * th_im;
3518
- th_n_im1 = th_n_im * th_re + th_n_re * th_im;
3519
- th_n_re = th_n_re1;
3520
- th_n_im = th_n_im1;
3521
- den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
3522
- den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
3523
- }
3524
- var den2 = den_re * den_re + den_im * den_im;
3525
- th_re = (num_re * den_re + num_im * den_im) / den2;
3526
- th_im = (num_im * den_re - num_re * den_im) / den2;
3527
- }
3528
- var d_psi = th_re;
3529
- var d_lambda = th_im;
3530
- var d_psi_n = 1;
3531
- var d_phi = 0;
3532
- for (n = 1; n <= 9; n++) {
3533
- d_psi_n = d_psi_n * d_psi;
3534
- d_phi = d_phi + this.D[n] * d_psi_n;
3535
- }
3536
- var lat = this.lat0 + d_phi * SEC_TO_RAD * 1e5;
3537
- var lon = this.long0 + d_lambda;
3538
- p.x = lon;
3539
- p.y = lat;
3540
- return p;
3541
- }
3542
- var names$c = ["New_Zealand_Map_Grid", "nzmg"];
3543
- var nzmg = {
3544
- init: init$c,
3545
- forward: forward$c,
3546
- inverse: inverse$c,
3547
- names: names$c
3548
- };
3549
- function init$b() {
3550
- }
3551
- function forward$b(p) {
3552
- var lon = p.x;
3553
- var lat = p.y;
3554
- var dlon = adjust_lon(lon - this.long0);
3555
- var x = this.x0 + this.a * dlon;
3556
- var y = this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + lat / 2.5)) * 1.25;
3557
- p.x = x;
3558
- p.y = y;
3559
- return p;
3560
- }
3561
- function inverse$b(p) {
3562
- p.x -= this.x0;
3563
- p.y -= this.y0;
3564
- var lon = adjust_lon(this.long0 + p.x / this.a);
3565
- var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
3566
- p.x = lon;
3567
- p.y = lat;
3568
- return p;
3569
- }
3570
- var names$b = ["Miller_Cylindrical", "mill"];
3571
- var mill = {
3572
- init: init$b,
3573
- forward: forward$b,
3574
- inverse: inverse$b,
3575
- names: names$b
3576
- };
3577
- var MAX_ITER = 20;
3578
- function init$a() {
3579
- if (!this.sphere) {
3580
- this.en = pj_enfn(this.es);
3581
- } else {
3582
- this.n = 1;
3583
- this.m = 0;
3584
- this.es = 0;
3585
- this.C_y = Math.sqrt((this.m + 1) / this.n);
3586
- this.C_x = this.C_y / (this.m + 1);
3587
- }
3588
- }
3589
- function forward$a(p) {
3590
- var x, y;
3591
- var lon = p.x;
3592
- var lat = p.y;
3593
- lon = adjust_lon(lon - this.long0);
3594
- if (this.sphere) {
3595
- if (!this.m) {
3596
- lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
3597
- } else {
3598
- var k = this.n * Math.sin(lat);
3599
- for (var i = MAX_ITER; i; --i) {
3600
- var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
3601
- lat -= V;
3602
- if (Math.abs(V) < EPSLN) {
3603
- break;
3604
- }
3605
- }
3606
- }
3607
- x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
3608
- y = this.a * this.C_y * lat;
3609
- } else {
3610
- var s = Math.sin(lat);
3611
- var c = Math.cos(lat);
3612
- y = this.a * pj_mlfn(lat, s, c, this.en);
3613
- x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
3614
- }
3615
- p.x = x;
3616
- p.y = y;
3617
- return p;
3618
- }
3619
- function inverse$a(p) {
3620
- var lat, temp, lon, s;
3621
- p.x -= this.x0;
3622
- lon = p.x / this.a;
3623
- p.y -= this.y0;
3624
- lat = p.y / this.a;
3625
- if (this.sphere) {
3626
- lat /= this.C_y;
3627
- lon = lon / (this.C_x * (this.m + Math.cos(lat)));
3628
- if (this.m) {
3629
- lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
3630
- } else if (this.n !== 1) {
3631
- lat = asinz(Math.sin(lat) / this.n);
3632
- }
3633
- lon = adjust_lon(lon + this.long0);
3634
- lat = adjust_lat(lat);
3635
- } else {
3636
- lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
3637
- s = Math.abs(lat);
3638
- if (s < HALF_PI) {
3639
- s = Math.sin(lat);
3640
- temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
3641
- lon = adjust_lon(temp);
3642
- } else if (s - EPSLN < HALF_PI) {
3643
- lon = this.long0;
3644
- }
3645
- }
3646
- p.x = lon;
3647
- p.y = lat;
3648
- return p;
3649
- }
3650
- var names$a = ["Sinusoidal", "sinu"];
3651
- var sinu = {
3652
- init: init$a,
3653
- forward: forward$a,
3654
- inverse: inverse$a,
3655
- names: names$a
3656
- };
3657
- function init$9() {
3658
- }
3659
- function forward$9(p) {
3660
- var lon = p.x;
3661
- var lat = p.y;
3662
- var delta_lon = adjust_lon(lon - this.long0);
3663
- var theta = lat;
3664
- var con = Math.PI * Math.sin(lat);
3665
- while (true) {
3666
- var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
3667
- theta += delta_theta;
3668
- if (Math.abs(delta_theta) < EPSLN) {
3669
- break;
3670
- }
3671
- }
3672
- theta /= 2;
3673
- if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
3674
- delta_lon = 0;
3675
- }
3676
- var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
3677
- var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
3678
- p.x = x;
3679
- p.y = y;
3680
- return p;
3681
- }
3682
- function inverse$9(p) {
3683
- var theta;
3684
- var arg;
3685
- p.x -= this.x0;
3686
- p.y -= this.y0;
3687
- arg = p.y / (1.4142135623731 * this.a);
3688
- if (Math.abs(arg) > 0.999999999999) {
3689
- arg = 0.999999999999;
3690
- }
3691
- theta = Math.asin(arg);
3692
- var lon = adjust_lon(this.long0 + p.x / (0.900316316158 * this.a * Math.cos(theta)));
3693
- if (lon < -Math.PI) {
3694
- lon = -Math.PI;
3695
- }
3696
- if (lon > Math.PI) {
3697
- lon = Math.PI;
3698
- }
3699
- arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
3700
- if (Math.abs(arg) > 1) {
3701
- arg = 1;
3702
- }
3703
- var lat = Math.asin(arg);
3704
- p.x = lon;
3705
- p.y = lat;
3706
- return p;
3707
- }
3708
- var names$9 = ["Mollweide", "moll"];
3709
- var moll = {
3710
- init: init$9,
3711
- forward: forward$9,
3712
- inverse: inverse$9,
3713
- names: names$9
3714
- };
3715
- function init$8() {
3716
- if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
3717
- return;
3718
- }
3719
- this.lat2 = this.lat2 || this.lat1;
3720
- this.temp = this.b / this.a;
3721
- this.es = 1 - Math.pow(this.temp, 2);
3722
- this.e = Math.sqrt(this.es);
3723
- this.e0 = e0fn(this.es);
3724
- this.e1 = e1fn(this.es);
3725
- this.e2 = e2fn(this.es);
3726
- this.e3 = e3fn(this.es);
3727
- this.sinphi = Math.sin(this.lat1);
3728
- this.cosphi = Math.cos(this.lat1);
3729
- this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
3730
- this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
3731
- if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
3732
- this.ns = this.sinphi;
3733
- } else {
3734
- this.sinphi = Math.sin(this.lat2);
3735
- this.cosphi = Math.cos(this.lat2);
3736
- this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
3737
- this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
3738
- this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
3739
- }
3740
- this.g = this.ml1 + this.ms1 / this.ns;
3741
- this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
3742
- this.rh = this.a * (this.g - this.ml0);
3743
- }
3744
- function forward$8(p) {
3745
- var lon = p.x;
3746
- var lat = p.y;
3747
- var rh1;
3748
- if (this.sphere) {
3749
- rh1 = this.a * (this.g - lat);
3750
- } else {
3751
- var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
3752
- rh1 = this.a * (this.g - ml);
3753
- }
3754
- var theta = this.ns * adjust_lon(lon - this.long0);
3755
- var x = this.x0 + rh1 * Math.sin(theta);
3756
- var y = this.y0 + this.rh - rh1 * Math.cos(theta);
3757
- p.x = x;
3758
- p.y = y;
3759
- return p;
3760
- }
3761
- function inverse$8(p) {
3762
- p.x -= this.x0;
3763
- p.y = this.rh - p.y + this.y0;
3764
- var con, rh1, lat, lon;
3765
- if (this.ns >= 0) {
3766
- rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
3767
- con = 1;
3768
- } else {
3769
- rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
3770
- con = -1;
3771
- }
3772
- var theta = 0;
3773
- if (rh1 !== 0) {
3774
- theta = Math.atan2(con * p.x, con * p.y);
3775
- }
3776
- if (this.sphere) {
3777
- lon = adjust_lon(this.long0 + theta / this.ns);
3778
- lat = adjust_lat(this.g - rh1 / this.a);
3779
- p.x = lon;
3780
- p.y = lat;
3781
- return p;
3782
- } else {
3783
- var ml = this.g - rh1 / this.a;
3784
- lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
3785
- lon = adjust_lon(this.long0 + theta / this.ns);
3786
- p.x = lon;
3787
- p.y = lat;
3788
- return p;
3789
- }
3790
- }
3791
- var names$8 = ["Equidistant_Conic", "eqdc"];
3792
- var eqdc = {
3793
- init: init$8,
3794
- forward: forward$8,
3795
- inverse: inverse$8,
3796
- names: names$8
3797
- };
3798
- function init$7() {
3799
- this.R = this.a;
3800
- }
3801
- function forward$7(p) {
3802
- var lon = p.x;
3803
- var lat = p.y;
3804
- var dlon = adjust_lon(lon - this.long0);
3805
- var x, y;
3806
- if (Math.abs(lat) <= EPSLN) {
3807
- x = this.x0 + this.R * dlon;
3808
- y = this.y0;
3809
- }
3810
- var theta = asinz(2 * Math.abs(lat / Math.PI));
3811
- if (Math.abs(dlon) <= EPSLN || Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
3812
- x = this.x0;
3813
- if (lat >= 0) {
3814
- y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
3815
- } else {
3816
- y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
3817
- }
3818
- }
3819
- var al = 0.5 * Math.abs(Math.PI / dlon - dlon / Math.PI);
3820
- var asq = al * al;
3821
- var sinth = Math.sin(theta);
3822
- var costh = Math.cos(theta);
3823
- var g = costh / (sinth + costh - 1);
3824
- var gsq = g * g;
3825
- var m = g * (2 / sinth - 1);
3826
- var msq = m * m;
3827
- var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
3828
- if (dlon < 0) {
3829
- con = -con;
3830
- }
3831
- x = this.x0 + con;
3832
- var q = asq + g;
3833
- con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
3834
- if (lat >= 0) {
3835
- y = this.y0 + con;
3836
- } else {
3837
- y = this.y0 - con;
3838
- }
3839
- p.x = x;
3840
- p.y = y;
3841
- return p;
3842
- }
3843
- function inverse$7(p) {
3844
- var lon, lat;
3845
- var xx, yy, xys, c1, c2, c3;
3846
- var a1;
3847
- var m1;
3848
- var con;
3849
- var th1;
3850
- var d;
3851
- p.x -= this.x0;
3852
- p.y -= this.y0;
3853
- con = Math.PI * this.R;
3854
- xx = p.x / con;
3855
- yy = p.y / con;
3856
- xys = xx * xx + yy * yy;
3857
- c1 = -Math.abs(yy) * (1 + xys);
3858
- c2 = c1 - 2 * yy * yy + xx * xx;
3859
- c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
3860
- d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
3861
- a1 = (c1 - c2 * c2 / 3 / c3) / c3;
3862
- m1 = 2 * Math.sqrt(-a1 / 3);
3863
- con = 3 * d / a1 / m1;
3864
- if (Math.abs(con) > 1) {
3865
- if (con >= 0) {
3866
- con = 1;
3867
- } else {
3868
- con = -1;
3869
- }
3870
- }
3871
- th1 = Math.acos(con) / 3;
3872
- if (p.y >= 0) {
3873
- lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
3874
- } else {
3875
- lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
3876
- }
3877
- if (Math.abs(xx) < EPSLN) {
3878
- lon = this.long0;
3879
- } else {
3880
- lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
3881
- }
3882
- p.x = lon;
3883
- p.y = lat;
3884
- return p;
3885
- }
3886
- var names$7 = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
3887
- var vandg = {
3888
- init: init$7,
3889
- forward: forward$7,
3890
- inverse: inverse$7,
3891
- names: names$7
3892
- };
3893
- function init$6() {
3894
- this.sin_p12 = Math.sin(this.lat0);
3895
- this.cos_p12 = Math.cos(this.lat0);
3896
- }
3897
- function forward$6(p) {
3898
- var lon = p.x;
3899
- var lat = p.y;
3900
- var sinphi = Math.sin(p.y);
3901
- var cosphi = Math.cos(p.y);
3902
- var dlon = adjust_lon(lon - this.long0);
3903
- var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
3904
- if (this.sphere) {
3905
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
3906
- p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
3907
- p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
3908
- return p;
3909
- } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
3910
- p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
3911
- p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
3912
- return p;
3913
- } else {
3914
- cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
3915
- c = Math.acos(cos_c);
3916
- kp = c ? c / Math.sin(c) : 1;
3917
- p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
3918
- p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
3919
- return p;
3920
- }
3921
- } else {
3922
- e0 = e0fn(this.es);
3923
- e1 = e1fn(this.es);
3924
- e2 = e2fn(this.es);
3925
- e3 = e3fn(this.es);
3926
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
3927
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
3928
- Ml = this.a * mlfn(e0, e1, e2, e3, lat);
3929
- p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
3930
- p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
3931
- return p;
3932
- } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
3933
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
3934
- Ml = this.a * mlfn(e0, e1, e2, e3, lat);
3935
- p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
3936
- p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
3937
- return p;
3938
- } else {
3939
- tanphi = sinphi / cosphi;
3940
- Nl1 = gN(this.a, this.e, this.sin_p12);
3941
- Nl = gN(this.a, this.e, sinphi);
3942
- psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
3943
- Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
3944
- if (Az === 0) {
3945
- s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
3946
- } else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
3947
- s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
3948
- } else {
3949
- s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
3950
- }
3951
- G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
3952
- H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
3953
- GH = G * H;
3954
- Hs = H * H;
3955
- s2 = s * s;
3956
- s3 = s2 * s;
3957
- s4 = s3 * s;
3958
- s5 = s4 * s;
3959
- c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
3960
- p.x = this.x0 + c * Math.sin(Az);
3961
- p.y = this.y0 + c * Math.cos(Az);
3962
- return p;
3963
- }
3964
- }
3965
- }
3966
- function inverse$6(p) {
3967
- p.x -= this.x0;
3968
- p.y -= this.y0;
3969
- var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
3970
- if (this.sphere) {
3971
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
3972
- if (rh > 2 * HALF_PI * this.a) {
3973
- return;
3974
- }
3975
- z = rh / this.a;
3976
- sinz = Math.sin(z);
3977
- cosz = Math.cos(z);
3978
- lon = this.long0;
3979
- if (Math.abs(rh) <= EPSLN) {
3980
- lat = this.lat0;
3981
- } else {
3982
- lat = asinz(cosz * this.sin_p12 + p.y * sinz * this.cos_p12 / rh);
3983
- con = Math.abs(this.lat0) - HALF_PI;
3984
- if (Math.abs(con) <= EPSLN) {
3985
- if (this.lat0 >= 0) {
3986
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y));
3987
- } else {
3988
- lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
3989
- }
3990
- } else {
3991
- lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
3992
- }
3993
- }
3994
- p.x = lon;
3995
- p.y = lat;
3996
- return p;
3997
- } else {
3998
- e0 = e0fn(this.es);
3999
- e1 = e1fn(this.es);
4000
- e2 = e2fn(this.es);
4001
- e3 = e3fn(this.es);
4002
- if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
4003
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
4004
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
4005
- M = Mlp - rh;
4006
- lat = imlfn(M / this.a, e0, e1, e2, e3);
4007
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));
4008
- p.x = lon;
4009
- p.y = lat;
4010
- return p;
4011
- } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
4012
- Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
4013
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
4014
- M = rh - Mlp;
4015
- lat = imlfn(M / this.a, e0, e1, e2, e3);
4016
- lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
4017
- p.x = lon;
4018
- p.y = lat;
4019
- return p;
4020
- } else {
4021
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
4022
- Az = Math.atan2(p.x, p.y);
4023
- N1 = gN(this.a, this.e, this.sin_p12);
4024
- cosAz = Math.cos(Az);
4025
- tmp = this.e * this.cos_p12 * cosAz;
4026
- A = -tmp * tmp / (1 - this.es);
4027
- B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
4028
- D = rh / N1;
4029
- Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
4030
- F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
4031
- psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
4032
- lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
4033
- sinpsi = Math.sin(psi);
4034
- lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
4035
- p.x = lon;
4036
- p.y = lat;
4037
- return p;
4038
- }
4039
- }
4040
- }
4041
- var names$6 = ["Azimuthal_Equidistant", "aeqd"];
4042
- var aeqd = {
4043
- init: init$6,
4044
- forward: forward$6,
4045
- inverse: inverse$6,
4046
- names: names$6
4047
- };
4048
- function init$5() {
4049
- this.sin_p14 = Math.sin(this.lat0);
4050
- this.cos_p14 = Math.cos(this.lat0);
4051
- }
4052
- function forward$5(p) {
4053
- var sinphi, cosphi;
4054
- var dlon;
4055
- var coslon;
4056
- var ksp;
4057
- var g, x, y;
4058
- var lon = p.x;
4059
- var lat = p.y;
4060
- dlon = adjust_lon(lon - this.long0);
4061
- sinphi = Math.sin(lat);
4062
- cosphi = Math.cos(lat);
4063
- coslon = Math.cos(dlon);
4064
- g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
4065
- ksp = 1;
4066
- if (g > 0 || Math.abs(g) <= EPSLN) {
4067
- x = this.a * ksp * cosphi * Math.sin(dlon);
4068
- y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
4069
- }
4070
- p.x = x;
4071
- p.y = y;
4072
- return p;
4073
- }
4074
- function inverse$5(p) {
4075
- var rh;
4076
- var z;
4077
- var sinz, cosz;
4078
- var con;
4079
- var lon, lat;
4080
- p.x -= this.x0;
4081
- p.y -= this.y0;
4082
- rh = Math.sqrt(p.x * p.x + p.y * p.y);
4083
- z = asinz(rh / this.a);
4084
- sinz = Math.sin(z);
4085
- cosz = Math.cos(z);
4086
- lon = this.long0;
4087
- if (Math.abs(rh) <= EPSLN) {
4088
- lat = this.lat0;
4089
- p.x = lon;
4090
- p.y = lat;
4091
- return p;
4092
- }
4093
- lat = asinz(cosz * this.sin_p14 + p.y * sinz * this.cos_p14 / rh);
4094
- con = Math.abs(this.lat0) - HALF_PI;
4095
- if (Math.abs(con) <= EPSLN) {
4096
- if (this.lat0 >= 0) {
4097
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y));
4098
- } else {
4099
- lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
4100
- }
4101
- p.x = lon;
4102
- p.y = lat;
4103
- return p;
4104
- }
4105
- lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
4106
- p.x = lon;
4107
- p.y = lat;
4108
- return p;
4109
- }
4110
- var names$5 = ["ortho"];
4111
- var ortho = {
4112
- init: init$5,
4113
- forward: forward$5,
4114
- inverse: inverse$5,
4115
- names: names$5
4116
- };
4117
- var FACE_ENUM = {
4118
- FRONT: 1,
4119
- RIGHT: 2,
4120
- BACK: 3,
4121
- LEFT: 4,
4122
- TOP: 5,
4123
- BOTTOM: 6
4124
- };
4125
- var AREA_ENUM = {
4126
- AREA_0: 1,
4127
- AREA_1: 2,
4128
- AREA_2: 3,
4129
- AREA_3: 4
4130
- };
4131
- function init$4() {
4132
- this.x0 = this.x0 || 0;
4133
- this.y0 = this.y0 || 0;
4134
- this.lat0 = this.lat0 || 0;
4135
- this.long0 = this.long0 || 0;
4136
- this.lat_ts = this.lat_ts || 0;
4137
- this.title = this.title || "Quadrilateralized Spherical Cube";
4138
- if (this.lat0 >= HALF_PI - FORTPI / 2) {
4139
- this.face = FACE_ENUM.TOP;
4140
- } else if (this.lat0 <= -(HALF_PI - FORTPI / 2)) {
4141
- this.face = FACE_ENUM.BOTTOM;
4142
- } else if (Math.abs(this.long0) <= FORTPI) {
4143
- this.face = FACE_ENUM.FRONT;
4144
- } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
4145
- this.face = this.long0 > 0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
4146
- } else {
4147
- this.face = FACE_ENUM.BACK;
4148
- }
4149
- if (this.es !== 0) {
4150
- this.one_minus_f = 1 - (this.a - this.b) / this.a;
4151
- this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
4152
- }
4153
- }
4154
- function forward$4(p) {
4155
- var xy = { x: 0, y: 0 };
4156
- var lat, lon;
4157
- var theta, phi;
4158
- var t, mu;
4159
- var area = { value: 0 };
4160
- p.x -= this.long0;
4161
- if (this.es !== 0) {
4162
- lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
4163
- } else {
4164
- lat = p.y;
4165
- }
4166
- lon = p.x;
4167
- if (this.face === FACE_ENUM.TOP) {
4168
- phi = HALF_PI - lat;
4169
- if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
4170
- area.value = AREA_ENUM.AREA_0;
4171
- theta = lon - HALF_PI;
4172
- } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
4173
- area.value = AREA_ENUM.AREA_1;
4174
- theta = lon > 0 ? lon - SPI : lon + SPI;
4175
- } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
4176
- area.value = AREA_ENUM.AREA_2;
4177
- theta = lon + HALF_PI;
4178
- } else {
4179
- area.value = AREA_ENUM.AREA_3;
4180
- theta = lon;
4181
- }
4182
- } else if (this.face === FACE_ENUM.BOTTOM) {
4183
- phi = HALF_PI + lat;
4184
- if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
4185
- area.value = AREA_ENUM.AREA_0;
4186
- theta = -lon + HALF_PI;
4187
- } else if (lon < FORTPI && lon >= -FORTPI) {
4188
- area.value = AREA_ENUM.AREA_1;
4189
- theta = -lon;
4190
- } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
4191
- area.value = AREA_ENUM.AREA_2;
4192
- theta = -lon - HALF_PI;
4193
- } else {
4194
- area.value = AREA_ENUM.AREA_3;
4195
- theta = lon > 0 ? -lon + SPI : -lon - SPI;
4196
- }
4197
- } else {
4198
- var q, r, s;
4199
- var sinlat, coslat;
4200
- var sinlon, coslon;
4201
- if (this.face === FACE_ENUM.RIGHT) {
4202
- lon = qsc_shift_lon_origin(lon, +HALF_PI);
4203
- } else if (this.face === FACE_ENUM.BACK) {
4204
- lon = qsc_shift_lon_origin(lon, +SPI);
4205
- } else if (this.face === FACE_ENUM.LEFT) {
4206
- lon = qsc_shift_lon_origin(lon, -HALF_PI);
4207
- }
4208
- sinlat = Math.sin(lat);
4209
- coslat = Math.cos(lat);
4210
- sinlon = Math.sin(lon);
4211
- coslon = Math.cos(lon);
4212
- q = coslat * coslon;
4213
- r = coslat * sinlon;
4214
- s = sinlat;
4215
- if (this.face === FACE_ENUM.FRONT) {
4216
- phi = Math.acos(q);
4217
- theta = qsc_fwd_equat_face_theta(phi, s, r, area);
4218
- } else if (this.face === FACE_ENUM.RIGHT) {
4219
- phi = Math.acos(r);
4220
- theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
4221
- } else if (this.face === FACE_ENUM.BACK) {
4222
- phi = Math.acos(-q);
4223
- theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
4224
- } else if (this.face === FACE_ENUM.LEFT) {
4225
- phi = Math.acos(-r);
4226
- theta = qsc_fwd_equat_face_theta(phi, s, q, area);
4227
- } else {
4228
- phi = theta = 0;
4229
- area.value = AREA_ENUM.AREA_0;
4230
- }
4231
- }
4232
- mu = Math.atan(12 / SPI * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
4233
- t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
4234
- if (area.value === AREA_ENUM.AREA_1) {
4235
- mu += HALF_PI;
4236
- } else if (area.value === AREA_ENUM.AREA_2) {
4237
- mu += SPI;
4238
- } else if (area.value === AREA_ENUM.AREA_3) {
4239
- mu += 1.5 * SPI;
4240
- }
4241
- xy.x = t * Math.cos(mu);
4242
- xy.y = t * Math.sin(mu);
4243
- xy.x = xy.x * this.a + this.x0;
4244
- xy.y = xy.y * this.a + this.y0;
4245
- p.x = xy.x;
4246
- p.y = xy.y;
4247
- return p;
4248
- }
4249
- function inverse$4(p) {
4250
- var lp = { lam: 0, phi: 0 };
4251
- var mu, nu, cosmu, tannu;
4252
- var tantheta, theta, cosphi, phi;
4253
- var t;
4254
- var area = { value: 0 };
4255
- p.x = (p.x - this.x0) / this.a;
4256
- p.y = (p.y - this.y0) / this.a;
4257
- nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
4258
- mu = Math.atan2(p.y, p.x);
4259
- if (p.x >= 0 && p.x >= Math.abs(p.y)) {
4260
- area.value = AREA_ENUM.AREA_0;
4261
- } else if (p.y >= 0 && p.y >= Math.abs(p.x)) {
4262
- area.value = AREA_ENUM.AREA_1;
4263
- mu -= HALF_PI;
4264
- } else if (p.x < 0 && -p.x >= Math.abs(p.y)) {
4265
- area.value = AREA_ENUM.AREA_2;
4266
- mu = mu < 0 ? mu + SPI : mu - SPI;
4267
- } else {
4268
- area.value = AREA_ENUM.AREA_3;
4269
- mu += HALF_PI;
4270
- }
4271
- t = SPI / 12 * Math.tan(mu);
4272
- tantheta = Math.sin(t) / (Math.cos(t) - 1 / Math.sqrt(2));
4273
- theta = Math.atan(tantheta);
4274
- cosmu = Math.cos(mu);
4275
- tannu = Math.tan(nu);
4276
- cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
4277
- if (cosphi < -1) {
4278
- cosphi = -1;
4279
- } else if (cosphi > 1) {
4280
- cosphi = 1;
4281
- }
4282
- if (this.face === FACE_ENUM.TOP) {
4283
- phi = Math.acos(cosphi);
4284
- lp.phi = HALF_PI - phi;
4285
- if (area.value === AREA_ENUM.AREA_0) {
4286
- lp.lam = theta + HALF_PI;
4287
- } else if (area.value === AREA_ENUM.AREA_1) {
4288
- lp.lam = theta < 0 ? theta + SPI : theta - SPI;
4289
- } else if (area.value === AREA_ENUM.AREA_2) {
4290
- lp.lam = theta - HALF_PI;
4291
- } else {
4292
- lp.lam = theta;
4293
- }
4294
- } else if (this.face === FACE_ENUM.BOTTOM) {
4295
- phi = Math.acos(cosphi);
4296
- lp.phi = phi - HALF_PI;
4297
- if (area.value === AREA_ENUM.AREA_0) {
4298
- lp.lam = -theta + HALF_PI;
4299
- } else if (area.value === AREA_ENUM.AREA_1) {
4300
- lp.lam = -theta;
4301
- } else if (area.value === AREA_ENUM.AREA_2) {
4302
- lp.lam = -theta - HALF_PI;
4303
- } else {
4304
- lp.lam = theta < 0 ? -theta - SPI : -theta + SPI;
4305
- }
4306
- } else {
4307
- var q, r, s;
4308
- q = cosphi;
4309
- t = q * q;
4310
- if (t >= 1) {
4311
- s = 0;
4312
- } else {
4313
- s = Math.sqrt(1 - t) * Math.sin(theta);
4314
- }
4315
- t += s * s;
4316
- if (t >= 1) {
4317
- r = 0;
4318
- } else {
4319
- r = Math.sqrt(1 - t);
4320
- }
4321
- if (area.value === AREA_ENUM.AREA_1) {
4322
- t = r;
4323
- r = -s;
4324
- s = t;
4325
- } else if (area.value === AREA_ENUM.AREA_2) {
4326
- r = -r;
4327
- s = -s;
4328
- } else if (area.value === AREA_ENUM.AREA_3) {
4329
- t = r;
4330
- r = s;
4331
- s = -t;
4332
- }
4333
- if (this.face === FACE_ENUM.RIGHT) {
4334
- t = q;
4335
- q = -r;
4336
- r = t;
4337
- } else if (this.face === FACE_ENUM.BACK) {
4338
- q = -q;
4339
- r = -r;
4340
- } else if (this.face === FACE_ENUM.LEFT) {
4341
- t = q;
4342
- q = r;
4343
- r = -t;
4344
- }
4345
- lp.phi = Math.acos(-s) - HALF_PI;
4346
- lp.lam = Math.atan2(r, q);
4347
- if (this.face === FACE_ENUM.RIGHT) {
4348
- lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
4349
- } else if (this.face === FACE_ENUM.BACK) {
4350
- lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
4351
- } else if (this.face === FACE_ENUM.LEFT) {
4352
- lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
4353
- }
4354
- }
4355
- if (this.es !== 0) {
4356
- var invert_sign;
4357
- var tanphi, xa;
4358
- invert_sign = lp.phi < 0 ? 1 : 0;
4359
- tanphi = Math.tan(lp.phi);
4360
- xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
4361
- lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
4362
- if (invert_sign) {
4363
- lp.phi = -lp.phi;
4364
- }
4365
- }
4366
- lp.lam += this.long0;
4367
- p.x = lp.lam;
4368
- p.y = lp.phi;
4369
- return p;
4370
- }
4371
- function qsc_fwd_equat_face_theta(phi, y, x, area) {
4372
- var theta;
4373
- if (phi < EPSLN) {
4374
- area.value = AREA_ENUM.AREA_0;
4375
- theta = 0;
4376
- } else {
4377
- theta = Math.atan2(y, x);
4378
- if (Math.abs(theta) <= FORTPI) {
4379
- area.value = AREA_ENUM.AREA_0;
4380
- } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
4381
- area.value = AREA_ENUM.AREA_1;
4382
- theta -= HALF_PI;
4383
- } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
4384
- area.value = AREA_ENUM.AREA_2;
4385
- theta = theta >= 0 ? theta - SPI : theta + SPI;
4386
- } else {
4387
- area.value = AREA_ENUM.AREA_3;
4388
- theta += HALF_PI;
4389
- }
4390
- }
4391
- return theta;
4392
- }
4393
- function qsc_shift_lon_origin(lon, offset) {
4394
- var slon = lon + offset;
4395
- if (slon < -SPI) {
4396
- slon += TWO_PI;
4397
- } else if (slon > +SPI) {
4398
- slon -= TWO_PI;
4399
- }
4400
- return slon;
4401
- }
4402
- var names$4 = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
4403
- var qsc = {
4404
- init: init$4,
4405
- forward: forward$4,
4406
- inverse: inverse$4,
4407
- names: names$4
4408
- };
4409
- var COEFS_X = [
4410
- [1, 22199e-21, -715515e-10, 31103e-10],
4411
- [0.9986, -482243e-9, -24897e-9, -13309e-10],
4412
- [0.9954, -83103e-8, -448605e-10, -986701e-12],
4413
- [0.99, -135364e-8, -59661e-9, 36777e-10],
4414
- [0.9822, -167442e-8, -449547e-11, -572411e-11],
4415
- [0.973, -214868e-8, -903571e-10, 18736e-12],
4416
- [0.96, -305085e-8, -900761e-10, 164917e-11],
4417
- [0.9427, -382792e-8, -653386e-10, -26154e-10],
4418
- [0.9216, -467746e-8, -10457e-8, 481243e-11],
4419
- [0.8962, -536223e-8, -323831e-10, -543432e-11],
4420
- [0.8679, -609363e-8, -113898e-9, 332484e-11],
4421
- [0.835, -698325e-8, -640253e-10, 934959e-12],
4422
- [0.7986, -755338e-8, -500009e-10, 935324e-12],
4423
- [0.7597, -798324e-8, -35971e-9, -227626e-11],
4424
- [0.7186, -851367e-8, -701149e-10, -86303e-10],
4425
- [0.6732, -986209e-8, -199569e-9, 191974e-10],
4426
- [0.6213, -0.010418, 883923e-10, 624051e-11],
4427
- [0.5722, -906601e-8, 182e-6, 624051e-11],
4428
- [0.5322, -677797e-8, 275608e-9, 624051e-11]
4429
- ];
4430
- var COEFS_Y = [
4431
- [-520417e-23, 0.0124, 121431e-23, -845284e-16],
4432
- [0.062, 0.0124, -126793e-14, 422642e-15],
4433
- [0.124, 0.0124, 507171e-14, -160604e-14],
4434
- [0.186, 0.0123999, -190189e-13, 600152e-14],
4435
- [0.248, 0.0124002, 710039e-13, -224e-10],
4436
- [0.31, 0.0123992, -264997e-12, 835986e-13],
4437
- [0.372, 0.0124029, 988983e-12, -311994e-12],
4438
- [0.434, 0.0123893, -369093e-11, -435621e-12],
4439
- [0.4958, 0.0123198, -102252e-10, -345523e-12],
4440
- [0.5571, 0.0121916, -154081e-10, -582288e-12],
4441
- [0.6176, 0.0119938, -241424e-10, -525327e-12],
4442
- [0.6769, 0.011713, -320223e-10, -516405e-12],
4443
- [0.7346, 0.0113541, -397684e-10, -609052e-12],
4444
- [0.7903, 0.0109107, -489042e-10, -104739e-11],
4445
- [0.8435, 0.0103431, -64615e-9, -140374e-14],
4446
- [0.8936, 969686e-8, -64636e-9, -8547e-9],
4447
- [0.9394, 840947e-8, -192841e-9, -42106e-10],
4448
- [0.9761, 616527e-8, -256e-6, -42106e-10],
4449
- [1, 328947e-8, -319159e-9, -42106e-10]
4450
- ];
4451
- var FXC = 0.8487;
4452
- var FYC = 1.3523;
4453
- var C1 = R2D / 5;
4454
- var RC1 = 1 / C1;
4455
- var NODES = 18;
4456
- var poly3_val = function(coefs, x) {
4457
- return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
4458
- };
4459
- var poly3_der = function(coefs, x) {
4460
- return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
4461
- };
4462
- function newton_rapshon(f_df, start2, max_err, iters) {
4463
- var x = start2;
4464
- for (; iters; --iters) {
4465
- var upd = f_df(x);
4466
- x -= upd;
4467
- if (Math.abs(upd) < max_err) {
4468
- break;
4469
- }
4470
- }
4471
- return x;
4472
- }
4473
- function init$3() {
4474
- this.x0 = this.x0 || 0;
4475
- this.y0 = this.y0 || 0;
4476
- this.long0 = this.long0 || 0;
4477
- this.es = 0;
4478
- this.title = this.title || "Robinson";
4479
- }
4480
- function forward$3(ll) {
4481
- var lon = adjust_lon(ll.x - this.long0);
4482
- var dphi = Math.abs(ll.y);
4483
- var i = Math.floor(dphi * C1);
4484
- if (i < 0) {
4485
- i = 0;
4486
- } else if (i >= NODES) {
4487
- i = NODES - 1;
4488
- }
4489
- dphi = R2D * (dphi - RC1 * i);
4490
- var xy = {
4491
- x: poly3_val(COEFS_X[i], dphi) * lon,
4492
- y: poly3_val(COEFS_Y[i], dphi)
4493
- };
4494
- if (ll.y < 0) {
4495
- xy.y = -xy.y;
4496
- }
4497
- xy.x = xy.x * this.a * FXC + this.x0;
4498
- xy.y = xy.y * this.a * FYC + this.y0;
4499
- return xy;
4500
- }
4501
- function inverse$3(xy) {
4502
- var ll = {
4503
- x: (xy.x - this.x0) / (this.a * FXC),
4504
- y: Math.abs(xy.y - this.y0) / (this.a * FYC)
4505
- };
4506
- if (ll.y >= 1) {
4507
- ll.x /= COEFS_X[NODES][0];
4508
- ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
4509
- } else {
4510
- var i = Math.floor(ll.y * NODES);
4511
- if (i < 0) {
4512
- i = 0;
4513
- } else if (i >= NODES) {
4514
- i = NODES - 1;
4515
- }
4516
- for (; ; ) {
4517
- if (COEFS_Y[i][0] > ll.y) {
4518
- --i;
4519
- } else if (COEFS_Y[i + 1][0] <= ll.y) {
4520
- ++i;
4521
- } else {
4522
- break;
4523
- }
4524
- }
4525
- var coefs = COEFS_Y[i];
4526
- var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i + 1][0] - coefs[0]);
4527
- t = newton_rapshon(function(x) {
4528
- return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
4529
- }, t, EPSLN, 100);
4530
- ll.x /= poly3_val(COEFS_X[i], t);
4531
- ll.y = (5 * i + t) * D2R;
4532
- if (xy.y < 0) {
4533
- ll.y = -ll.y;
4534
- }
4535
- }
4536
- ll.x = adjust_lon(ll.x + this.long0);
4537
- return ll;
4538
- }
4539
- var names$3 = ["Robinson", "robin"];
4540
- var robin = {
4541
- init: init$3,
4542
- forward: forward$3,
4543
- inverse: inverse$3,
4544
- names: names$3
4545
- };
4546
- function init$2() {
4547
- this.name = "geocent";
4548
- }
4549
- function forward$2(p) {
4550
- var point = geodeticToGeocentric(p, this.es, this.a);
4551
- return point;
4552
- }
4553
- function inverse$2(p) {
4554
- var point = geocentricToGeodetic(p, this.es, this.a, this.b);
4555
- return point;
4556
- }
4557
- var names$2 = ["Geocentric", "geocentric", "geocent", "Geocent"];
4558
- var geocent = {
4559
- init: init$2,
4560
- forward: forward$2,
4561
- inverse: inverse$2,
4562
- names: names$2
4563
- };
4564
- var mode = {
4565
- N_POLE: 0,
4566
- S_POLE: 1,
4567
- EQUIT: 2,
4568
- OBLIQ: 3
4569
- };
4570
- var params = {
4571
- h: { def: 1e5, num: true },
4572
- azi: { def: 0, num: true, degrees: true },
4573
- tilt: { def: 0, num: true, degrees: true },
4574
- long0: { def: 0, num: true },
4575
- lat0: { def: 0, num: true }
4576
- };
4577
- function init$1() {
4578
- Object.keys(params).forEach(function(p) {
4579
- if (typeof this[p] === "undefined") {
4580
- this[p] = params[p].def;
4581
- } else if (params[p].num && isNaN(this[p])) {
4582
- throw new Error("Invalid parameter value, must be numeric " + p + " = " + this[p]);
4583
- } else if (params[p].num) {
4584
- this[p] = parseFloat(this[p]);
4585
- }
4586
- if (params[p].degrees) {
4587
- this[p] = this[p] * D2R;
4588
- }
4589
- }.bind(this));
4590
- if (Math.abs(Math.abs(this.lat0) - HALF_PI) < EPSLN) {
4591
- this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;
4592
- } else if (Math.abs(this.lat0) < EPSLN) {
4593
- this.mode = mode.EQUIT;
4594
- } else {
4595
- this.mode = mode.OBLIQ;
4596
- this.sinph0 = Math.sin(this.lat0);
4597
- this.cosph0 = Math.cos(this.lat0);
4598
- }
4599
- this.pn1 = this.h / this.a;
4600
- if (this.pn1 <= 0 || this.pn1 > 1e10) {
4601
- throw new Error("Invalid height");
4602
- }
4603
- this.p = 1 + this.pn1;
4604
- this.rp = 1 / this.p;
4605
- this.h1 = 1 / this.pn1;
4606
- this.pfact = (this.p + 1) * this.h1;
4607
- this.es = 0;
4608
- var omega = this.tilt;
4609
- var gamma = this.azi;
4610
- this.cg = Math.cos(gamma);
4611
- this.sg = Math.sin(gamma);
4612
- this.cw = Math.cos(omega);
4613
- this.sw = Math.sin(omega);
4614
- }
4615
- function forward$1(p) {
4616
- p.x -= this.long0;
4617
- var sinphi = Math.sin(p.y);
4618
- var cosphi = Math.cos(p.y);
4619
- var coslam = Math.cos(p.x);
4620
- var x, y;
4621
- switch (this.mode) {
4622
- case mode.OBLIQ:
4623
- y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
4624
- break;
4625
- case mode.EQUIT:
4626
- y = cosphi * coslam;
4627
- break;
4628
- case mode.S_POLE:
4629
- y = -sinphi;
4630
- break;
4631
- case mode.N_POLE:
4632
- y = sinphi;
4633
- break;
4634
- }
4635
- y = this.pn1 / (this.p - y);
4636
- x = y * cosphi * Math.sin(p.x);
4637
- switch (this.mode) {
4638
- case mode.OBLIQ:
4639
- y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
4640
- break;
4641
- case mode.EQUIT:
4642
- y *= sinphi;
4643
- break;
4644
- case mode.N_POLE:
4645
- y *= -(cosphi * coslam);
4646
- break;
4647
- case mode.S_POLE:
4648
- y *= cosphi * coslam;
4649
- break;
4650
- }
4651
- var yt, ba;
4652
- yt = y * this.cg + x * this.sg;
4653
- ba = 1 / (yt * this.sw * this.h1 + this.cw);
4654
- x = (x * this.cg - y * this.sg) * this.cw * ba;
4655
- y = yt * ba;
4656
- p.x = x * this.a;
4657
- p.y = y * this.a;
4658
- return p;
4659
- }
4660
- function inverse$1(p) {
4661
- p.x /= this.a;
4662
- p.y /= this.a;
4663
- var r = { x: p.x, y: p.y };
4664
- var bm, bq, yt;
4665
- yt = 1 / (this.pn1 - p.y * this.sw);
4666
- bm = this.pn1 * p.x * yt;
4667
- bq = this.pn1 * p.y * this.cw * yt;
4668
- p.x = bm * this.cg + bq * this.sg;
4669
- p.y = bq * this.cg - bm * this.sg;
4670
- var rh = hypot(p.x, p.y);
4671
- if (Math.abs(rh) < EPSLN) {
4672
- r.x = 0;
4673
- r.y = p.y;
4674
- } else {
4675
- var cosz, sinz;
4676
- sinz = 1 - rh * rh * this.pfact;
4677
- sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);
4678
- cosz = Math.sqrt(1 - sinz * sinz);
4679
- switch (this.mode) {
4680
- case mode.OBLIQ:
4681
- r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);
4682
- p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;
4683
- p.x *= sinz * this.cosph0;
4684
- break;
4685
- case mode.EQUIT:
4686
- r.y = Math.asin(p.y * sinz / rh);
4687
- p.y = cosz * rh;
4688
- p.x *= sinz;
4689
- break;
4690
- case mode.N_POLE:
4691
- r.y = Math.asin(cosz);
4692
- p.y = -p.y;
4693
- break;
4694
- case mode.S_POLE:
4695
- r.y = -Math.asin(cosz);
4696
- break;
4697
- }
4698
- r.x = Math.atan2(p.x, p.y);
4699
- }
4700
- p.x = r.x + this.long0;
4701
- p.y = r.y;
4702
- return p;
4703
- }
4704
- var names$1 = ["Tilted_Perspective", "tpers"];
4705
- var tpers = {
4706
- init: init$1,
4707
- forward: forward$1,
4708
- inverse: inverse$1,
4709
- names: names$1
4710
- };
4711
- function init() {
4712
- this.flip_axis = this.sweep === "x" ? 1 : 0;
4713
- this.h = Number(this.h);
4714
- this.radius_g_1 = this.h / this.a;
4715
- if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {
4716
- throw new Error();
4717
- }
4718
- this.radius_g = 1 + this.radius_g_1;
4719
- this.C = this.radius_g * this.radius_g - 1;
4720
- if (this.es !== 0) {
4721
- var one_es = 1 - this.es;
4722
- var rone_es = 1 / one_es;
4723
- this.radius_p = Math.sqrt(one_es);
4724
- this.radius_p2 = one_es;
4725
- this.radius_p_inv2 = rone_es;
4726
- this.shape = "ellipse";
4727
- } else {
4728
- this.radius_p = 1;
4729
- this.radius_p2 = 1;
4730
- this.radius_p_inv2 = 1;
4731
- this.shape = "sphere";
4732
- }
4733
- if (!this.title) {
4734
- this.title = "Geostationary Satellite View";
4735
- }
4736
- }
4737
- function forward(p) {
4738
- var lon = p.x;
4739
- var lat = p.y;
4740
- var tmp, v_x, v_y, v_z;
4741
- lon = lon - this.long0;
4742
- if (this.shape === "ellipse") {
4743
- lat = Math.atan(this.radius_p2 * Math.tan(lat));
4744
- var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));
4745
- v_x = r * Math.cos(lon) * Math.cos(lat);
4746
- v_y = r * Math.sin(lon) * Math.cos(lat);
4747
- v_z = r * Math.sin(lat);
4748
- if ((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2 < 0) {
4749
- p.x = Number.NaN;
4750
- p.y = Number.NaN;
4751
- return p;
4752
- }
4753
- tmp = this.radius_g - v_x;
4754
- if (this.flip_axis) {
4755
- p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
4756
- p.y = this.radius_g_1 * Math.atan(v_z / tmp);
4757
- } else {
4758
- p.x = this.radius_g_1 * Math.atan(v_y / tmp);
4759
- p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
4760
- }
4761
- } else if (this.shape === "sphere") {
4762
- tmp = Math.cos(lat);
4763
- v_x = Math.cos(lon) * tmp;
4764
- v_y = Math.sin(lon) * tmp;
4765
- v_z = Math.sin(lat);
4766
- tmp = this.radius_g - v_x;
4767
- if (this.flip_axis) {
4768
- p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
4769
- p.y = this.radius_g_1 * Math.atan(v_z / tmp);
4770
- } else {
4771
- p.x = this.radius_g_1 * Math.atan(v_y / tmp);
4772
- p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
4773
- }
4774
- }
4775
- p.x = p.x * this.a;
4776
- p.y = p.y * this.a;
4777
- return p;
4778
- }
4779
- function inverse(p) {
4780
- var v_x = -1;
4781
- var v_y = 0;
4782
- var v_z = 0;
4783
- var a, b, det, k;
4784
- p.x = p.x / this.a;
4785
- p.y = p.y / this.a;
4786
- if (this.shape === "ellipse") {
4787
- if (this.flip_axis) {
4788
- v_z = Math.tan(p.y / this.radius_g_1);
4789
- v_y = Math.tan(p.x / this.radius_g_1) * hypot(1, v_z);
4790
- } else {
4791
- v_y = Math.tan(p.x / this.radius_g_1);
4792
- v_z = Math.tan(p.y / this.radius_g_1) * hypot(1, v_y);
4793
- }
4794
- var v_zp = v_z / this.radius_p;
4795
- a = v_y * v_y + v_zp * v_zp + v_x * v_x;
4796
- b = 2 * this.radius_g * v_x;
4797
- det = b * b - 4 * a * this.C;
4798
- if (det < 0) {
4799
- p.x = Number.NaN;
4800
- p.y = Number.NaN;
4801
- return p;
4802
- }
4803
- k = (-b - Math.sqrt(det)) / (2 * a);
4804
- v_x = this.radius_g + k * v_x;
4805
- v_y *= k;
4806
- v_z *= k;
4807
- p.x = Math.atan2(v_y, v_x);
4808
- p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
4809
- p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
4810
- } else if (this.shape === "sphere") {
4811
- if (this.flip_axis) {
4812
- v_z = Math.tan(p.y / this.radius_g_1);
4813
- v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1 + v_z * v_z);
4814
- } else {
4815
- v_y = Math.tan(p.x / this.radius_g_1);
4816
- v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1 + v_y * v_y);
4817
- }
4818
- a = v_y * v_y + v_z * v_z + v_x * v_x;
4819
- b = 2 * this.radius_g * v_x;
4820
- det = b * b - 4 * a * this.C;
4821
- if (det < 0) {
4822
- p.x = Number.NaN;
4823
- p.y = Number.NaN;
4824
- return p;
4825
- }
4826
- k = (-b - Math.sqrt(det)) / (2 * a);
4827
- v_x = this.radius_g + k * v_x;
4828
- v_y *= k;
4829
- v_z *= k;
4830
- p.x = Math.atan2(v_y, v_x);
4831
- p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
4832
- }
4833
- p.x = p.x + this.long0;
4834
- return p;
4835
- }
4836
- var names = ["Geostationary Satellite View", "Geostationary_Satellite", "geos"];
4837
- var geos = {
4838
- init,
4839
- forward,
4840
- inverse,
4841
- names
4842
- };
4843
- function includedProjections(proj42) {
4844
- proj42.Proj.projections.add(tmerc);
4845
- proj42.Proj.projections.add(etmerc);
4846
- proj42.Proj.projections.add(utm);
4847
- proj42.Proj.projections.add(sterea);
4848
- proj42.Proj.projections.add(stere);
4849
- proj42.Proj.projections.add(somerc);
4850
- proj42.Proj.projections.add(omerc);
4851
- proj42.Proj.projections.add(lcc);
4852
- proj42.Proj.projections.add(krovak);
4853
- proj42.Proj.projections.add(cass);
4854
- proj42.Proj.projections.add(laea);
4855
- proj42.Proj.projections.add(aea);
4856
- proj42.Proj.projections.add(gnom);
4857
- proj42.Proj.projections.add(cea);
4858
- proj42.Proj.projections.add(eqc);
4859
- proj42.Proj.projections.add(poly);
4860
- proj42.Proj.projections.add(nzmg);
4861
- proj42.Proj.projections.add(mill);
4862
- proj42.Proj.projections.add(sinu);
4863
- proj42.Proj.projections.add(moll);
4864
- proj42.Proj.projections.add(eqdc);
4865
- proj42.Proj.projections.add(vandg);
4866
- proj42.Proj.projections.add(aeqd);
4867
- proj42.Proj.projections.add(ortho);
4868
- proj42.Proj.projections.add(qsc);
4869
- proj42.Proj.projections.add(robin);
4870
- proj42.Proj.projections.add(geocent);
4871
- proj42.Proj.projections.add(tpers);
4872
- proj42.Proj.projections.add(geos);
4873
- }
4874
- proj4.defaultDatum = "WGS84";
4875
- proj4.Proj = Projection;
4876
- proj4.WGS84 = new proj4.Proj("WGS84");
4877
- proj4.Point = Point;
4878
- proj4.toPoint = common;
4879
- proj4.defs = defs;
4880
- proj4.nadgrid = nadgrid;
4881
- proj4.transform = transform;
4882
- proj4.mgrs = mgrs;
4883
- proj4.version = "__VERSION__";
4884
- includedProjections(proj4);
4885
- export { proj4 as p };