
#import configuration gpkg to postgis

#pages query

for page in result:
    #prepare poly file for clip
    
    polyfile = os.path.join(datadir,'roi.poly')
    cmd = 'ogr2ogr -where "map_id={map_id}" '
    cmd = cmd.format(map_id=page['map_id'])
    print cmd
    os.system(cmd)
    
    cmd = 'ogr2poly.py'
    cmd = cmd.format
    print cmd
    os.system(cmd)
    
    #prepare pbf file for lines
    
    #clip pbf file by poly
    cmd = 'osmconvert polyfile country_pbf city_pbf'
    cmd = cmd.format(polyfile=polyfile)
    print cmd
    os.system(cmd)
    
    #filter routes from pbf
    cmd = 'python filter_pbf.py --filter "{filter}"  --source "{source_pbf}" --result "{result_pbf}" '
    cmd = cmd.format(filter = page['filter'],  source_pbf = os.path.join('datadir','city_pbf.pbf')
    print cmd
    os.system(cmd)   
    #prepare pbf file for basemap
    
    #import pbf to postgis
    cmd = 'osm2pgsql'
    
    #run osmot
    cmd = 'python osmot/osmot.py'
    
    #export route lines from postgis to gpkg
    
    cmd = 'ogr2ogr'
    cmd = 'ogr2ogr'
    
    #move lines to folder
    
    os.move
    
    #same steps for basemaps
    
    
print 'generate layers complete'
print 'merge layers to one file'
print 'merge route lines'
for in os.walk(route_lines_folder):
  
cmd = 'ogrmerge'

print 'merge basemaps'
for in os.walk(route_lines_folder):
  
cmd = 'ogrmerge'

print 'merge layers to gpkg complete'
print 'copy qgis project'
os.copy()
print 'you can open project in qgis'

@@ -302,16 +302,25 @@
 2poly.py
+ %7Bsource%7D
 '%0A    cm
@@ -333,16 +333,56 @@
 d.format
+(source=os.path.join(datadir,'roi.gpkg')
 %0A    pri
@@ -502,37 +502,48 @@
 ert 
-polyfile country_pbf city_
+%7Bsourcepbf%7D -B=%7Bpolyfile%7D -o=%7Bresult
 pbf
+%7D
 '%0A  
@@ -565,25 +565,163 @@
 mat(
-polyfile=polyfile
+sourcepbf = os.path.join(datadir,'country.pbf'),%0A                     polyfile=polyfile,%0A                    resultpbf = os.path.join(datadir, 'city.pbf') 
 )%0A  

Update atlas-get.py