Skip to content

Commit bce9469

Browse files
author
Rub21
committed
Update osm-procesor and osh.pbf hitorical file creation
1 parent 1c94cd3 commit bce9469

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

images/full-history/start.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ else
88
echo JAVACMD_OPTIONS=\"-server -Xmx$memory\" >~/.osmosis
99
fi
1010

11-
# Fixing name for file
11+
# Fixing name for historical file
1212
date=$(date '+%y%m%d_%H%M')
13-
fullHistoryFile=history-${date}.osm.bz2
13+
fullHistoryFile=history-${date}.osh.pbf
1414
# In case overwrite the file
1515
if [ "$OVERWRITE_FHISTORY_FILE" == "true" ]; then
16-
fullHistoryFile=history-latest.osm.bz2
16+
fullHistoryFile=history-latest.osh.pbf
1717
fi
18-
# State file
18+
19+
# State file nname
1920
stateFile="state.txt"
21+
osm_tmp_file="osm_tmp.osm"
2022

2123
# Creating full history
2224
osmosis --read-apidb-change \
@@ -26,21 +28,25 @@ osmosis --read-apidb-change \
2628
password=$POSTGRES_PASSWORD \
2729
validateSchemaVersion=no \
2830
readFullHistory=yes \
29-
--write-xml-change \
30-
compressionMethod=bzip2 \
31-
$fullHistoryFile
31+
--write-xml-change \
32+
compressionMethod=auto \
33+
$osm_tmp_file
34+
35+
# Convert file to PBF file
36+
osmium cat $osm_tmp_file -o $fullHistoryFile
37+
osmium fileinfo $fullHistoryFile
3238

3339
# AWS
3440
if [ $CLOUDPROVIDER == "aws" ]; then
35-
echo "https://$AWS_S3_BUCKET.s3.amazonaws.com/planet/full-history/$fullHistoryFile" > $stateFile
41+
echo "https://$AWS_S3_BUCKET.s3.amazonaws.com/planet/full-history/$fullHistoryFile" >$stateFile
3642
# Upload to S3
37-
aws s3 cp $fullHistoryFile $AWS_S3_BUCKET/planet/full-history/$fullHistoryFile --acl public-read
38-
aws s3 cp $stateFile $AWS_S3_BUCKET/planet/full-history/$stateFile --acl public-read
43+
aws s3 cp $fullHistoryFile $AWS_S3_BUCKET/planet/full-history/$fullHistoryFile --acl public-read
44+
aws s3 cp $stateFile $AWS_S3_BUCKET/planet/full-history/$stateFile --acl public-read
3945
fi
4046

4147
# Google Storage
4248
if [ $CLOUDPROVIDER == "gcp" ]; then
43-
echo "https://storage.cloud.google.com/$GCP_STORAGE_BUCKET/planet/full-history/$fullHistoryFile" > $stateFile
49+
echo "https://storage.cloud.google.com/$GCP_STORAGE_BUCKET/planet/full-history/$fullHistoryFile" >$stateFile
4450
# Upload to GS
4551
gsutil cp -a public-read $fullHistoryFile $GCP_STORAGE_BUCKET/planet/full-history/$fullHistoryFile
4652
gsutil cp -a public-read $stateFile $GCP_STORAGE_BUCKET/planet/full-history/$stateFile

images/osm-processor/Dockerfile

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:20.04
22
ENV workdir /mnt/data
3+
34
RUN apt-get -y update
4-
RUN apt-get -y install \
5+
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \
56
build-essential \
67
libboost-program-options-dev \
78
libbz2-dev \
@@ -10,14 +11,13 @@ RUN apt-get -y install \
1011
cmake \
1112
pandoc \
1213
git \
13-
python-pip \
14+
python3 \
15+
python3-pip \
1416
curl \
1517
unzip \
1618
wget \
1719
software-properties-common \
18-
python-software-properties \
1920
libz-dev \
20-
zlib1g-dev \
2121
gdal-bin \
2222
tar \
2323
bzip2 \
@@ -27,7 +27,7 @@ RUN apt-get -y install \
2727
gradle \
2828
apt-utils
2929

30-
# Install osmosis
30+
# Install osmosis 0.47
3131
RUN git clone https://github.com/openstreetmap/osmosis.git
3232
WORKDIR osmosis
3333
RUN git checkout 9cfb8a06d9bcc948f34a6c8df31d878903d529fc
@@ -38,22 +38,29 @@ RUN ln -s "$PWD"/dist/bin/osmosis /usr/bin/osmosis
3838
RUN osmosis --version 2>&1 | grep "Osmosis Version"
3939

4040
# Install osmium-tool
41-
RUN git clone https://github.com/mapbox/protozero
42-
RUN cd protozero && git checkout 23d48fd2a441c6e3b2852ff84a0ba398e48f74be && mkdir build && cd build && cmake .. && make && make install
43-
RUN git clone https://github.com/osmcode/libosmium
44-
RUN cd libosmium && git checkout a1f88fe44b01863a1ac84efccff54b98bb2dc886 && mkdir build && cd build && cmake .. && make && make install
45-
RUN git clone https://github.com/osmcode/osmium-tool
46-
RUN cd osmium-tool && git checkout ddbcb44f3ec0c1a8d729e69e3cee40d25f5a00b4 && mkdir build && cd build && cmake .. && make && make install
41+
RUN apt-get -y install \
42+
libbz2-dev \
43+
libgd-dev \
44+
libosmium2-dev \
45+
libprotozero-dev \
46+
libsqlite3-dev \
47+
make \
48+
jq \
49+
ca-certificates
50+
51+
# Other useful packages
52+
RUN apt-get install -y \
53+
osmium-tool \
54+
pyosmium \
55+
rsync \
56+
tmux \
57+
zsh
58+
59+
RUN pip install osmium
4760

4861
# Install AWS and GCP cli
4962
RUN pip install awscli
5063
RUN curl -sSL https://sdk.cloud.google.com | bash
5164
RUN ln -f -s /root/google-cloud-sdk/bin/gsutil /usr/bin/gsutil
5265

53-
# Install postgresql-client
54-
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
55-
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list'
56-
RUN apt-get update
57-
RUN apt-get install -y postgresql-client
58-
5966
WORKDIR $workdir

0 commit comments

Comments
 (0)