Docsity

Assignment 1: Spatial Data - Warm-Up | ECS 266, Assignments of Computer Science

Toggle sidebar
bg1
ECS 266 Spatial Databases Spring 2008
Dr. Michael Gertz April 9
Assignment 1: Spatial Data – Warm-up
Due: Friday, April 18, 3:50PM, 3029 Kemper Hall or in class or
electronically via email to [email protected]
1. Spatial data in a RDBMS (10 Points)
Assume that you are left with nothing more than a relational database management system (RDBMS) somebody
has used to model some geospatial data. The relational database schema you have to work with manages
information about countries and their boundaries. There are the following three relations:
Country
name capital population id-boundary
France Paris 60.7 b1
Spain Madrid 40.3 b2
... ... ... ...
Boundary
id-boundary start-point end-point segment-num
b1 p2 p3 2
b1 p1 p2 1
b1 p3 p4 3
b1 ... ... ...
b2 p1 p6 1
b2 p6 p8 2
b2 ... ... ...
Point
point-id x y
p1 100 200
p2 342 256
p3 567 421
... ... ...
The boundary of a country is described by a sequence of line seqments. A line segment is described by a start
point, an end point, and the number the line has in describing the boundary of the country. We assume that the
coordinates of points are given in quadrant I of the 2D Cartesian coordinate system.
We also assume that somebody has specified an integrity constraint (e.g., as trigger) that ensures that the region
specified for a country is a simple polygon. However, there is no assurance that the regions associated with two
countries do not intersect (neighboring countries are allowed to “share” points in describing line segments of
their boundaries).
Give a single SQL query that determines pairs of countries (names) whose boundaries intersect. You can
assume the SQL standard, in particular nested sub-queries. If no such SQL query is possible, then give an
elaborate explanation why the query cannot be formulated. If you are able to come up with a query, briefly
explain how the query is structured and what conditions you check.
pf2

Partial preview of the text

Download Assignment 1: Spatial Data - Warm-Up | ECS 266 and more Assignments Computer Science in PDF only on Docsity!

ECS 266 Spatial Databases Spring 2008 Dr. Michael Gertz April 9

Assignment 1: Spatial Data – Warm-up

Due: Friday, April 18, 3:50PM, 3029 Kemper Hall or in class or electronically via email to [email protected]

  1. Spatial data in a RDBMS (10 Points)

Assume that you are left with nothing more than a relational database management system (RDBMS) somebody has used to model some geospatial data. The relational database schema you have to work with manages information about countries and their boundaries. There are the following three relations:

Country

name capital population id-boundary France Paris 60.7 b Spain Madrid 40.3 b

............

Boundary

id-boundary start-point end-point segment-num b1 p2 p3 2 b1 p1 p2 1 b1 p3 p4 3 b......... b2 p1 p6 1 b2 p6 p8 2 b.........

Point point-id x y p1 100 200 p2 342 256 p3 567 421

.........

The boundary of a country is described by a sequence of line seqments. A line segment is described by a start point, an end point, and the number the line has in describing the boundary of the country. We assume that the coordinates of points are given in quadrant I of the 2D Cartesian coordinate system.

We also assume that somebody has specified an integrity constraint (e.g., as trigger) that ensures that the region specified for a country is a simple polygon. However, there is no assurance that the regions associated with two countries do not intersect (neighboring countries are allowed to “share” points in describing line segments of their boundaries).

Give a single SQL query that determines pairs of countries (names) whose boundaries intersect. You can assume the SQL standard, in particular nested sub-queries. If no such SQL query is possible, then give an elaborate explanation why the query cannot be formulated. If you are able to come up with a query, briefly explain how the query is structured and what conditions you check.

  1. Modeling an Octahedron (3+8+3=14 Points)

Assume you have to implement a spatial ADT to represent an octahedron in the 3-dimensional space. Roughly speaking, an octahedron consists of two square pyramids glued together at their bottom. In total, an octahedron has 12 edges, 6 vertices, and 8 faces (which are triangles), see also the figure below.

Figure 1: Octahedron

It is your task to describe the basic components of an abstract data type to represent octahedron objects in 3-dimensional space.

  1. Outline what underlying space concepts you plan to employ and what type of coordinate system you want to use.
  2. Describe a storage efficient structure to represent an octahedron at the spatial model level. You can assume that at least points in 3-dimensional space are provided (in the space model you chose in 1.). If necessary, construct other structures to make up an octahedron accordingly. You can use a notation similar to the structure notation given in class (handouts pages 22, 28, and 30). Briefly explain the components of your structure, assumptions about the ordering of elements in lists (if used) etc.
  3. Using pseudo-code and the structure you developed in 2.), describe how you would implement an oper- ation that computes the volume of an octahedron.