Ejemplo n.º 1
0
    def run(self):
        rospy.init_node('rospilot_mapnik_server')

        os.environ['PGUSER'] = '******'
        os.environ['PGPASSWORD'] = '******'
        os.environ['PGHOST'] = 'localhost'
        style_file = find_in_workspaces(['share'],
                                        'rospilot',
                                        'share/mapnik-style/style.xml',
                                        first_match_only=True)
        if not style_file:
            rospy.logfatal("Cannot find share/mapnik-style/style.xml")
        else:
            style_file = style_file[0]

        config = expanduser(rospy.get_param('~tilestache_config_file'))
        # XXX: Monkey patch Mapnik because Tilestache doesn't work with the newest version
        mapnik.FontEngine.instance = staticmethod(lambda: mapnik.FontEngine)
        config = buildConfiguration(
            {
                "cache": {
                    "name": "Test"
                },
                "layers": {
                    "ex": {
                        "provider": {
                            "name": "mapnik",
                            "mapfile": "style.xml"
                        },
                        "projection": "spherical mercator"
                    }
                }
            }, style_file)
        app = TileStache.WSGITileServer(config=config)

        # Mount the application
        cherrypy.tree.graft(app, "/")

        # Unsubscribe the default server
        cherrypy.server.unsubscribe()

        # Instantiate a new server object
        server = cherrypy._cpserver.Server()

        # Configure the server object
        server.socket_host = "0.0.0.0"
        server.socket_port = int(
            rospy.get_param('/rospilot/mapnik_server_port'))
        server.thread_pool = 5

        # Subscribe this server
        server.subscribe()

        cherrypy.engine.start()
        rospy.loginfo("Mapnik server is running")
        rospy.loginfo(os.path.dirname(os.path.realpath(__file__)))
        rospy.loginfo(os.getcwd())
        rospy.spin()
        cherrypy.engine.exit()
Ejemplo n.º 2
0
import sys
import TileStache
application = TileStache.WSGITileServer(config='osm-check.cfg',
                                        autoreload=True)
Ejemplo n.º 3
0
import TileStache
application = TileStache.WSGITileServer(
    '/usr/local/app/tilestache/tilestache.cfg')
Ejemplo n.º 4
0
import TileStache

application = TileStache.WSGITileServer("/data/tilestache.json",
                                        autoreload=False)
Ejemplo n.º 5
0
import sys
import TileStache
application = TileStache.WSGITileServer(config='infra.cfg', autoreload=True)
Ejemplo n.º 6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import TileStache

application = TileStache.WSGITileServer(
    '/etc/tilestache/ressources/tilestache.cfg')
Ejemplo n.º 7
0
import os

import TileStache

config = os.path.join(os.path.dirname(__file__), 'tilestache.cfg')
application = TileStache.WSGITileServer(config)
Ejemplo n.º 8
0
import os, TileStache

application = TileStache.WSGITileServer(
    '/opt/solar_potential/tilestache_redis.cfg')
Ejemplo n.º 9
0
                      help="the IP address to listen on")
    parser.add_option("-p",
                      "--port",
                      dest="port",
                      type="int",
                      default=8080,
                      help="the port number to listen on")
    parser.add_option(
        '--include-path',
        dest='include',
        help=
        "Add the following colon-separated list of paths to Python's include path (aka sys.path)"
    )
    (options, args) = parser.parse_args()

    if options.include:
        for p in options.include.split(':'):
            sys.path.insert(0, p)

    from werkzeug.serving import run_simple
    import TileStache

    if not os.path.exists(options.file):
        print(
            "Config file not found. Use -c to pick a tilestache config file.",
            file=sys.stderr)
        sys.exit(1)

    app = TileStache.WSGITileServer(config=options.file, autoreload=True)
    run_simple(options.ip, options.port, app)
Ejemplo n.º 10
0
import TileStache
application = TileStache.WSGITileServer("/home/tilestache/app/tilestache.cfg")
Ejemplo n.º 11
0
                      default="tilestache.cfg",
                      help="the path to the tilestache config")
    parser.add_option("-i",
                      "--ip",
                      dest="ip",
                      default="127.0.0.1",
                      help="the IP address to listen on")
    parser.add_option("-p",
                      "--port",
                      dest="port",
                      type="int",
                      default=8080,
                      help="the port number to listen on")
    parser.add_option(
        '--include-path',
        dest='include',
        help=
        "Add the following colon-separated list of paths to Python's include path (aka sys.path)"
    )
    (options, args) = parser.parse_args()

    if options.include:
        for p in options.include.split(':'):
            sys.path.insert(0, p)

    from werkzeug.serving import run_simple
    import TileStache

    app = TileStache.WSGITileServer(config=config, autoreload=True)
    run_simple(options.ip, options.port, app)
Ejemplo n.º 12
0
import sys
import TileStache
application = TileStache.WSGITileServer(config='quality.cfg', autoreload=True)
import TileStache
application = TileStache.WSGITileServer('tilestache.cfg')

Ejemplo n.º 14
0
#!/usr/bin/env python
import TileStache

application = TileStache.WSGITileServer(
    config='/etc/tilestache/tilestache.cfg')