diff --git a/css/map.css b/css/map.css index 309212cc9..43d7ccddb 100644 --- a/css/map.css +++ b/css/map.css @@ -1034,6 +1034,11 @@ path.gpx { pointer-events: none; } +/* GPS Labels */ +text.gpx { + fill:#FF26D4; +} + /* Modes */ .mode-draw-line .vertex.active, diff --git a/js/id/renderer/gpx_layer.js b/js/id/renderer/gpx_layer.js index 0463f19d2..379557a76 100644 --- a/js/id/renderer/gpx_layer.js +++ b/js/id/renderer/gpx_layer.js @@ -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) {