From 270d0f84e3283069a90545e49279dbc9807caf79 Mon Sep 17 00:00:00 2001 From: Jan Eike Suchard Date: Thu, 4 Jan 2024 13:44:46 +0100 Subject: [PATCH] fixing whitespaceing and srid errors --- resources/queries.sql | 6 +++--- routes/locations.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/queries.sql b/resources/queries.sql index ed37729..e5bb6ab 100644 --- a/resources/queries.sql +++ b/resources/queries.sql @@ -1,5 +1,5 @@ -- name: filter-locations -ST_CONTAINS(ST_COLLECT(ARRAY((SELECT geom FROM geodata.shapes WHERE key = any($1)))),ST_TRANSFORM(location, 4236)); +ST_CONTAINS(ST_COLLECT(ARRAY((SELECT geom FROM geodata.shapes WHERE key = any($1)))),ST_TRANSFORM(location, 4326)); -- name: filter-reality real = $1 OR real IS NULL; @@ -9,7 +9,7 @@ active = $1 OR active IS NULL; -- name: extended-usage-locations SELECT - id, water_right, name, no, active, ST_ASGEOJSON(ST_TRANSFORM(location, 4236)) as location, basin_no, county, + id, water_right, name, no, active, ST_ASGEOJSON(ST_TRANSFORM(location, 4326)) as location, basin_no, county, eu_survey_area, field, groundwater_volume, legal_scope, local_sub_district, maintenance_association, municipal_area, plot, real, rivershed, serial_no, @@ -20,7 +20,7 @@ FROM -- name: usage-locations SELECT - id, water_right, name, no, active, ST_ASGEOJSON(ST_TRANSFORM(location, 4236)) as location, real + id, water_right, name, no, active, ST_ASGEOJSON(ST_TRANSFORM(location, 4326)) as location, real FROM nlwkn_water_rights.e_usage_locations; diff --git a/routes/locations.go b/routes/locations.go index d3f44cc..ad61567 100644 --- a/routes/locations.go +++ b/routes/locations.go @@ -58,9 +58,9 @@ func UsageLocations(w http.ResponseWriter, r *http.Request) { } if len(arguments) == 0 { - filter = fmt.Sprintf("WHERE %s", filter) + filter = fmt.Sprintf(" WHERE %s", filter) } else { - filter = fmt.Sprintf("AND %s", filter) + filter = fmt.Sprintf(" AND %s", filter) } // now set the correct argument number @@ -78,9 +78,9 @@ func UsageLocations(w http.ResponseWriter, r *http.Request) { } if len(arguments) == 0 { - filter = fmt.Sprintf("WHERE %s", filter) + filter = fmt.Sprintf(" WHERE %s", filter) } else { - filter = fmt.Sprintf("AND %s", filter) + filter = fmt.Sprintf(" AND %s", filter) } // now set the correct argument number @@ -98,9 +98,9 @@ func UsageLocations(w http.ResponseWriter, r *http.Request) { } if len(arguments) == 0 { - filter = fmt.Sprintf("WHERE %s", filter) + filter = fmt.Sprintf(" WHERE %s", filter) } else { - filter = fmt.Sprintf("AND %s", filter) + filter = fmt.Sprintf(" AND %s", filter) } // now set the correct argument number