Use LineString when calculating perimeter (closes #2789)

This commit is contained in:
Bryan Housel
2015-09-28 15:51:21 -04:00
parent 2c902b2f93
commit 19e1c47e53

View File

@@ -121,7 +121,9 @@ iD.ui.Info = function(context) {
if (geometry === 'line' || geometry === 'area') {
var closed = (entity.type === 'relation') || (entity.isClosed() && !entity.isDegenerate()),
feature = entity.asGeoJSON(resolver),
length = radiansToMeters(d3.geo.length(feature)),
lineFeature = (feature.type === 'LineString') ? feature :
{ type: 'LineString', coordinates: feature.coordinates[0] },
length = radiansToMeters(d3.geo.length(lineFeature)),
lengthLabel = t('infobox.' + (closed ? 'perimeter' : 'length')),
centroid = d3.geo.centroid(feature);