Browse Source

Remove redundant comments by making it explicit in the Makefile

feature/region-slug-gone
Bèr Kessels 5 months ago
parent
commit
ce76027ce0
2 changed files with 7 additions and 16 deletions
  1. 4
    0
      Makefile
  2. 3
    16
      bin/openaddr2copy

+ 4
- 0
Makefile View File

@@ -1,6 +1,9 @@
CMD_PREFIX=bundle exec
CONTAINER_NAME=hours_development
TEST_FILES_PATTERN ?= **/*_test.rb
ENV_FILE=.env

include $(ENV_FILE)

# You want latexmk to *always* run, because make does not have all the info.
# Also, include non-file targets in .PHONY so they are run regardless of any
@@ -30,6 +33,7 @@ run:
$(CMD_PREFIX) foreman start

import:
./bin/openaddr2copy < /mnt/sda/OSM/openaddr/nl/countrywide.csv | psql postgresql://$(DB_USER):$(DB_PASSWORD)@$(DB_HOST):$(DB_PORT)/$(DB_NAME) -c "COPY query_addresses FROM STDIN DELIMITER AS ',' CSV HEADER"
osmium tags-filter /mnt/sda/OSM/netherlands-latest.osm.pbf n/amenity=cafe,bar,restaurant,biergarten,fast_food,food_court,ice_cream,pub n/shop n/amenity=bicycle_parking,parking,parking_entrance --output-format osm | osm2geojson | bin/sink

_docker-start:

+ 3
- 16
bin/openaddr2copy View File

@@ -11,23 +11,10 @@ set -o pipefail
# Turn on traces, useful while debugging but commented out by default
# set -o xtrace

# Assuming a table like this:
# CREATE TABLE query_addresses (
# hash char(16) PRIMARY KEY,
# number varchar(32),
# street varchar(255),
# unit varchar(255),
# city varchar(255),
# district varchar(255),
# region varchar(255),
# postcode varchar(32),
# location GEOMETRY(POINT, 4326)
# );
# CREATE INDEX query_address_location ON query_addresses USING GIST(location);
# It can be inserted into postgres using:
# ./bin/openaddr < openaddr/nl/countrywide.csv | psql $DB_URL -c "COPY query_addresses FROM STDIN DELIMITER AS ',' CSV HEADER"

# Print the new header
# Remove duplicates
# Insert the WKT columns
# Take only the columns in the table
csvtk rename -f1-11 -n'lon,lat,number,street,unit,city,district,region,postcode,id,hash' - \
| csvtk uniq -f hash \
| csvtk mutate2 -n location -e '"SRID=4326;POINT(" + $lon + " " + $lat + ")"' \

Loading…
Cancel
Save