How to use routemap - 10 common examples

To help you get started, we’ve selected a few routemap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github waymarkedtrails / waymarked-trails-site / db / src / routemap / riding / db.py View on Github external
def make_shields(self):
        import os
        from routemap.common.conf import settings as conf
        import routemap.common.symbols as syms
        donesyms = set()
        cur = self.db.select("SELECT tags, level FROM %s NATURAL JOIN relations"
                         % (conf.DB_ROUTE_TABLE.fullname))
        for obj in cur:
            sym = syms.make_symbol(osgende.tags.TagStore(obj["tags"]), None, obj["level"], hrel.symboltypes)

            if sym is not None:
                sid = sym.get_id()

                if sid not in donesyms:
                    print "Writing", os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id())
                    sym.write_image(os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id()))
                    donesyms.add(sid)
github waymarkedtrails / waymarked-trails-site / db / src / routemap / skating / relations.py View on Github external
first)

    The actualy rendering information is computed seperately. This allows to use
    different rendering styles on the same table. For the moment there is only
    style_default.py.
"""

import os.path

import shapely.ops as sops
import osgende
import conf
import routemap.common.symbols as symbols

symboltypes = (
    symbols.SymbolReference,
)


class Routes(osgende.RelationSegmentRoutes):
    """Preprocessed information about the inline skating routes.

       It contains the following fields:

       * 'name' - the default name, generally taken from name-tag
          however, if the name is entirely in non-latin symbols,
          name:en is prefered if existing
       * 'intname' - collection of translated names
       * 'symbol' - unique name of the computed shield to use
       * 'country' - coutry the route is mainly in (in terms of
                     numbers of sections, TODO check this heuristic)
       * 'network' - special network it belongs to,
github waymarkedtrails / waymarked-trails-site / db / src / routemap / common / mapdb.py View on Github external
def generate_shields(self, symboltypes):
        import os
        from routemap.common.conf import settings as conf
        import routemap.common.symbols as syms
        donesyms = set()
        cur = self.db.select("SELECT tags, country, level FROM %s NATURAL JOIN relations"
                         % (conf.DB_ROUTE_TABLE.fullname))
        for obj in cur:
            sym = syms.make_symbol(obj["tags"], obj["country"], obj["level"], symboltypes)

            if sym is not None:
                sid = sym.get_id()

                if sid not in donesyms:
                    print "Writing", os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id())
                    sym.write_image(os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id()))
                    donesyms.add(sid)
github waymarkedtrails / waymarked-trails-site / db / src / routemap / cycling / relations.py View on Github external
The actualy rendering information is computed seperately. This allows to use
    different rendering styles on the same table. For the moment there is only
    style_default.py.
"""

import os.path
import shapely.ops as sops

from osgende import RelationHierarchy,RelationSegments,RelationSegmentRoutes
from osgende.common.postgisconn import PGTable
import conf
import routemap.common.symbols as symbols

symboltypes = (
    symbols.ColorBoxReference,
    symbols.SymbolReference,
)


class Routes(RelationSegmentRoutes):
    """Preprocessed information about the cycling routes.

       It contains the following fields:

       * 'name' - the default name, generally taken from name-tag
          however, if the name is entirely in non-latin symbols,
          name:en is prefered if existing
       * 'intname' - collection of translated names
       * 'symbol' - unique name of the computed shield to use
       * 'country' - coutry the route is mainly in (in terms of
                     numbers of sections, TODO check this heuristic)
github waymarkedtrails / waymarked-trails-site / db / src / routemap / mtbmap / relations.py View on Github external
'top' : None}

        # default treatment of tags
        for (k,v) in tags.iteritems():
            if k == 'name':
                outtags[k] = v
            elif k.startswith('name:'):
                outtags['intnames'][k[5:]] = v
            elif k == 'ref':
                if 'name' not in outtags:
                    outtags['name'] = '[%s]' % v
            elif k == 'network':
                outtags['level'] = conf.TAGS_NETWORK_MAP.get(v, 25)


        outtags['symbol'] = symbols.get_symbol(outtags['level'], None, tags, symboltypes)

        cur = self.thread.cursor

        if 'name' not in outtags:
            outtags['name'] = '(%s)' % osmid

        if outtags['top'] is None:
            if 'network' in tags:
                top = self.db.select_one("EXECUTE get_route_top(%s, %s)",
                              (osmid, tags['network']), cur=cur)
                outtags['top'] = (top is None)
            else:
                outtags['top'] = True

        # finally: compute the geometry
        routelines = self.db.select_column("EXECUTE get_route_geometry(%s)",
github waymarkedtrails / waymarked-trails-site / db / src / routemap / slopemap / relations.py View on Github external
outtags['name'] = '(%s)' % osmid

        # default treatment of tags
        for (k,v) in tags.iteritems():
            if k == 'piste:difficulty':
                if v in conf.TAGS_DIFFICULTY_MAP.keys():
                    outtags[v] = True
                    difficulty = conf.TAGS_DIFFICULTY_MAP[v]
            if k == 'piste:type':
                if v in conf.TAGS_PISTETYPE_MAP.keys():
                    outtags[v] = True
            if k.startswith('name:'):
                outtags['intnames'][k[5:]] = v
                    

        outtags['symbol'] = symbols.get_symbol(difficulty, None, tags, symboltypes)

        cur = self.thread.cursor

        if 'name' not in outtags:
            outtags['name'] = '(%s)' % osmid

        if outtags['top'] is None:
            if 'network' in tags:
                top = self.db.select_one("EXECUTE get_route_top(%s, %s)",
                              (osmid, tags['network']), cur=cur)
                outtags['top'] = True if (top == 0) else False
            else:
                outtags['top'] = True

        # finally: compute the geometry
        routelines = self.db.select_column("EXECUTE get_route_geometry(%s)",
github waymarkedtrails / waymarked-trails-site / db / src / routemap / cycling / relations.py View on Github external
The actualy rendering information is computed seperately. This allows to use
    different rendering styles on the same table. For the moment there is only
    style_default.py.
"""

import os.path
import shapely.ops as sops

from osgende import RelationHierarchy,RelationSegments,RelationSegmentRoutes
from osgende.common.postgisconn import PGTable
import conf
import routemap.common.symbols as symbols

symboltypes = (
    symbols.ColorBoxReference,
    symbols.SymbolReference,
)


class Routes(RelationSegmentRoutes):
    """Preprocessed information about the cycling routes.

       It contains the following fields:

       * 'name' - the default name, generally taken from name-tag
          however, if the name is entirely in non-latin symbols,
          name:en is prefered if existing
       * 'intname' - collection of translated names
       * 'symbol' - unique name of the computed shield to use
       * 'country' - coutry the route is mainly in (in terms of
                     numbers of sections, TODO check this heuristic)
       * 'network' - special network it belongs to,
github waymarkedtrails / waymarked-trails-site / db / src / routemap / cycling / db.py View on Github external
def make_shields(self):
        import os
        from routemap.common.conf import settings as conf
        import routemap.common.symbols as syms
        donesyms = set()
        cur = self.db.select("SELECT tags, level FROM %s NATURAL JOIN relations"
                         % (conf.DB_ROUTE_TABLE.fullname))
        for obj in cur:
            sym = syms.make_symbol(osgende.tags.TagStore(obj["tags"]), None, obj["level"], hrel.symboltypes)

            if sym is not None:
                sid = sym.get_id()

                if sid not in donesyms:
                    print "Writing", os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id())
                    sym.write_image(os.path.join(conf.WEB_SYMBOLDIR, "%s.png" % sym.get_id()))
                    donesyms.add(sid)
github waymarkedtrails / waymarked-trails-site / db / src / routemap / hiking / relations.py View on Github external
"""

import os.path
from collections import defaultdict

import osgende
import conf
import routemap.common.symbols as symbols
import shapely.ops as sops

symboltypes = (
            symbols.ShieldReference,
            symbols.SwissMobileReference,
            symbols.JelReference,
            symbols.KCTReference,
            symbols.OSMCSymbolReference,
            symbols.SymbolReference
        )


class Routes(osgende.RelationSegmentRoutes):
    """Preprocessed information about the hiking routes.

       It contains the following fields:

       * 'name' - the default name, generally taken from name-tag
          however, if the name is entirely in non-latin symbols,
          name:en is prefered if existing
       * 'intname' - collection of translated names
       * 'symbol' - unique name of the computed shield to use
       * 'country' - coutry the route is mainly in (in terms of
                     numbers of sections, TODO check this heuristic)
github waymarkedtrails / waymarked-trails-site / db / src / routemap / mtbmap / relations.py View on Github external
The actualy rendering information is computed seperately. This allows to use
    different rendering styles on the same table. For the moment there is only
    style_default.py.
"""

import os.path

import osgende
from osgende.common.postgisconn import PGTable
import conf
import routemap.common.symbols as symbols
import shapely.ops as sops

symboltypes = (
    symbols.SymbolReference,
)


class Routes(osgende.RelationSegmentRoutes):
    """Preprocessed information about the MTB routes.

       It contains the following fields:

       * 'name' - the default name, generally taken from name-tag
          however, if the name is entirely in non-latin symbols,
          name:en is prefered if existing
       * 'intname' - collection of translated names
       * 'symbol' - unique name of the computed shield to use
       * 'country' - coutry the route is mainly in (in terms of
                     numbers of sections, TODO check this heuristic)
       * 'network' - special network it belongs to,