# Path: osm_data_processing/updateroutingdata.py
# def copy_ways():
#     """
#     copy data generated with osm2po to routing_way table
#     """
#     start = datetime.now()
#     cursor = connections[MAP_DB].cursor()
#     cursor.execute('DELETE FROM routing_way')
#     insert = """
#         insert into routing_way (class_id, length, name, x1, y1, x2, y2, reverse_cost, osm_id, source, target, the_geom)
#         select clazz, km,
#             case when osm_name is null then '' else osm_name end as osm_name,
#             x1, y1, x2, y2, reverse_cost, osm_id, source, target, geom_way
#         from osm_2po_4pgr
#     """
#     cursor.execute(insert)
#     transaction.commit_unless_managed(using=MAP_DB)
#     count = Way.objects.all().count()
#     logger.info('%i ways inserted successfully' % count)
#     logger.info('Total time: %s' % total_seconds(datetime.now()-start))
# 
#     # TODO should enable running VACUUM automatically
#     logger.info('Run VACUUM FULL to speed up other processing.')
# 
# def add_attributes():
#     """
#     Add attributes from osm2pgsql created database to our Way objects
#     """
#     start = datetime.now()
#     _update_reverse_cost()
#     _add_line_attributes()
#     _add_polygon_attributes()
#     _add_routes_attributes()
#     logger.info('All attributes updated successfully.')
#     logger.info('Total time: %s' % total_seconds(datetime.now()-start))
# 
#     # TODO should enable running VACUUM automatically
#     logger.info('Run VACUUM FULL to speed up routing.')


from django.core.management.base import BaseCommand
from osm_data_processing.updateroutingdata import copy_ways, add_attributes
# -*- coding: utf-8 -*-
# Django imports

# Local imports


class Command(BaseCommand):
    args = '<configuration file path>'
    help = 'Update data used for routing.'


# Path: osm_data_processing/updateroutingdata.py
# def copy_ways():
#     """
#     copy data generated with osm2po to routing_way table
#     """
#     start = datetime.now()
#     cursor = connections[MAP_DB].cursor()
#     cursor.execute('DELETE FROM routing_way')
#     insert = """
#         insert into routing_way (class_id, length, name, x1, y1, x2, y2, reverse_cost, osm_id, source, target, the_geom)
#         select clazz, km,
#             case when osm_name is null then '' else osm_name end as osm_name,
#             x1, y1, x2, y2, reverse_cost, osm_id, source, target, geom_way
#         from osm_2po_4pgr
#     """
#     cursor.execute(insert)
#     transaction.commit_unless_managed(using=MAP_DB)
#     count = Way.objects.all().count()
#     logger.info('%i ways inserted successfully' % count)
#     logger.info('Total time: %s' % total_seconds(datetime.now()-start))
# 
#     # TODO should enable running VACUUM automatically
#     logger.info('Run VACUUM FULL to speed up other processing.')
# 
# def add_attributes():
#     """
#     Add attributes from osm2pgsql created database to our Way objects
#     """
#     start = datetime.now()
#     _update_reverse_cost()
#     _add_line_attributes()
#     _add_polygon_attributes()
#     _add_routes_attributes()
#     logger.info('All attributes updated successfully.')
#     logger.info('Total time: %s' % total_seconds(datetime.now()-start))
# 
#     # TODO should enable running VACUUM automatically
#     logger.info('Run VACUUM FULL to speed up routing.')


# Path: osm_data_processing/management/commands/update_routing_data.py
from django.core.management.base import BaseCommand
from osm_data_processing.updateroutingdata import copy_ways, add_attributes

# -*- coding: utf-8 -*-
# Django imports

# Local imports


class Command(BaseCommand):
    args = '<configuration file path>'
    help = 'Update data used for routing.'


    def handle(self, *args, **options):