I don't understand how this is utilizing enclose from @fil/spherical-smallest-circle-problem? Doesn't that function do stereoCircles on the points? Based on the visualization it looks like it's just enclosing the country boundaries' points without stereoCircles (which is what I'm trying to do, hence the question). What I'm really trying to do is "simply" get the circle center and radius of the smallest circle of a given geoJson (like a country).
encloseFeature takes a feature and looks at all its points, then creates an enclosing circle with the method described in https://observablehq.com/@fil/spherical-smallest-circle-problem.
the method uses a stereographic projection to compute the circles, because the stereographic projection preserves circles; however what's not intuitive is that the center of the circle has to be computed on the sphere, not on the stereo plane. (You can see how these two centers diverge if you check the "show stereo" button.)
When performing this on a feature with multiple polygons, it seems to pick an arbitrary polygon to perform the enclosing on, rather than consider the entire feature. Any idea how to fix this?
My fault, I just realized I was passing only one feature from a collection. Do you know off hand of any d3 functions that will flatten a geoJson FeatureCollection into a single feature?
I don't think it's possible in general, since two features can have incompatible geometries (points and lines and polygons). To merge polygons or multipolygons you might want to look at topojson-client.