1
0
Fork 0

Merge branch 'master' of mapserver.flightgear.org:git/terragear-cs

This commit is contained in:
Martin Spott 2011-02-03 08:36:11 +01:00
commit 43c9b8c3d5
5 changed files with 32 additions and 19 deletions

View file

@ -40,11 +40,17 @@ MODE="testing" # production, testing
InitCutoutTable () {
${PSQL} "DROP TABLE ${CUTLAYER}"
${PSQL} "DELETE FROM geometry_columns WHERE f_table_name LIKE '${CUTLAYER}'"
# ${PSQL} "CREATE TABLE ${CUTLAYER} (ogc_fid serial NOT NULL, \
# wkb_geometry geometry, \
# CONSTRAINT enforce_dims_wkb_geometry CHECK (ndims(wkb_geometry) = 2), \
# CONSTRAINT enforce_geotype_wkb_geometry CHECK ((geometrytype(wkb_geometry) = 'POLYGON'::text) \
# OR (geometrytype(wkb_geometry) = 'MULTIPOLYGON'::text)), \
# CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = 4326) \
# )"
${PSQL} "CREATE TABLE ${CUTLAYER} (ogc_fid serial NOT NULL, \
wkb_geometry geometry, \
CONSTRAINT enforce_dims_wkb_geometry CHECK (ndims(wkb_geometry) = 2), \
CONSTRAINT enforce_geotype_wkb_geometry CHECK ((geometrytype(wkb_geometry) = 'POLYGON'::text) \
OR (geometrytype(wkb_geometry) = 'MULTIPOLYGON'::text)), \
CONSTRAINT enforce_geotype_wkb_geometry CHECK (geometrytype(wkb_geometry) = 'POLYGON'::text), \
CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = 4326) \
)"
${PSQL} "INSERT INTO geometry_columns (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, type) \

View file

@ -44,7 +44,8 @@ case ${MODE} in
shp)
# Local, pre-intersected Shapefiles
DSN=${HOME}/live/corine
PREFIX=nl_
# PREFIX=nl_
PREFIX=clc00_
SELECTION=${DSN}/${PREFIX}c[0-9][0-9][0-9].shp
SNAP=1
SPAT=""
@ -52,12 +53,15 @@ case ${MODE} in
ldb)
# Landcover-DB
DSN="PG:host=${PGHOST} user=${PGUSER} dbname=${PGDATABASE}"
PREFIX=clc_
# Unsafe because "_" matches any single character in LIKE.
# SELECTION=`${PSQL} "SELECT f_table_name FROM geometry_columns WHERE f_table_name LIKE '${PREFIX}%' AND type LIKE 'POLYGON' ORDER BY f_table_name"`
SELECTION=`psql -tA -c "\dt" | awk -F\| '{print $2}' | grep \^${PREFIX}`
SNAP=0.00001
SPAT="spatial=2.8,49.8,8.2,54.2" # spatial=-123,37,-121,38 # spatial=3,50,8,54
# PREFIX=clc_
PREFIX=cs_
# Maybe unsafe because "_" matches any single character in LIKE;
# escape understores.
SELECTION=`${PSQL} "SELECT f_table_name FROM geometry_columns WHERE f_table_name LIKE '$(echo ${PREFIX} | sed -e 's/_/\\_/g')%' AND type LIKE 'POLYGON' ORDER BY f_table_name"`
# SELECTION=`psql -tA -c "\dt" | awk -F\| '{print $2}' | grep \^${PREFIX}`
SNAP=0.0003 # Fits nicely with VMap0, consider SNAP=0.00001 for accurate data
# SPAT="spatial=2.8,49.8,8.2,54.2" # spatial=-123,37,-121,38 # spatial=3,50,8,54
SPAT=""
;;
esac
#

View file

@ -23,7 +23,8 @@
# $MODE-values for the "case" clause, like 'grass03patch.sh_shp'
MODE=`basename ${0} | cut -f 2 -d \_`
#
PATCHMAP=clc00_nl
#PATCHMAP=clc00_nl
PATCHMAP=clc00
case ${MODE} in
shp)

View file

@ -26,14 +26,15 @@ COMMAND=`basename ${0} | cut -f 1 -d \_`
MODE=`basename ${0} | cut -f 2 -d \_`
RUN=`basename ${0} | cut -f 3 -d \_`
PATCHMAP=clc00_nl
#PATCHMAP=clc00_nl
PATCHMAP=clc00
case ${MODE} in
shp)
SNAP=1
;;
ldb)
SNAP=0.00001
SNAP=0.0003 # SNAP=0.00001
;;
esac
#
@ -42,13 +43,14 @@ MIN_AREA=10
case ${RUN} in
first)
v.clean input=${PATCHMAP} output=${PATCHMAP}_clean tool=snap,bpol,rmdupl,rmline,break,rmdupl,rmdangle,rmarea thresh=${SNAP},0,0,0,0,0,0,${MIN_AREA} type=boundary --verbose
v.dissolve input=${PATCHMAP}_clean output=${PATCHMAP}_dissolved
;;
second)
v.clean input=${PATCHMAP}_clean output=${PATCHMAP}_clobber tool=break,rmdupl,rmdangle type=boundary --verbose
v.clean input=${PATCHMAP}_dissolved output=${PATCHMAP}_clobber tool=break,rmdupl,rmdangle type=boundary --verbose
;;
loop)
g.remove vect=${PATCHMAP}_clean
g.rename vect=${PATCHMAP}_clobber,${PATCHMAP}_clean
g.remove vect=${PATCHMAP}_dissolved
g.rename vect=${PATCHMAP}_clobber,${PATCHMAP}_dissolved
${COMMAND}_${MODE}_second
;;
esac

View file

@ -31,8 +31,9 @@ cd ${RUNDIR}
#
MAPPINGFILE=${BASEDIR}/CORINEtoCStest.txt
CLEANMAP=clc00_nl_clobber
EXTRACTPREFIX=clc00_nl_
#EXTRACTPREFIX=clc00_nl_
EXTRACTPREFIX=clc00_
CLEANMAP=${EXTRACTPREFIX}clobber
case ${MODE} in
shp)
@ -49,8 +50,7 @@ SELECTION=`v.category input=${CLEANMAP} type=centroid option=print | sort -n | u
for CATEGORY in ${SELECTION}; do
LAYER=`grep \^${CATEGORY} ${MAPPINGFILE} | awk '{print $2}' | sed -e "s/^cs_/${EXTRACTPREFIX}/g"`
v.extract list=${CATEGORY} input=${CLEANMAP} output=${EXTRACTPREFIX}${CATEGORY} type=area
v.dissolve input=${EXTRACTPREFIX}${CATEGORY} output=${EXTRACTPREFIX}${CATEGORY}_dissolved
v.out.ogr input=${EXTRACTPREFIX}${CATEGORY}_dissolved dsn=${DUMPDIR}/${LAYER}.shp
v.out.ogr input=${EXTRACTPREFIX}${CATEGORY} dsn=${DUMPDIR}/${LAYER}.shp
done
# EOF