Skip to content

Commit

Permalink
fix kml and gpx simultaneous upload bug (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdevalapurkar authored Sep 28, 2021
1 parent c22bcda commit 6dd14d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/src/queries/generate-geometry-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function generateGeometryCollectionSQL(geometry: Feature[]): SQLStatement
if (geometry.length === 1) {
const geo = JSON.stringify(geometry[0].geometry);

return SQL`public.ST_GeomFromGeoJSON(${geo})`;
return SQL`public.ST_Force2D(public.ST_GeomFromGeoJSON(${geo}))`;
}

const sqlStatement: SQLStatement = SQL`public.ST_AsText(public.ST_Collect(array[`;
Expand All @@ -19,11 +19,11 @@ export function generateGeometryCollectionSQL(geometry: Feature[]): SQLStatement
// as long as it is not the last geometry, keep adding to the ST_collect
if (index !== geometry.length - 1) {
sqlStatement.append(SQL`
public.ST_GeomFromGeoJSON(${geo}),
public.ST_Force2D(public.ST_GeomFromGeoJSON(${geo})),
`);
} else {
sqlStatement.append(SQL`
public.ST_GeomFromGeoJSON(${geo})]))
public.ST_Force2D(public.ST_GeomFromGeoJSON(${geo}))]))
`);
}
});
Expand Down

0 comments on commit 6dd14d9

Please sign in to comment.