[GRASS-user] Slow import of GHSL
Nikos Alexandris
nik at nikosalexandris.net
Tue Mar 14 08:43:31 PDT 2017
[all deleted]
Here's a non-elegant way, derived out of tests. Maybe a starter for the
Wiki. Elegant would be scripted, no need to manually enter any GRASS
session.
```
# Get Eurostat's NUTS_2013_01M_SH.zip vector map
unzip NUTS_2013_01M_SH.zip && cd NUTS_2013_01M_SH/data/
grass73 -c NUTS_2013_01M_SH.shp /geo/grassdb/europe/etrs89
v.import in=NUTS_RG_01M_2013.shp out=NUTS_RG_01M_2013
# draw, view, pick & set computational region of interest, create a vector map
v.in.region out=europe_less_box
# Clip original VRT to Europe’s extent, output as VRT
# and successively add overviews !Adding overviews takes time!
# 1990
gdal_translate -projwin -3480828.507849 11465936.382472 4989400.357796 3203413.703282 GHS_BUILT_LDS1990_GLOBE_R2016A_3857_38_v1_0.vrt GHS_BUILT_LDS1990_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt -of VRT
gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE GHS_BUILT_LDS1990_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt 2 4 8 16
# 2000
gdal_translate -projwin -3480828.507849 11465936.382472 4989400.357796 3203413.703282 GHS_BUILT_LDS2000_GLOBE_R2016A_3857_38_v1_0.vrt GHS_BUILT_LDS2000_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt -of VRT
gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE GHS_BUILT_LDS2000_GLOBE_R2016A_3857_38_v1_0_Europe.tif 2 4 8 16
# 2014
gdal_translate -projwin -3480828.507849 11465936.382472 4989400.357796 3203413.703282 GHS_BUILT_LDS2014_GLOBE_R2016A_3857_38_v1_0.vrt GHS_BUILT_LDS2014_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt -of VRT
gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE GHS_BUILT_LDS2014_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt 2 4 8 16
# Create 'epsg:3857' location for the 1990 data, set region &
# work this in three different terminals
# resolution (v.proj-ing existing "box" map), import raster
grass72 -c "epsg:3857" /geo/grassdb/global/wgs84_3857_1990
v.proj dbase=/geo/grassdb/europe/ location=etrs89 mapset=PERMANENT in=europe_less_box out=europe_less_box
g.region -p vect=europe_less_box_epsg_3857 ewres=38.218470987084757 nsres=38.218446797782505
r.import input=GHS_BUILT_LDS1990_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt out=GHS_BUILT_LDS1990_GLOBE_R2016A_3857_38_v1_0_Europe_Less memory=2047 extent=region
# Repeat for 2000
grass72 -c "epsg:3857" /geo/grassdb/global/wgs84_3857_2000
v.proj dbase=/geo/grassdb/europe/ location=etrs89 mapset=PERMANENT in=europe_less_box out=europe_less_box
g.region -p vect=europe_less_box_epsg_3857 ewres=38.218470987084757 nsres=38.218446797782505
r.import input=GHS_BUILT_LDS2000_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt out=GHS_BUILT_LDS2000_GLOBE_R2016A_3857_38_v1_0_Europe_Less memory=2047 extent=region
# Repeat for 2014
grass72 -c "epsg:3857" /geo/grassdb/global/wgs84_3857_2014
v.proj dbase=/geo/grassdb/europe/ location=etrs89 mapset=PERMANENT in=europe_less_box out=europe_less_box
g.region -p vect=europe_less_box_epsg_3857 ewres=38.218470987084757 nsres=38.218446797782505
r.import input=GHS_BUILT_LDS2014_GLOBE_R2016A_3857_38_v1_0_Europe_Less.vrt out=GHS_BUILT_LDS2014_GLOBE_R2016A_3857_38_v1_0_Europe_Less memory=2047 extent=region
```
Nikos
More information about the grass-user
mailing list