Added the ability to load points from gpx files and display on the map

This commit is contained in:
SJohnson
2013-09-19 14:22:01 +01:00
committed by John Firebaugh
parent 690a04e538
commit 0790cf7423
2 changed files with 31 additions and 0 deletions
+5
View File
@@ -1034,6 +1034,11 @@ path.gpx {
pointer-events: none;
}
/* GPS Labels */
text.gpx {
fill:#FF26D4;
}
/* Modes */
.mode-draw-line .vertex.active,
+26
View File
@@ -24,6 +24,32 @@ iD.GpxLayer = function(context, dispatch) {
paths
.attr('d', d3.geo.path().projection(projection));
if (typeof gj.features !== 'undefined') {
svg
.selectAll('text')
.remove();
svg
.selectAll('path')
.data(gj.features)
.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;
})
.attr('y', function(d) {
var centroid = d3.geo.path().projection(projection)
.centroid(d);
return centroid[1];
});
}
}
function toDom(x) {