210 likes | 281 Views
CampusID. Name. Type. Floors. Footprint. 6. Murphy. Academic. 2. 2001. 9. Hopkins. Support. 2. 946. 12. Maintenance. Support. 1. 1848. 15. Hickey. Support. 2. 2367. 17. Shay-Loughlen. Dorm. 3. 1298. Attribute Data. Why Databases?.
E N D
CampusID Name Type Floors Footprint 6 Murphy Academic 2 2001 9 Hopkins Support 2 946 12 Maintenance Support 1 1848 15 Hickey Support 2 2367 17 Shay-Loughlen Dorm 3 1298 Attribute Data CS 128/ES 228 - Lecture 6a
Why Databases? • One of the advantages of vector-based data is that each datum corresponds to a (portion) of a “real” object. • BUT… Objects are more than geographic locations CS 128/ES 228 - Lecture 6a
CampusID Name Type Floors Footprint 6 Murphy Academic 2 2001 9 Hopkins Support 2 946 12 Maintenance Support 1 1848 15 Hickey Support 2 2367 17 Shay-Loughlen Dorm 3 1298 Database “Review” • Databases consist of tables • Each table holds records • Records are in rows • Each record consists of fields, i.e. individual data items • Fields are in columns • Fields that have unique values within a table are called “keys” CS 128/ES 228 - Lecture 6a
Sequential Databases Once upon a time, computer scientists tried to put all the data for an application in one table It didn’t work CS 128/ES 228 - Lecture 6a
Flaws of Sequential Databases • Not all data is homogeneous • Monolithic structure leads to contention problems • Separation of data into “sub” databases leads to duplication (and inconsistencies) CS 128/ES 228 - Lecture 6a
Relational databases • Use many (related) tables of data, with minimal duplication • Tables are “linked” through common values in particular fields • “Queries” permit rich “data mining” CS 128/ES 228 - Lecture 6a
What Color Hair Does Student 234 Have? This is an example of a JOIN operation CS 128/ES 228 - Lecture 6a
Relational Databases in GIS • One table traditionally holds geographic information • Other tables hold data about other attributes • Tables are linked through “Object Ids” • (Object Ids should be independent of the software) CS 128/ES 228 - Lecture 6a
Relational Databases in GIS • Consider a “Buildings” layer • “GIS” data includes location (including coordinate system), symbology, internal bookkeeping • “External” data includes name of building, date built, purpose, etc. CS 128/ES 228 - Lecture 6a
Sometimes they are mixed CS 128/ES 228 - Lecture 6a
Queries • Information is gained by linking tables through “joins” • Queries can involve computed quantities, etc. CS 128/ES 228 - Lecture 6a
Storing Topology • Shapefiles contain no topological information • But topology is important SOLUTION • Store the topology elsewhere CS 128/ES 228 - Lecture 6a
Practicality • GIS must maintain topology (to be useful) • GIS can’t store topology (in shapefiles) • SO, GIS must compute topology CS 128/ES 228 - Lecture 6a
2 1 B 4 A 10 3 5 9 C 8 D 6 7 Data Structure for Topology Select Boundary Where Zone1=A Ans: 4,5 CS 128/ES 228 - Lecture 6a
C A B Topological Operations • Merge two regions into one …and change the appropriate table CS 128/ES 228 - Lecture 6a
B A C Topological Operations • Split one region into two …and change the appropriate table CS 128/ES 228 - Lecture 6a
Other Topological Operations • Clip an image CS 128/ES 228 - Lecture 6a
Topological Operations • Erase an image CS 128/ES 228 - Lecture 6a
Other operations • Union • Intersect • “Snaps” CS 128/ES 228 - Lecture 6a
How this is used • Find nearest neighbor • Find largest “empty” region CS 128/ES 228 - Lecture 6a
What distinguishes (some) GIS’s • The types of these operations that they can perform. Both Database and Topological CS 128/ES 228 - Lecture 6a