On 12/06/2017 12:58 PM, Guy Harris wrote:
On Dec 6, 2017, at 8:50 AM, Brian Inglis <Brian.Inglis@systematicsw.ab.ca> wrote:
On 2017-12-05 14:29, Guy Harris wrote:
So, for doing a script to do the equivalent of what macOS and iOS do, you'd want more like "get your external IP address, geolocate it, and hand it to a program with a set of shapefiles for tzdb regions". See, for example https://github.com/evansiroky/timezone-boundary-builder (to which http://efele.net/maps/tz/world/ now refers people). More likely query the underlying geodatabase for the time zone region, often indexed by the minimum bounding rectangle [min x, min y[ - [max x, max y] surrounding the possibly non-convex hull, then resolve muiltiple hits by checking the interior convex polygons contain the coordinate, or equivalent tests. That's what I meant by "hand it to a program with a set of shapefiles for tzdb regions".
Like so (a request against my local TZdist server with the geolocate extension and using the Siroky boundaries): GET /tzdist/zones?location=geo:32.16,-109.13,0 HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive HTTP/1.1 200 OK Date: Wed, 06 Dec 2017 18:06:10 GMT Cache-Control: must-revalidate, max-age=86400 Expires: Thu, 07 Dec 2017 18:06:10 GMT Vary: Accept-Encoding Accept-Ranges: bytes ETag: "890939292-1466089793" Last-Modified: Thu, 16 Jun 2016 15:09:53 GMT Content-Type: application/json; charset=utf-8 Content-MD5: f9xV70dO60dwRS+ukiKkPQ== Content-Length: 311 { "synctoken": "890939292-1466089793", "timezones": [ { "tzid": "America/Phoenix", "etag": "3297940-1466089793", "last-modified": "2016-06-16T15:09:53Z", "publisher": "IANA Time Zone Database", "version": "2016e", "aliases": [ "US/Arizona" ] } ] } -- Kenneth Murchison Cyrus Development Team FastMail Pty Ltd