[Tile-serving] [openstreetmap/osm2pgsql] Add a script for simple updating of a database (#1411)

Jochen Topf notifications at github.com
Fri Feb 5 13:05:08 UTC 2021


@joto commented on this pull request.



> +
+        if osmid is None:
+            LOG.fatal("No data found in the database.")
+            return None
+
+    LOG.debug("Using way id %d for timestamp lookup", osmid)
+    # Get the node from the API to find the timestamp when it was created.
+    url = 'https://www.openstreetmap.org/api/0.6/way/{}/1'.format(osmid)
+    headers = {"User-Agent" : "osm2pgsql-update",
+               "Accept" : "application/json"}
+    with urlrequest.urlopen(urlrequest.Request(url, headers=headers)) as response:
+        data = json.loads(response.read().decode('utf-8'))
+
+    if not data.get('elements') or not 'timestamp' in data['elements'][0]:
+        LOG.fatal("The way data downloaded from the API does not contain valid data.\n"
+                  "URL used: %s", node_url)

`node_url`?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1411#pullrequestreview-584317682
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210205/c04ae6ac/attachment.htm>


More information about the Tile-serving mailing list