d3-geo-fit
v1.0.0
Published
Calculates the projection transform of the given d3 geo path to fit the given geometry features into the given widht/height.
Downloads
7
Readme
d3-geo-fit
A utility function which calculates the projection transform of the given d3 geo path to fit the given geometry features into the given width/height.
/**
* Calculates the projection transform for the given d3.geo.path
* to fit the given geometry features into the box [0, 0, width, height].
*
* @param geoPath Instance of d3.geo.path
* @param features GeoJSON features
* @param width {Number}
* @param height {Number}
* @param padding {Number} Padding in pixels
* @returns {{scale: number, translate: *[]}}
*/
fitTransform(geoPath, features, width, height, padding)