Skip to content

Commit

Permalink
Building and boundary fixes. Fix --input-file with abs path. Other mi…
Browse files Browse the repository at this point in the history
…nor improvements
  • Loading branch information
rustprooflabs committed Feb 25, 2022
2 parents 208d31b + d99a93f commit 1de3fb6
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ COPY ./sqitch.conf /etc/sqitch/sqitch.conf
WORKDIR /app
COPY . ./

RUN pip install -r requirements.txt
RUN pip install --upgrade pip && pip install -r requirements.txt
6 changes: 3 additions & 3 deletions docker/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ def wait_for_postgres():

if pg_isready():
found += 1
logger.info(f'Postgres up {found} times')
logger.debug(f'Postgres up {found} times')

if i % 5 == 0:
logger.info('Waiting for Postgres connection...')
logger.debug('Waiting for Postgres connection...')

i += 1

logger.info('Database passed two checks - should be ready')
logger.info('Postgres instance ready')


def pg_isready():
Expand Down
2 changes: 1 addition & 1 deletion docker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_env_vars(region, subregion, srid, language, pgosm_date, layerset,
else:
pgosm_region = f'{region}-{subregion}'

logger.info(f'PGOSM_REGION: {pgosm_region}')
logger.debug(f'PGOSM_REGION: {pgosm_region}')
os.environ['PGOSM_REGION'] = pgosm_region

if srid != DEFAULT_SRID:
Expand Down
9 changes: 2 additions & 7 deletions docker/osm2pgsql_recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def osm2pgsql_recommendation(ram, pbf_filename, out_path):
else:
pbf_file = pbf_filename
osm_pbf_gb = os.path.getsize(pbf_file) / 1024 / 1024 / 1024
LOGGER.info(f'PBF size (GB): {osm_pbf_gb}')
LOGGER.debug(f'PBF size (GB): {osm_pbf_gb}')

# PgOSM-Flex currently does not support/test append mode.
append = False
Expand Down Expand Up @@ -77,13 +77,8 @@ def get_recommended_script(system_ram_gb, osm_pbf_gb, append, pbf_filename,
append=append,
ssd=True)

# FIXME: Currently requires .osm.pbf input. Will block full functionality of #192
# Uses basename to work with absolute paths
filename_no_ext = os.path.basename(pbf_filename).replace('.osm.pbf', '')
LOGGER.info(f'Filename for osm2pgsql command: {filename_no_ext}')

osm2pgsql_cmd = rec.get_osm2pgsql_command(out_format='api',
pbf_filename=filename_no_ext)
pbf_path=pbf_filename)

osm2pgsql_cmd = osm2pgsql_cmd.replace('~/pgosm-data', output_path)

Expand Down
4 changes: 3 additions & 1 deletion flex-config/style/building.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function address_only_building(tags)
or tags.landuse
or tags.leisure
or tags.office
or tags.tourism then
or tags.tourism
or tags.boundary -- included in place layer
then
return false
end

Expand Down
19 changes: 9 additions & 10 deletions flex-config/style/place.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,15 @@ function place_process_relation(object)
local name = get_name(object.tags)
local member_ids = osm2pgsql.way_member_ids(object)

if object.tags.type == 'multipolygon' or object.tags.type == 'boundary' then
tables.place_polygon:add_row({
osm_type = osm_type,
boundary = boundary,
admin_level = admin_level,
name = name,
member_ids = member_ids,
geom = { create = 'area' }
})
end
tables.place_polygon:add_row({
osm_type = osm_type,
boundary = boundary,
admin_level = admin_level,
name = name,
member_ids = member_ids,
geom = { create = 'area' }
})

end


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
click>=8.0.1
coverage>=6.1.2
osm2pgsql-tuner==0.0.4
osm2pgsql-tuner==0.0.5
osmium==3.2.0
psycopg>=3.0.3
psycopg-binary>=3.0.3
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/expected/vbuilding_all_osm_type_subtype_count.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
address||16820
address||16819
building|39|1
building|44|1
building|Gym|1
Expand Down

0 comments on commit 1de3fb6

Please sign in to comment.