diff --git a/server.js b/server.js index 19ad823..b2d8ba3 100644 --- a/server.js +++ b/server.js @@ -187,7 +187,7 @@ app.get('/api/variants', async (req, res) => { await setSchema(client); const query = ` SELECT - COALESCE(id, fid) AS id, name, "Variante", + id, name, "Variante", ST_AsGeoJSON(ST_Transform(geom, 4326)) as geometry FROM kabeltrasse ORDER BY id DESC @@ -222,7 +222,7 @@ app.post('/api/variants', async (req, res) => { const client = await pool.connect(); try { await setSchema(client); - + const routeName = properties.name || 'Neue Trasse'; const varianteValue = properties.Variante || (properties.name ? properties.name.replace('Variante ', '') : 'A'); const geoJsonStr = JSON.stringify(geometry); @@ -239,7 +239,7 @@ app.post('/api/variants', async (req, res) => { ) RETURNING id `; - + const insertRes = await client.query(insertQuery, [geoJsonStr, routeName, varianteValue]); res.json({ success: true, id: insertRes.rows[0].id }); } catch (err) {