Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install shape files while building docker #181

Closed
patricerosay opened this issue Apr 28, 2021 · 3 comments
Closed

Can't install shape files while building docker #181

patricerosay opened this issue Apr 28, 2021 · 3 comments

Comments

@patricerosay
Copy link

Hi.
I used to be able to install the docker, but now, I'm running into the following issue:
I'm downloading files from git
I execute the command "make test"

=>There's an error while downloading the file:

http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip

I've tried to upgrade manually the Dockerfile to the newest version openstreetmap-carto 5.3.1 without success so far.

Please advise.
P.

@Istador
Copy link
Contributor

Istador commented Apr 28, 2021

The external URL isn't available anymore and therefore it fails.

The newest carto version 5.3.1 changed the URL to use another source:

But they also renamed the script name that needs to be called with version 5.3.0 from scripts/get-shapefiles.py to scripts/get-external-data.py. So, that needs to be changed in the Dockerfile too:

&& scripts/get-shapefiles.py \

@patricerosay
Copy link
Author

patricerosay commented Apr 30, 2021 via email

@Istador
Copy link
Contributor

Istador commented Apr 30, 2021

Ah, ok, it needs the database running.
Then I'd suggest to not call it inside of the Dockerfile, but in the run.sh somewhere during the import command (probably after the first init block?):

sudo -u postgres createuser renderer
sudo -u postgres createdb -E UTF8 -O renderer gis
sudo -u postgres psql -d gis -c "CREATE EXTENSION postgis;"
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore;"
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
setPostgresPassword
# Download Luxembourg as sample if no data is provided
if [ ! -f /data.osm.pbf ] && [ -z "$DOWNLOAD_PBF" ]; then
echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..."
DOWNLOAD_PBF="https://download.geofabrik.de/europe/luxembourg-latest.osm.pbf"
DOWNLOAD_POLY="https://download.geofabrik.de/europe/luxembourg.poly"
fi
if [ -n "$DOWNLOAD_PBF" ]; then
echo "INFO: Download PBF file: $DOWNLOAD_PBF"
wget "$WGET_ARGS" "$DOWNLOAD_PBF" -O /data.osm.pbf
if [ -n "$DOWNLOAD_POLY" ]; then
echo "INFO: Download PBF-POLY file: $DOWNLOAD_POLY"
wget "$WGET_ARGS" "$DOWNLOAD_POLY" -O /data.poly
fi
fi
if [ "$UPDATES" = "enabled" ]; then
# determine and set osmosis_replication_timestamp (for consecutive updates)
osmium fileinfo /data.osm.pbf > /var/lib/mod_tile/data.osm.pbf.info
osmium fileinfo /data.osm.pbf | grep 'osmosis_replication_timestamp=' | cut -b35-44 > /var/lib/mod_tile/replication_timestamp.txt
REPLICATION_TIMESTAMP=$(cat /var/lib/mod_tile/replication_timestamp.txt)
# initial setup of osmosis workspace (for consecutive updates)
sudo -u renderer openstreetmap-tiles-update-expire $REPLICATION_TIMESTAMP
fi
# copy polygon file if available
if [ -f /data.poly ]; then
sudo -u renderer cp /data.poly /var/lib/mod_tile/data.poly
fi
# Import data
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf ${OSM2PGSQL_EXTRA_ARGS}
# Create indexes
sudo -u postgres psql -d gis -f indexes.sql
# Register that data has changed for mod_tile caching purposes
touch /var/lib/mod_tile/planet-import-complete

When you get it to work again with the new version, you can send in a pull request with your changes. @Overv will probably be happy to merge the fix.


There is already pull request #176 that tries to update carto to 5.3.1. But if the get-external-data.py needs access to the running database, then the PR should not work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants