[Tile-serving] [openstreetmap/osm2pgsql] Add a script for simple updating of a database (#1411)
mmd
notifications at github.com
Thu Feb 4 21:59:22 UTC 2021
@mmd-osm commented on this pull request.
> + data base.
+ """
+ # First, find the way with the highest ID in the database
+ # Using nodes would be more reliable but those are not cached by osm2pgsql.
+ with conn.cursor() as cur:
+ cur.execute("SELECT max(id) FROM {}_ways".format(prefix))
+ osmid = cur.fetchone()[0] if cur.rowcount == 1 else None
+
+ if osmid is None:
+ LOG.fatal("No data found in the database.")
+ return None
+
+ LOG.info("Using way id %d for timestamp lookup", osmid)
+ # Get the node from the API to find the timestamp when it was created.
+ node_url = 'https://www.openstreetmap.org/api/0.6/way/{}/1'.format(osmid)
+ headers = {"User-Agent" : "osm2pgsql-update"}
"Get the node" and node_url still seem to refer to a previous version that was based on nodes?
--
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-583849740
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210204/d1ab02bb/attachment-0001.htm>
More information about the Tile-serving
mailing list