Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def transform_tags(self, osmid, tags):
return { 'name' : tags.get(conf.TAGS_NETWORKNODE_SUBTAG) }
def __init__(self, db):
NodeSubTable.__init__(
self, db, conf.DB_NETWORKNODE_TABLE,
"tags ? '%s'" % conf.TAGS_NETWORKNODE_SUBTAG)
def __init__(self, db, subtype=None, require_subtype=False):
self.subtype = subtype
self.require_subtype = require_subtype
NodeSubTable.__init__(
self, db, conf.DB_GUIDEPOST_TABLE,
conf.TAGS_GUIDEPOST_SUBSET)
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Tables storing information about guideposts and other nodes.
"""
import re
from osgende.nodes import NodeSubTable
from routemap.common.conf import settings as conf
class GuidePosts(NodeSubTable):
"""Information about the guideposts.
"""
elepattern = re.compile('[\\d.]+')
srid = conf.DB_SRID
def __init__(self, db, subtype=None, require_subtype=False):
self.subtype = subtype
self.require_subtype = require_subtype
NodeSubTable.__init__(
self, db, conf.DB_GUIDEPOST_TABLE,
conf.TAGS_GUIDEPOST_SUBSET)
def create(self):
self.layout((
('name', 'text'),
('ele', 'text')
))
def transform_tags(self, osmid, tags):
# filter by subtype
if self.require_subtype:
return None
outtags = { 'name' : tags.get('name') }
if 'ele'in tags:
m = self.elepattern.search(tags['ele'])
if m:
outtags['ele'] = m.group(0)
# XXX check for ft
return outtags
class NetworkNodes(NodeSubTable):
"""Information about node points.
"""
srid = conf.DB_SRID
def __init__(self, db):
NodeSubTable.__init__(
self, db, conf.DB_NETWORKNODE_TABLE,
"tags ? '%s'" % conf.TAGS_NETWORKNODE_SUBTAG)
def create(self):
self.layout((
('name', 'text'),
))
def transform_tags(self, osmid, tags):
return { 'name' : tags.get(conf.TAGS_NETWORKNODE_SUBTAG) }