d3-geo-fit

1.0.0 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i d3-geo-fit

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ilyabo