You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I rotated the projection to lambda -10 degrees.
Accordingly, I expect the longitude boundaries to be -170 and 190.
As a result, the geographic point [-170,0] on the projection [-0.5, 250] matches the geographical point [190,0] on the projection [-0.49999999999994316, 250].
And only such a geographical point [189.9999999999999, 0] on the projection will be where it is expected [960.4999999999998, 250].
Is there a method to get the longitude boundary values for the projection?
That is, for example, for projection geoMercator().rotate([-10, 0, 0])
I call the method "give boundary values for longitude" and it returns to me left=-170, right=189.9999999999999?
The text was updated successfully, but these errors were encountered:
You can’t rely on [190,0] being distinct from [-170, 0]; they represent the same point on the sphere. Same with [-180, 0] and [180, 0]; it’s somewhat coincidental that it works in this case due to floating point. If you want to compute the bounds of something, use path.bounds, say with {type: "Sphere"} for the entire globe.
Mike, thank you for the hint about using path.bounds.
As a result, the boundary values of the mercator, expressed in geographical coordinates, now I get this way:
I use d3-geo 3.1.0
Without rotation (everything works well)
output:
it seems there are no problems here, the only thing is not clear why -0.5 and 960.5, and not 0 and 960...
Rotate, lambda -10 (unexpected behavior)
output:
I rotated the projection to lambda -10 degrees.
Accordingly, I expect the longitude boundaries to be -170 and 190.
As a result, the geographic point
[-170,0]
on the projection[-0.5, 250]
matches the geographical point
[190,0]
on the projection[-0.49999999999994316, 250]
.And only such a geographical point
[189.9999999999999, 0]
on the projection will be where it is expected[960.4999999999998, 250]
.Check it. Stackblitz
Question
Is there a method to get the longitude boundary values for the projection?
That is, for example, for projection
geoMercator().rotate([-10, 0, 0])
I call the method "give boundary values for longitude" and it returns to me
left=-170
,right=189.9999999999999
?The text was updated successfully, but these errors were encountered: