[nominatim-web] Use string.format to shorten coordinates



commit 142b74971b6626707b157a8f60e9820e22aa1891
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Wed May 27 19:56:12 2020 +0200

    Use string.format to shorten coordinates

 nginx.conf | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/nginx.conf b/nginx.conf
index 2c5ca03..a072e6f 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -73,17 +73,9 @@ http {
 
         location = /reverse {
             rewrite_by_lua '
-                local shorten = function (str)
-                    if string.sub(str,1,1) == "-" then
-                        return string.sub(str,1,9)
-                    else
-                        return string.sub(str,1,8)
-                    end
-                end
-
                 local args = ngx.req.get_uri_args()
-                args.lat = shorten(args.lat)
-                args.lon = shorten(args.lon)
+                args.lat = string.format("%2.6f", args.lat)
+                args.lon = string.format("%3.6f", args.lon)
                 ngx.req.set_uri_args(args)
             ';
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]