137 lines
4.2 KiB
Cheetah
137 lines
4.2 KiB
Cheetah
################################################################################
|
|
### Importing OSM data from shape files (1 / 11)
|
|
################################################################################
|
|
### Description:
|
|
### - This script creates, opens and initializes a database intended for data
|
|
### from shape-files. The actual data import takes place in another Secondo-
|
|
### script. In the script at hand various help variables are set enabling an
|
|
### optional limitation of the region of interest.
|
|
### Please, see tu_shp_import.sh for further details.
|
|
###
|
|
### Preconditions:
|
|
### - none
|
|
###
|
|
### Postconditions:
|
|
### - existing open database with some specifications on the corresponding City
|
|
###
|
|
### Author:
|
|
### - Thomas Uchdorf, thomas.uchdorf(at)fernuni-hagen.de
|
|
################################################################################
|
|
|
|
# Creating and opening a new database
|
|
create database <name><part>;
|
|
open database <name><part>;
|
|
|
|
# Changing the scaling applied to all coordinates during import
|
|
query setscalefactorx(1000);
|
|
query setscalefactory(1000);
|
|
|
|
# Setting the path to the directory with the shape data:
|
|
let SRC_DIR_PATH =
|
|
'<src_dir_path>';
|
|
let PART =
|
|
'<part>';
|
|
let SCALE_FACTOR_X =
|
|
getscalefactorx();
|
|
let SCALE_FACTOR_Y =
|
|
getscalefactory();
|
|
|
|
|
|
# Defining the clipping rectangle used to restrict the data to the City area
|
|
let CityRect =
|
|
rectangle2 (
|
|
(<Min_lon> * SCALE_FACTOR_X),
|
|
(<Max_lon> * SCALE_FACTOR_X),
|
|
(<Min_lat> * SCALE_FACTOR_Y),
|
|
(<Max_lat> * SCALE_FACTOR_Y));
|
|
|
|
# Dividing the main City rectangle into 9 parts for each orientation
|
|
let DistrictWidth =
|
|
(maxD(CityRect,1) - minD(CityRect,1)) / 3;
|
|
let DistrictHeight =
|
|
(maxD(CityRect,2) - minD(CityRect,2)) / 3;
|
|
# north-west
|
|
let NwRect =
|
|
rectangle2(
|
|
minD(CityRect,1),
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight),
|
|
maxD(CityRect,2));
|
|
# west
|
|
let WRect =
|
|
rectangle2(
|
|
minD(CityRect,1),
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,2) + DistrictHeight),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight));
|
|
# south-west
|
|
let SwRect =
|
|
rectangle2(
|
|
minD(CityRect,1),
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,2)),
|
|
(minD(CityRect,2) + DistrictHeight));
|
|
# north-east
|
|
let NeRect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
maxD(CityRect,1),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight),
|
|
maxD(CityRect,2));
|
|
# east
|
|
let ERect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
maxD(CityRect,1),
|
|
(minD(CityRect,2) + DistrictHeight),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight));
|
|
# south-east
|
|
let SeRect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
maxD(CityRect,1),
|
|
(minD(CityRect,2)),
|
|
(minD(CityRect,2) + DistrictHeight));
|
|
# north
|
|
let NRect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight),
|
|
maxD(CityRect,2));
|
|
# center
|
|
let CRect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
(minD(CityRect,2) + DistrictHeight),
|
|
(minD(CityRect,2) + DistrictHeight + DistrictHeight));
|
|
# south
|
|
let SRect =
|
|
rectangle2(
|
|
(minD(CityRect,1) + DistrictWidth),
|
|
(minD(CityRect,1) + DistrictWidth + DistrictWidth),
|
|
(minD(CityRect,2)),
|
|
(minD(CityRect,2) + DistrictHeight));
|
|
|
|
# Limiting the region of interest if desired
|
|
let PartRect =
|
|
ifthenelse(PART = 'NW',
|
|
NwRect,
|
|
ifthenelse(PART = 'W',
|
|
WRect,
|
|
ifthenelse(PART = 'SW',
|
|
SwRect,
|
|
ifthenelse(PART = 'NE',
|
|
NeRect,
|
|
ifthenelse(PART = 'E',
|
|
ERect,
|
|
ifthenelse(PART = 'SE',
|
|
SeRect,
|
|
ifthenelse(PART = 'N',
|
|
NRect,
|
|
ifthenelse(PART = 'C',
|
|
CRect,
|
|
ifthenelse(PART = 'S',
|
|
SRect,CityRect)))))))));
|