Fix maxspeed unit detection

Centroid calculations were failing for two node ways.
It just uses the middle node now.
This commit is contained in:
Ansis Brammanis
2013-04-16 19:08:52 -04:00
parent 89a450dd2b
commit 7403b9b9e8
+2 -2
View File
@@ -19,11 +19,11 @@ iD.ui.preset.maxspeed = function(field, context) {
.call(combobox);
var childNodes = context.graph().childNodes(context.entity(entity.id)),
centroid = d3.geom.polygon(_.pluck(childNodes, 'loc')).centroid();
loc = childNodes[~~(childNodes.length/2)].loc;
imperial = _.any(iD.data.imperial.features, function(f) {
return _.any(f.geometry.coordinates, function(d) {
return iD.geo.pointInPolygon(centroid, d[0]);
return iD.geo.pointInPolygon(loc, d[0]);
});
});