Skip to content

Commit

Permalink
Compliance to PEP8 style guide, typo correction and some revision
Browse files Browse the repository at this point in the history
List of changes:
- Coding revised to fully comply to PEP8 style guide
- A documentation typo has been fixed
- Additional documentation provided
- Some minor code improvements
- Rebased

UNIX compatibility and other improvements

- code compacted and exploiting a dictionary
- added execution flag
- tested with Windows, Ubuntu and Cygwin
- file dates are checked before downloading new files
- curl is used if available
- return codes are checked
- documentation updated
- now update is the default and does not require confirmation
- code improvements

$ ./get-shapefiles.py -h
usage: get-shapefiles1.py [-h] [-c] [-d <directory name>] [-e] [-f] [-l] [-n]
                          [-p] [-r] [-s] [-u] [-1] [-2] [-3] [-4] [-5] [-6]

optional arguments:
  -h, --help            show this help message and exit
  -c, --check           check whether the 'data' directory already exists
  -d <directory name>, --directory <directory name>
                        set the name of the data directory (default: 'data')
  -e, --no-extract      do not populate target directories with the expansion
                        of downloaded data
  -f, --force           force continuing even if project.yaml does not exist
  -l, --no-curl         do not use 'curl' even if available
  -n, --no-download     do not download archive if already existing locally
  -p, --pause           pause before starting
  -r, --remove          remove each downloaded archive after its expansion
  -s, --no-shape        do not run shapeindex
  -u, --update          force downloading files even if not newer than the
                        locally existing ones
  -1, --world-boundaries
                        only process world_boundaries
  -2, --simplified-land
                        only process simplified-land-polygons-complete-3857
  -3, --ne-admin        only process ne_110m_admin_0_boundary_lines_land
  -4, --land-polygons   only process land-polygons-split-3857
  -5, --icesheet-polygons
                        only process antarctica-icesheet-polygons-3857
  -6, --icesheet-outlines
                        only process antarctica-icesheet-outlines-3857

This script generates and populates the 'data' directory with all needed
shapefiles, including indexing them through shapeindex.

git update-index --add --chmod=+x scripts/get-shapefiles.py

Corrected script directory to scripts in INSTALL.md
  • Loading branch information
Ircama committed Sep 8, 2016
1 parent cd2bcb1 commit ca7277f
Show file tree
Hide file tree
Showing 2 changed files with 427 additions and 2 deletions.
42 changes: 40 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,51 @@ psql -d gis -f indexes.sql
Additionally you need some shapefiles.

## Scripted download
To download the shapefiles you can run the following script. No further steps should be needed as the data has been processed and placed in the requisite directories.

To download the shapefiles you can run the following script from this directory. No further steps should be needed as the data has been processed and placed in the requisite directories.
```
scripts/get-shapefiles.py
```

This script generates and populates the *data* directory with all needed
shapefiles, including indexing them through *shapeindex*.

Command-line syntax:
```
./get-shapefiles.sh
usage: get-shapefiles.py [-h] [-c] [-d <directory name>] [-e] [-f] [-l] [-n]
[-p] [-r] [-s] [-u] [-1] [-2] [-3] [-4] [-5] [-6]
optional arguments:
-h, --help show this help message and exit
-c, --check check whether the 'data' directory already exists
-d <directory name>, --directory <directory name>
set the name of the data directory (default: 'data')
-e, --no-extract do not populate target directories with the expansion
of downloaded data
-f, --force force continuing even if project.yaml does not exist
-l, --no-curl do not use 'curl' even if available
-n, --no-download do not download archive if already existing locally
-p, --pause pause before starting
-r, --remove remove each downloaded archive after its expansion
-s, --no-shape do not run shapeindex
-u, --update force downloading files even if not newer than the
locally existing ones
-1, --world-boundaries
only process world_boundaries
-2, --simplified-land
only process simplified-land-polygons-complete-3857
-3, --ne-admin only process ne_110m_admin_0_boundary_lines_land
-4, --land-polygons only process land-polygons-split-3857
-5, --icesheet-polygons
only process antarctica-icesheet-polygons-3857
-6, --icesheet-outlines
only process antarctica-icesheet-outlines-3857
```

The script supports Windows, UNIX, Python 2.7, Python 3 and *curl* when installed (anyway *curl* is not required, for more comfortable Windows support). Installation of *shapeindex* is a prerequisite to index files, but is not strictly required if `-s` option is used.

*get-shapefiles.py* can be run from the *scripts* directory of *openstreetmap-carto*, or from its base folder, or through absolute path from any directory. It allows a default Web proxy and also the configuration of the HTTP_PROXY environment variable. Windows PAC and NTLM authentication are not supported.

## Manual download

You can also download them manually at the following paths:
Expand Down
Loading

0 comments on commit ca7277f

Please sign in to comment.