d3 / d3-geo

Geographic projections, spherical shapes and spherical trigonometry.

Home Page:https://d3js.org/d3-geo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Сonvert geographic points considering antimeridian and pole

dowhileforeach opened this issue · comments

You provided a great opportunity to render geographic data given the antimeridian and pole using a geoPath:

const projection = geoMercator()
  .rotate([70, 0, 0])
  .fitWidth(side, {type: 'Sphere'});

const path = geoPath(projection, context);

context.beginPath();

path(land); // <--- pass GeoJSON

context.fillStyle = 'black';
context.fill();

Can you please tell me if it is possible to do the following:

  1. I have geographic data (GeoJSON, just an array of geographic points, etc.)
  2. I pass this data to some d3 function
  3. and as a result I get the same geographical data, only taking into account the antimeridian and the pole for the corresponding projection.

The fact is that before drawing on the canvas, I still need to transform the point from the projection in a tricky way. And for me the problem is that geoPath immediately draws on the canvas and I can’t give it the transformation I need from projection -> to view (in the form of a matrix [a, b, c, d, e, f]).