X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c48fb88e6b4020e960ccb656cb0741ab5f2fec74..8bc3bb16a116f0152b49b00dff53fb1f37f0fb31:/test/bdd/steps/db_ops.py diff --git a/test/bdd/steps/db_ops.py b/test/bdd/steps/db_ops.py index 56aa0c80..fa66cd4d 100644 --- a/test/bdd/steps/db_ops.py +++ b/test/bdd/steps/db_ops.py @@ -61,8 +61,11 @@ class PlaceColumn: for _ in range(int(random.random()*30)))) if self.columns['osm_type'] == 'N' and self.geometry is None: - self.geometry = "ST_SetSRID(ST_Point(%f, %f), 4326)" % ( - random.random()*360 - 180, random.random()*180 - 90) + pt = self.context.osm.grid_node(self.columns['osm_id']) + if pt is None: + pt = (random.random()*360 - 180, random.random()*180 - 90) + + self.geometry = "ST_SetSRID(ST_Point(%f, %f), 4326)" % pt else: assert_is_not_none(self.geometry, "Geometry missing") query = 'INSERT INTO place (%s, geometry) values(%s, %s)' % (