Adding graticules labels for a map using d3.geoTransverseMercator projection

Working notebook: Lat-Lon Ticks / Saneef H. Ansari / Observable

I’m trying to label the graticules. The current approach is based on Graticule Labels / D3. When using d3.geoTransverseMercator projection, the graticule lines are not parallel to the canvas edge. So, estimations of label positions are not correct.

Is there a better way to position the labels next to its corresponding graticule line?

1 Like

Also, I tried to draw the graticule myself instead of using D3’s graticule(), hoping I can place the label on the intersection of latitude (or longitude) with edge. But, I couldn’t find a way to find the intersection of a GeoLine and non-geo line (edge).

1 Like

Yet again, the solution is found in the notebooks of @Fil: Finding intersections between the graticule and the clip sphere of the stereographic projection, method 2 / Fil / Observable. :slight_smile: He had solved it for circular clip area.

If you are looking for rectangular canvas, I have it in the original notebook itself.

2 Likes