Upgrade ST_DISTANCE() to ST_DISTANCE_SPHERE(), but there's a permissions issue.

This commit is contained in:
Starbeamrainbowlabs 2019-06-26 21:02:17 +01:00
parent 99dee5c059
commit e86b0b4f97
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 6 additions and 3 deletions

View file

@ -5,6 +5,9 @@ This is the changelog for the air quality web interface and its associated HTTP
- `[Code]` refers to internal changes to the code that have no direct impact on the web interface or the HTTP API, but are significant enough to warrant note. - `[Code]` refers to internal changes to the code that have no direct impact on the web interface or the HTTP API, but are significant enough to warrant note.
- `[Docs]` refers to changes to the [documentation](https://aq.connectedhumber.org/__nightdocs/00-Welcome.html). - `[Docs]` refers to changes to the [documentation](https://aq.connectedhumber.org/__nightdocs/00-Welcome.html).
## v0.12-dev
- [API] Improve accuracy of `distance_calc` for the `list-devices-near` action by using _Haversine's Formula_.
## v0.11.1 - 22nd June 2019 ## v0.11.1 - 22nd June 2019
- Drastically improve the performance of the backend SQL queries that power the heatmap and device graphs by over 35x in some cases! - Drastically improve the performance of the backend SQL queries that power the heatmap and device graphs by over 35x in some cases!
- For users of the HTTP API, said queries are `fetch-data` and `device-data`. - For users of the HTTP API, said queries are `fetch-data` and `device-data`.

View file

@ -125,10 +125,10 @@ class MariaDBDeviceRepository implements IDeviceRepository {
{$s("table_name")}.{$s("column_device_name")} AS name, {$s("table_name")}.{$s("column_device_name")} AS name,
{$s("table_name")}.{$s("column_lat")} AS latitude, {$s("table_name")}.{$s("column_lat")} AS latitude,
{$s("table_name")}.{$s("column_long")} AS longitude, {$s("table_name")}.{$s("column_long")} AS longitude,
ST_DISTANCE(POINT(:latitude, :longitude), {$s("table_name")}.{$s("column_point")}) AS distance_calc ST_DISTANCE_SPHERE(POINT(:latitude, :longitude), {$s("table_name")}.{$s("column_point")}) AS distance_calc
FROM {$s("table_name")} FROM {$s("table_name")}
WHERE {$s("table_name")}.{$s("column_point")} IS NOT NULL WHERE {$s("table_name")}.{$s("column_point")} IS NOT NULL
ORDER BY ST_DISTANCE(POINT(:latitude_again, :longitude_again), {$s("table_name")}.{$s("column_point")}) ORDER BY ST_DISTANCE_SPHERE(POINT(:latitude_again, :longitude_again), {$s("table_name")}.{$s("column_point")})
LIMIT :count;", [ LIMIT :count;", [
"latitude" => $lat, "latitude" => $lat,
"longitude" => $long, "longitude" => $long,

View file

@ -1 +1 @@
v0.11.1 v0.12-dev