stamen / terrain-classic

World-wide CartoCSS port of Stamen's classic terrain style
ISC License
144 stars 35 forks source link

clean up natural earth database import steps #33

Closed almccon closed 8 years ago

almccon commented 8 years ago

I added code in https://github.com/stamen/terrain-classic/blob/master/Makefile#L266-L281 to load Natural Earth shapefiles into the database, but it needs more rewriting: currently if you already have the NE shapefiles downloaded the Makefile thinks there is nothing to do.

This error occurs if you're trying to set up a new database extract, but you already have NE downloaded for a previous extract.

The makefile needs to test for existence of the db tables, not just the existence of the shapefiles.

almccon commented 8 years ago

The error might also manifest like this:

unzip -ju data/osmdata/water_polygons.zip -d $(dirname shp/osmdata/water_polygons.shp)
Archive:  data/osmdata/water_polygons.zip
ogr2ogr --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config SHAPE_ENCODING WINDOWS-1252 -t_srs EPSG:3857 -lco ENCODING=UTF-8 -clipsrc -180 -85.05112878 180 85.05112878 -segmentize 1 -skipfailures shp/natural_earth/ne_10m_admin_1_states_provinces_scale_rank-merc.shp /vsizip/data/ne-stamen/10m/cultural/ne_10m_admin_1_states_provinces_scale_rank.zip/ne_10m_admin_1_states_provinces_scale_rank/ne_10m_admin_1_states_provinces_scale_rank.shp
ERROR 1: shp/natural_earth/ne_10m_admin_1_states_provinces_scale_rank-merc.shp is not a directory.

ESRI Shapefile driver failed to create shp/natural_earth/ne_10m_admin_1_states_provinces_scale_rank-merc.shp
make: *** [shp/natural_earth/ne_10m_admin_1_states_provinces_scale_rank-merc.shp] Error 1

In this case, the shapefile is already unzipped (in shp/natural_earth/ne_10m_admin_1_states_provinces_scale_rank-merc.shp), but the Makefile thinks it needs to unzip it again. It throws an error because the file already exists.

almccon commented 8 years ago

bcf39ac takes care of the error message above, but doesn't solve the deeper issue...

almccon commented 8 years ago

2a578e6 should do it.