This commit is contained in:
John Firebaugh
2013-09-25 14:46:12 -07:00
parent 0790cf7423
commit 844c11df63

View File

@@ -22,9 +22,12 @@ iD.GpxLayer = function(context, dispatch) {
.append('path')
.attr('class', 'gpx');
var path = d3.geo.path()
.projection(projection);
paths
.attr('d', d3.geo.path().projection(projection));
.attr('d', path);
if (typeof gj.features !== 'undefined') {
svg
.selectAll('text')
@@ -33,21 +36,19 @@ iD.GpxLayer = function(context, dispatch) {
svg
.selectAll('path')
.data(gj.features)
.enter()
.enter()
.append('text')
.attr('class', 'gpx')
.text(function(d) {
return d.properties.name;
})
.attr('x', function(d) {
var centroid = d3.geo.path().projection(projection)
.centroid(d);
return centroid[0] + 5;
var centroid = path.centroid(d);
return centroid[0] + 5;
})
.attr('y', function(d) {
var centroid = d3.geo.path().projection(projection)
.centroid(d);
return centroid[1];
var centroid = path.centroid(d);
return centroid[1];
});
}
}