You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
757 B

  1. import {geoProjection as projection} from "d3-geo";
  2. import {abs} from "./math.js";
  3. import {mollweideRaw} from "./mollweide.js";
  4. import {sinusoidalRaw} from "./sinusoidal.js";
  5. import {sinuMollweidePhi, sinuMollweideY} from "./sinuMollweide.js";
  6. export function homolosineRaw(lambda, phi) {
  7. return abs(phi) > sinuMollweidePhi
  8. ? (lambda = mollweideRaw(lambda, phi), lambda[1] -= phi > 0 ? sinuMollweideY : -sinuMollweideY, lambda)
  9. : sinusoidalRaw(lambda, phi);
  10. }
  11. homolosineRaw.invert = function(x, y) {
  12. return abs(y) > sinuMollweidePhi
  13. ? mollweideRaw.invert(x, y + (y > 0 ? sinuMollweideY : -sinuMollweideY))
  14. : sinusoidalRaw.invert(x, y);
  15. };
  16. export default function() {
  17. return projection(homolosineRaw)
  18. .scale(152.63);
  19. }