Die Verwechslung von Breiten- und Längengrad in Ihrer Funktion updateGisLines.js beim Aktualisieren eines Markers innerhalb einer Linie in Ihrer Datenbank weist typischerweise auf ein häufiges Problem bei der Handhabung von Geokoordinaten hin.

This commit is contained in:
ISA
2024-06-18 11:03:25 +02:00
parent a31e498013
commit 7cecef4925

View File

@@ -1,3 +1,4 @@
// /pages/api/talas_v5_DB/gisLines/updateGisLines.js
import mysql from "mysql"; import mysql from "mysql";
const dbConfig = { const dbConfig = {
@@ -23,7 +24,7 @@ export default function handler(req, res) {
} }
const { idModul, newCoordinates } = req.body; const { idModul, newCoordinates } = req.body;
const newLineString = `LINESTRING(${newCoordinates.map((coord) => `${coord[1]} ${coord[0]}`).join(",")})`; const newLineString = `LINESTRING(${newCoordinates.map((coord) => `${coord[0]} ${coord[1]}`).join(",")})`;
const query = const query =
"UPDATE talas_v5.gis_lines SET points = ST_GeomFromText(?) WHERE idModul = ?;"; "UPDATE talas_v5.gis_lines SET points = ST_GeomFromText(?) WHERE idModul = ?;";