Skip to content

Commit

Permalink
treat oa_quality_check as function
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoll1 committed Apr 23, 2022
1 parent 2a6cf90 commit f54a077
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions osmand_osm/osm/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def oa_quality_check(source):
# handle files with hashes only
try:
id_end = json.loads(stats.stdout)['data']['minid']['nodes']
return id_end
except Exception as e:
logging.info('Error finding id_end in {0}. File is likely hashes only'.format(source.table))
raise
Expand All @@ -125,15 +126,15 @@ def oa_quality_check(source):
logging.exception('ogr2osm failure ')
raise
return id_start
oa_quality_check(source)
id_end = oa_quality_check(source)
elif 'integer' in r or 'numeric' in r:
try:
run('ogr2osm -f --id={0} -t addr_oa.py -o {1} "PG:dbname={4}" --sql "select * from \\"{2}\\" where {3} is not null and {3}!=0"'.format(id_start, source.path_osm, source.table, number_field, db_name), shell=True, capture_output=True, check=True, encoding='utf8')
except Exception as e:
logging.exception('ogr2osm failure ')
raise
return id_start
oa_quality_check(source)
id_end = oa_quality_check(source)
# handle empty file
else:
logging.warning('{0} is empty'.format(source.table))
Expand Down

0 comments on commit f54a077

Please sign in to comment.