converting from lng/lat to meters

78 views
Skip to first unread message

Puneet Kishor

unread,
May 10, 2012, 2:02:53 PM5/10/12
to d3...@googlegroups.com
Perhaps a really basic question --

How do I convert something like

[
[-122.184, 39.813],
[-116.999, 40.951],
[-111.550, 45.186],
[-103.903, 45.863]
]

to meters using `d3.geo.mercator()` and also calculate distance in meters between each (n, n + 1) pairs of points?




--
Puneet Kishor

Mike Bostock

unread,
May 12, 2012, 9:38:57 PM5/12/12
to d3...@googlegroups.com
You don't need a project (such as mercator) to compute distance; use
d3.geo.greatArc, which has a distance method. This returns the
distance in radians, but you can multiply by the radius of the Earth
in meters (6,378,100) to get the distance in meters.

Mike
Reply all
Reply to author
Forward
0 new messages