Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size and innerRadius are confusing as they don't account for Mercator distortions #18

Open
ilyabo opened this issue Mar 15, 2016 · 0 comments

Comments

@ilyabo
Copy link

ilyabo commented Mar 15, 2016

When measured in lat/lon degrees (or meters) the vertical and horizontal sizes of a hexagon are not the same because of the Mercator distortions. From the API documentation it is not clear what sizes size and innerRadius actually represent.

The API should clarify that and ideally provide means for obtaining sizes along the two axes. For example, the functions below give outer sizes for both axes (but don't account for wrapping at antimeridian and poles):

const zoneSize = (z, accessor) =>  {
  let [ a, b ] = d3.extent(z.geometry, accessor)
  return (b - a) 
}

const zoneHeight = (z) => zoneSize(z, d => d.lat)

const zoneWidth = (z) => zoneSize(z, d => d.lon)

Also z.size seems to return half of the outer radius (zoneWidth) contrary to the documentation which states that it is the side length

let z = terahex.decode('130046352')
z.size * 2                 // 2.469135802469136 
z.geometry[0].lon - z.geometry[3].lon     // 2.469135802469168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant