mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix issue with extracting relations
This commit is contained in:
@@ -45,7 +45,10 @@ export function actionExtract(entityID) {
|
||||
var keysToRetain = ['area'];
|
||||
var buildingKeysToRetain = ['architect', 'building', 'height', 'layer'];
|
||||
|
||||
var centroid = d3_geoCentroid(entity.asGeoJSON(graph));
|
||||
var extractedLoc = d3_geoCentroid(entity.asGeoJSON(graph));
|
||||
if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
|
||||
extractedLoc = entity.extent(graph).center();
|
||||
}
|
||||
|
||||
var isBuilding = entity.tags.building && entity.tags.building !== 'no';
|
||||
|
||||
@@ -87,7 +90,7 @@ export function actionExtract(entityID) {
|
||||
entityTags.area = 'yes';
|
||||
}
|
||||
|
||||
var replacement = osmNode({ loc: centroid, tags: pointTags });
|
||||
var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
|
||||
graph = graph.replace(replacement);
|
||||
|
||||
extractedNodeID = replacement.id;
|
||||
|
||||
@@ -21,10 +21,9 @@ export function operationExtract(context, selectedIDs) {
|
||||
|
||||
if (entity.type === 'node' && graph.parentWays(entity).length === 0) return;
|
||||
|
||||
var geometry = graph.geometry(entityID);
|
||||
if (geometry === 'area' || geometry === 'line') {
|
||||
if (entity.type !== 'node') {
|
||||
var preset = presetManager.match(entity, graph);
|
||||
// only allow extraction from ways/multipolygons if the preset supports points
|
||||
// only allow extraction from ways/relations if the preset supports points
|
||||
if (preset.geometry.indexOf('point') === -1) return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user