d3-geo icon indicating copy to clipboard operation
d3-geo copied to clipboard

single point has no extent

Open mattijn opened this issue 4 years ago • 1 comments

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

mattijn avatar Apr 26 '21 21:04 mattijn

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

Fil avatar Apr 26 '21 21:04 Fil