1.0.0 • Published 8 years ago

d3-geo-fit v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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)