1 # SPDX-License-Identifier: GPL-3.0-or-later
 
   3 # This file is part of Nominatim. (https://nominatim.org)
 
   5 # Copyright (C) 2025 by the Nominatim developer community.
 
   6 # For a full list of authors see the git log.
 
   8 A grid describing node placement in an area.
 
   9 Useful for visually describing geometries.
 
  15     def __init__(self, table, step, origin):
 
  27                     self.grid[pt_id] = (x, y)
 
  31     def get(self, nodeid):
 
  32         """ Get the coordinates for the given grid node.
 
  34         return self.grid.get(nodeid)
 
  36     def parse_point(self, value):
 
  37         """ Get the coordinates for either a grid node or a full coordinate.
 
  41             return [float(v) for v in value.split(' ', 1)]
 
  43         return self.grid.get(value)
 
  45     def parse_line(self, value):
 
  46         return [self.parse_point(p) for p in value.split(',')]