tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.1k stars 527 forks source link

New utility scripts for installation and running for Issue #2667 #2670

Closed tpotter7 closed 5 years ago

tpotter7 commented 5 years ago

For issue #2667, added utility scripts to install tilemill and the OSM DB. Added utility script to load OSM files into the DB. Added utility scripts to run tilemill. Cleaned up README, CONTRIBUTING, and updated CHANGELOG.

csytsma commented 5 years ago

Error when running 'loadosm.sh kansas'. Doesn't appear to correctly create data directory:

csytsma@Corys-MacBook-Pro-5874 ~/Development/tilemill/utils $ ./loadosm.sh kansas
./loadosm.sh: Starting...
----------------------------------------------------------------------
./loadosm.sh: Creating /Users/csytsma/Documents/MapBox/data/osm directory...
----------------------------------------------------------------------
Error: Expected /Users/csytsma/Documents/MapBox directory to exist.
csytsma commented 5 years ago

The ../tilemill/utils directory shouldn't be an absolute reference in the script, as we don't know where users will clone the repo. I'd make it relative to running the script.

csytsma commented 5 years ago

Using loadosm.sh failed, couldn't find default.style file.

Osm2pgsql failed due to ERROR: Couldn't open style file '/GoogleDrive/MapBox/tilemill/utils/default.style': No such file or directory
Error: Load of OSM data into database failed. Command: osm2pgsql --create --multi-geometry --database osm --username csytsma --style /GoogleDrive/MapBox/tilemill/utils/default.style --hstore /GoogleDrive/MapBox/data/osm/kansas-latest.osm.bz2

Perhaps if the install script is used it will find the 'default.style' file?

I'd suggest that the defaults set at the beginning of the script be set in the .tilemill/config.json file. That way if the user changes the defaults, they won't be overridden when they download the next TileMill upgrade.

csytsma commented 5 years ago

Using loadosm.sh failed, due to using hstore with osm2pgsql

osm2pgsql version 0.94.0 (64 bit id space)
Using built-in tag processing pipeline
Using projection SRS 3857 (Spherical Mercator)
Setting up table: planet_osm_point
Osm2pgsql failed due to ERROR: CREATE UNLOGGED TABLE planet_osm_point (osm_id ....
...
hstore,way geometry(POINT,3857) ) WITH ( autovacuum_enabled = FALSE ) failed: ERROR:  type "hstore" does not exist
LINE 1: ...,"wetland" text,"wood" text,"z_order" int4,"tags" hstore,way...
                                                             ^

Error: Load of OSM data into database failed. Command: osm2pgsql --create --multi-geometry --database osm --username csytsma --style /GoogleDrive/MapData/OSM/default.style --hstore /GoogleDrive/MapData/data/osm/kansas-latest.osm.bz2
csytsma commented 5 years ago

I'd suggest renaming 'runtilemill.sh' to just 'tilemill.sh', which makes more sense for people wanting to run TileMill.

tpotter7 commented 5 years ago

Fixed the directory in loadosm.sh to use the config.json root if available or to use the default if not. Also made it properly handle spaces in the directory path. Removed use of UTILS_DIR in scripts where it was not needed and made it relative elsewhere. Changed the loadosm.sh to put a copy of defaults.style into the osm data dir (if not there) and then to use that one in case you have customized it. hstore should be OK to use since it is installed by the installdb.sh script. changed the name of runtilemill.sh to tilemill.sh and moved it to the root.