d3-geo
d3-geo copied to clipboard
single point has no extent
See this notebook: https://observablehq.com/@mattijn/single-point-has-no-extent
Basically:
p = d3.geoMercator()
p.fitExtent(
[[0,0],[500,500]],
{"type": "Feature", "geometry": {"type": "Point", "coordinates": [4.8885, 52.4039]}}
)
p.scale() // Infinity
p.translate() // [-Infinity, Infinity]
Not sure if it is by design or unwanted behaviour. I understand its hard to compute an extent of a single point.
First raised in https://github.com/vega/vega-lite/issues/5318
yes it could be nice to have another argument for an "inset" (in degrees) around the feature
related: this suggestion for an inset in pixels https://github.com/d3/d3-geo/issues/162