- 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