Skip to content

Commit

Permalink
Fix mapbox radius calculations being off when changing latitude (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeke authored and mistercrunch committed Jul 28, 2016
1 parent 8872677 commit f9427b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions caravel/assets/visualizations/mapbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ class ScatterPlotGlowOverlay extends ScatterPlotOverlay {
let pointLabel;

if (radiusProperty !== null) {
const pointLatitude = props.lngLatAccessor(location)[1];
if (props.pointRadiusUnit === 'Kilometers') {
pointLabel = d3.round(pointRadius, 2) + 'km';
pointRadius = kmToPixels(pointRadius, props.latitude, props.zoom);
pointRadius = kmToPixels(pointRadius, pointLatitude, props.zoom);
} else if (props.pointRadiusUnit === 'Miles') {
pointLabel = d3.round(pointRadius, 2) + 'mi';
pointRadius = kmToPixels(pointRadius * MILES_PER_KM, props.latitude, props.zoom);
pointRadius = kmToPixels(pointRadius * MILES_PER_KM, pointLatitude, props.zoom);
}
}

Expand Down

0 comments on commit f9427b9

Please sign in to comment.