Skip to content

Commit

Permalink
ts-ignore for now
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonicclay committed Sep 24, 2020
1 parent b820d8f commit 70af0d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/editor/src/lib/importer.ts
Expand Up @@ -58,10 +58,14 @@ function getCleanedFeature(feature: Feature): Feature {
const properties = feature.properties || {};

let geometry = feature.geometry;
// @ts-ignore
if (geometry.type === 'GeometryCollection' && geometry.geometries.length === 1) {
// There's only one geometry
// @ts-ignore
geometry = geometry.geometries[0];
// @ts-ignore
} else if (geometry.type === 'GeometryCollection' && geometry.geometries.length > 1) {
// @ts-ignore
const types = new Set(geometry.geometries.map((g) => g.type));
if (types.size === 1) {
// See if it can be combined into a Multi* geometry
Expand All @@ -70,12 +74,14 @@ function getCleanedFeature(feature: Feature): Feature {
// Combine all the Polygons into a single MultiPolygon
geometry = {
type: 'MultiPolygon',
// @ts-ignore
coordinates: geometry.geometries.map((g) => g.coordinates),
};
} else if (type === 'LineString') {
// Combine all the LineStrings into a single MultiLineString
geometry = {
type: 'MultiLineString',
// @ts-ignore
coordinates: geometry.geometries.map((g) => g.coordinates),
};
}
Expand All @@ -85,6 +91,7 @@ function getCleanedFeature(feature: Feature): Feature {
}
}

// @ts-ignore
return {
type: 'Feature',
id,
Expand Down

0 comments on commit 70af0d6

Please sign in to comment.