intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Pro Oracle Spatial for Oracle Database 11g P1

Chia sẻ: Vong Phat | Ngày: | Loại File: PDF | Số trang:40

108
lượt xem
14
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Organizations are discovering with increasing frequency that the vast majority of their information assets have a spatial component, for example, the location of customers, shipments, facilities, personnel, competitors, and so on. The ability to use this information properly is fundamental to reducing operational costs, optimizing production efficiency, and increasing the quality of service. Evidence of the benefits that can be achieved by exploiting spatial information is plentiful, and many organizations are looking at ways of harvesting these benefits....

Chủ đề:
Lưu

Nội dung Text: Pro Oracle Spatial for Oracle Database 11g P1

  1. Pro Oracle Spatial for Oracle Database 11g Ravi Kothuri, Albert Godfrind, and Euro Beinat
  2. Pro Oracle Spatial for Oracle Database 11g Copyright © 2007 by Ravi Kothuri, Albert Godfrind, Euro Beinat All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13: 978-1-59059-899-3 ISBN-10: 1-59059-899-7 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Jonathan Gennick Technical Reviewer: Carel-Jan Engel Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Ben Renow- Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Kylie Johnston Copy Editor: Kim Wimpsett Assistant Production Director: Kari Brooks-Copony Production Editor: Ellie Fountain Compositor: Kinetic Publishing Services, LLC Proofreader: Linda Seifert Indexer: Broccoli Information Management Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precau- tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com in the Source Code/Download section.
  3. Contents at a Glance About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv Setting Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi PART 1 ■■■ Overview ■CHAPTER 1 Spatial Information Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 ■CHAPTER 2 Overview of Oracle Spatial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 ■CHAPTER 3 Location-Enabling Your Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 PART 2 ■■■ Basic Spatial ■CHAPTER 4 The SDO_GEOMETRY Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 ■CHAPTER 5 Loading, Transporting, and Validating Spatial Data. . . . . . . . . . . . . . . . . . . 115 ■CHAPTER 6 Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 ■CHAPTER 7 Manipulating SDO_GEOMETRY in Application Programs . . . . . . . . . . . . . . 207 PART 3 ■■■ Spatial and Network Analysis ■CHAPTER 8 Spatial Indexes and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 ■CHAPTER 9 Geometry Processing Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 ■CHAPTER 10 Network Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 ■CHAPTER 11 The Routing Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 PART 4 ■■■ Visualization ■CHAPTER 12 Defining Maps Using MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 ■CHAPTER 13 Using Maps in Your Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 iii
  4. PART 5 ■■■ Spatial in Applications ■CHAPTER 14 Sample Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 ■CHAPTER 15 Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 ■CHAPTER 16 Tips, Common Mistakes, and Common Errors . . . . . . . . . . . . . . . . . . . . . . . 663 PART 6 ■■■ Appendixes ■APPENDIX A Additional Spatial Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 ■APPENDIX B Linear Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 ■APPENDIX C Topology Data Model in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 ■APPENDIX D Storing Raster Data in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 ■APPENDIX E Three-Dimensional Modeling Using Point Clouds and TINs in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 ■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
  5. Contents About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv Setting Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi PART 1 ■■■ Overview ■CHAPTER 1 Spatial Information Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Using Spatial Information in Various Industries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Sources of Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Managing and Analyzing Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Storing Spatial Data in a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Spatial Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Benefits of Oracle Spatial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 ■CHAPTER 2 Overview of Oracle Spatial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Technology and Architecture Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Getting Started with Oracle Spatial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Data Model: Storing Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Location-Enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Query and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Visualizing Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Advanced Spatial Engine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Oracle Spatial Technology Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Locator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Spatial Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 What to Expect in an Oracle Spatial Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Installing Oracle Spatial in the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Upgrades. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Understanding a Spatial Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Checking the Version of a Spatial Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 v
  6. vi ■CONTENTS ■CHAPTER 3 Location-Enabling Your Applications . . . . . . . . . . . . . . . . . . . . . . . . . 37 Adding Location Information to Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Application-Specific Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Geographic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Metadata for Spatial Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Dictionary View for Spatial Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Populating Spatial Metadata for Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Additional Information for Visualization and Network Analysis . . . . . . . . . . 50 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 PART 2 ■■■ Basic Spatial ■CHAPTER 4 The SDO_GEOMETRY Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Types of Spatial Geometries in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Line Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Polygons and Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Solids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Logical Implementation of SDO_GEOMETRY . . . . . . . . . . . . . . . . . . . . . . . . 58 Spatial Data in SQL/MM and OGC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 SDO_GEOMETRY Type, Attributes, and Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 SDO_GTYPE Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 SDO_SRID Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 SDO_POINT Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 SDO_ELEM_INFO and SDO_ORDINATES Attributes . . . . . . . . . . . . . . . . . . . 74 Simple Two-Dimensional Geometry Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Line String: Connected by Straight Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Line String: Connected by Arcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Polygon: Ring (Boundary) Connected by Straight Lines . . . . . . . . . . . . . . . . 80 Polygon: Ring (Boundary) Connected by Arcs . . . . . . . . . . . . . . . . . . . . . . . . 82 Rectangle Polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Circle Polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Complex Two-Dimensional Geometry Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Constructing Complex Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 SDO_ELEM_INFO for Compound Elements . . . . . . . . . . . . . . . . . . . . . . . . . . 86 SDO_ELEM_INFO for Voided Polygon Element . . . . . . . . . . . . . . . . . . . . . . . 87 Compound Line String Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Compound Polygon Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Polygon with a Void . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
  7. ■CONTENTS vii Three-Dimensional Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Three-Dimensional Points, Lines, and Polygons . . . . . . . . . . . . . . . . . . . . . . 97 Composite Surfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Simple Solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Composite Solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 ■CHAPTER 5 Loading, Transporting, and Validating Spatial Data . . . . . . . . 115 Inserting Data into an SDO_GEOMETRY Column . . . . . . . . . . . . . . . . . . . . . . . . . 116 Loading and Converting Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Loading from Text Files Using SQL*Loader . . . . . . . . . . . . . . . . . . . . . . . . . 117 Transporting Spatial Data Between Oracle Databases. . . . . . . . . . . . . . . . 120 Loading from External Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Converting Between SDO_GEOMETRY and WKT/WKB . . . . . . . . . . . . . . . . 124 Converting SDO_GEOMETRY Data in GML . . . . . . . . . . . . . . . . . . . . . . . . . 124 Extruding a Two-Dimensional Geometry to Three Dimensions . . . . . . . . . . . . . . 129 Validating Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Validation Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Validation Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Composite Solids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Debugging Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 REMOVE_DUPLICATE_VERTICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 EXTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 APPEND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 GETNUMELEM, GETNUMVERTICES, and GETVERTICES . . . . . . . . . . . . . . . 147 EXTRACT3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Miscellaneous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 ■CHAPTER 6 Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 What Is Geocoding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Architecture of the Oracle Geocoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Parsing the Input Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Searching for the Address. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Computing the Spatial Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Setting Up the Reference Data for the Geocoder . . . . . . . . . . . . . . . . . . . . . . . . . 156 Parameter Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Data Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
  8. viii ■CONTENTS Using Geocoder Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 GEOCODE_AS_GEOMETRY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 GEOCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 GEOCODE_ALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Geocoding Using Structured Addresses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 GEOCODE_ADDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 GEOCODE_ADDR_ALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Reverse Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 REVERSE_GEOCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Geocoding Business Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Adding the Spatial Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Geocoding the Addresses: The “Naive” Approach . . . . . . . . . . . . . . . . . . . 187 Address Verification and Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Automatic Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 The Geocoding Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Installation and Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Using the Geocoder: XML Queries and Responses. . . . . . . . . . . . . . . . . . . 200 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 ■CHAPTER 7 Manipulating SDO_GEOMETRY in Application Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Manipulating Geometries Using PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 VARRAY Manipulation Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Reading and Writing SDO_GEOMETRY Objects . . . . . . . . . . . . . . . . . . . . . 215 Creating New Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Extracting Information from Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Modifying Existing Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Manipulating Geometries in Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Using the JGeometry Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Using 3D Geometries: the J3D_Geometry Class . . . . . . . . . . . . . . . . . . . . 229 Extracting Elements from 3D Geometries: the ElementExtractor Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Using Standard Notations: WKT, WKB, GML . . . . . . . . . . . . . . . . . . . . . . . . 232 Using ESRI Shapefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
  9. ■CONTENTS ix PART 3 ■■■ Spatial and Network Analysis ■CHAPTER 8 Spatial Indexes and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Spatial Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Inserting Metadata for a Spatial Layer Prior to Indexing . . . . . . . . . . . . . . 246 Creating a Spatial Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Spatial Indexing Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Spatial Index Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Syntax of Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Semantics of Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Evaluation of Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 A Closer Look at Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 SDO_WITHIN_DISTANCE Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 SDO_NN Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Operators for Spatial Interactions (Relationships) . . . . . . . . . . . . . . . . . . . 268 Hints for Spatial Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 Advanced Spatial Index Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 Function-Based Spatial Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 Local Partitioned Spatial Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Parallel Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Online Index Rebuilds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 Spatial Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Three-Dimensional Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 ■CHAPTER 9 Geometry Processing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Buffering Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Relationship Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 SDO_DISTANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 SDO_CLOSEST_POINTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 RELATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 Geometry Combination Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 SDO_INTERSECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 SDO_UNION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 SDO_DIFFERENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 SDO_XOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Geometric Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 Area, Length, and Volume Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 MBR Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 Miscellaneous Geometric Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . 333
  10. x ■CONTENTS Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Aggregate MBR Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Other Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 ■CHAPTER 10 Network Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 General Network Modeling Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Examples of Networks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 Oracle Network Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Data Structures: The Network Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Node Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Link Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Path Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Path Link Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 Network Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 Defining Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 “Automatic” Network Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 “Manual” Network Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Defining Multiple Networks on the Same Tables . . . . . . . . . . . . . . . . . . . . 359 Dropping a Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Creating Spatial Indexes on Network Tables . . . . . . . . . . . . . . . . . . . . . . . . 363 Getting Information About a Network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Verifying Network Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Example Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Analyzing and Managing Networks Using the Java API . . . . . . . . . . . . . . . . . . . . 370 Analyzing Networks: The NetworkManager Class . . . . . . . . . . . . . . . . . . . 370 Limiting the Search Space: The SystemConstraint Class . . . . . . . . . . . . . 384 Advanced Analysis: Network Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Network Structures: The Network, Node, Link, and Path Classes. . . . . . . 391 Creating Networks: The NetworkFactory Class. . . . . . . . . . . . . . . . . . . . . . 394 Debugging Network Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 Analyzing Networks Using the PL/SQL API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 Using a Memory Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 Analyzing Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 Creating and Updating Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 Using Network Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 The Network Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 Starting the Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 Using the Loaded Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 Example Data: The Streets of San Francisco . . . . . . . . . . . . . . . . . . . . . . . 415 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
  11. ■CONTENTS xi ■CHAPTER 11 The Routing Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Installation and Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 Example Data: The Streets of San Francisco . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 Using the Router: XML Queries and Responses . . . . . . . . . . . . . . . . . . . . . . . . . . 427 Routing Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 Routing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Pregeocoded Start and End Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Geographic Start and End Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 Batch Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 PART 4 ■■■ Visualization ■CHAPTER 12 Defining Maps Using MapViewer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 Why Use Maps in Location-Enabled Applications? . . . . . . . . . . . . . . . . . . . . . . . . 437 Overview of MapViewer and Oracle Maps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 Oracle MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 Oracle Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 Load the Sample Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 Location-Enable the Application Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 Load the Geographical Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 Load Maps, Themes, Style, and Map Cache Definitions for MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 Define a Data Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Install Example Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Configuring MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 Using the Administration Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Defining Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 Using Map Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 Using Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Using Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Using Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
  12. xii ■CONTENTS Defining Map Caches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 The USER_SDO_CACHED_MAPS View . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 Managing Caches Using the MapViewer Console . . . . . . . . . . . . . . . . . . . 491 Creating a New Map Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Creating Map Caches Using SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Cache Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Exporting Cache Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Purging and Refreshing Cache Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Using External Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 ■CHAPTER 13 Using Maps in Your Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 Overview of MapViewer’s APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 XML, Java, JSPs, and PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 JavaScript and Ajax: Oracle Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 Choosing an API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Anatomy of a Map Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 What: The Information That Should Appear on the Map . . . . . . . . . . . . . . 507 Where: The Geographical Area to Be Covered by the Map . . . . . . . . . . . . 508 How: The Format and Size of the Resulting Map . . . . . . . . . . . . . . . . . . . . 508 Interacting with Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Controlling the Level of Detail: Zoom In and Zoom Out . . . . . . . . . . . . . . . 509 Controlling the Area Shown on the Map: Pan and Recenter . . . . . . . . . . . 509 Selecting Features: Identify. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 Choosing the Information to Appear on the Map: Layer Control . . . . . . . . 510 Oracle Maps: The JavaScript API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 Displaying a Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Interacting with Maps: Zooming and Panning. . . . . . . . . . . . . . . . . . . . . . . 514 Adding Map Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 Adding Generic Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 Creating an Overview Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 Rectangular (Marquee) Zooming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 Adding Dynamic Information: Theme-Based FOIs . . . . . . . . . . . . . . . . . . . 519 Adding Individual FOIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 Controlling Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 Capturing User Input: Tools and Selectors. . . . . . . . . . . . . . . . . . . . . . . . . . 525 Responding to Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Using the Java API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 Map Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 Zooming and Panning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 Theme Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 Style Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 Identification and Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
  13. ■CONTENTS xiii Dynamic Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Map Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 Using the Map Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 Discovering Data Sources, Maps, Themes . . . . . . . . . . . . . . . . . . . . . . . . . 547 Using JSP Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 Using the XML API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 Simple Map Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Adding Themes to a Base Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 Using Multiple Data Sources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 Constructing a Map from Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 Dynamic Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 Dynamic Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 The XML Map Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 Using the PL/SQL API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 Installing the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 Using the Administrative API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 Browsing Map Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 Managing the MapViewer Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570 Restarting MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 Web Map Service (OGC WMS) Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 The GetCapabilities Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 The GetMap Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 The GetFeatureInfo Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 Spatial Reference Systems (SRS) Mapping. . . . . . . . . . . . . . . . . . . . . . . . . 578 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 PART 5 ■■■ Spatial in Applications ■CHAPTER 14 Sample Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 Data Preparation and Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 Loading the Geographical Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 Location-Enabling the Application Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 Loading Map, Theme, Style, and Map Cache Definitions for MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 Applications Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 The JavaScript Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 Application Walk-Through . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 Under the Hood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
  14. xiv ■CONTENTS The Java (JSP) Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 Application Walk-Through . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 Under the Hood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 ■CHAPTER 15 Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 Overview of the Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 Spatial Information for Managing the London Bus Network . . . . . . . . . . . . . . . . 624 BusNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 Spatial Data and Oracle Spatial in BusNet . . . . . . . . . . . . . . . . . . . . . . . . . 626 User Interface for Spatial Data in BusNet . . . . . . . . . . . . . . . . . . . . . . . . . . 628 BusNet Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 P-Info: A Mobile Application for Police Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 P-Info Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 P-Info Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 Use of Oracle Spatial in P-Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 Measurable Added Value of P-Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 Risk Repository for Hazardous Substances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 RRGS Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640 Use of Oracle Spatial in the RRGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642 From Hazardous Substances to Risk Management . . . . . . . . . . . . . . . . . . 643 USGS National Land Cover Visualization and Analysis Tool . . . . . . . . . . . . . . . . . 644 The Architecture of USGS Visualization and Analysis Tool . . . . . . . . . . . . . 647 Oracle Spatial in USGS Visualization and Analysis Tool . . . . . . . . . . . . . . . 648 Benefits of USGS Visualization and Analysis Tool . . . . . . . . . . . . . . . . . . . . 651 U.S. Department of Defense MilitaryHOMEFRONT LBS . . . . . . . . . . . . . . . . . . . . 652 The Architecture of MilitaryHOMEFRONT LBS . . . . . . . . . . . . . . . . . . . . . . 654 Oracle Spatial in MilitaryHOMEFRONT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657 Mobile MilitaryINSTALLATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660 Benefits of MilitaryHOMEFRONT LBS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 ■CHAPTER 16 Tips, Common Mistakes, and Common Errors . . . . . . . . . . . . . . 663 Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 Data Modeling and Loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 Performance of Spatial Operator Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 Performance of Other Spatial Processing Functions . . . . . . . . . . . . . . . . . 670 Performance of Inserts, Deletes, and Updates . . . . . . . . . . . . . . . . . . . . . . 672 Best Practices for Scalability and Manageability of Spatial Indexes . . . . 673 Common Mistakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 Bounds, Longitude and Latitude, and Tolerance for Geodetic Data . . . . . 678 NULL Values for SDO_GEOMETRY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
  15. ■CONTENTS xv Use GEOCODE or GEOCODE_ALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 Specify “INDEXTYPE is mdsys.spatial_index” in CREATE INDEX . . . . . . . 678 Always Use Spatial Operators in the WHERE Clause . . . . . . . . . . . . . . . . . 679 Use Spatial Functions When No Spatial Index Is Available . . . . . . . . . . . . 679 Do Not Move, Import, or Replicate MDRT Tables . . . . . . . . . . . . . . . . . . . . 680 Network Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 Map Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 Common Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 ORA-13226: Interface Not Supported Without a Spatial Index . . . . . . . . . 681 ORA-13203: Failed to Read USER_SDO_GEOM_METADATA View . . . . . . 681 ORA-13365: Layer SRID Does Not Match Geometry SRID. . . . . . . . . . . . . 681 ORA-13223: Duplicate Entry for in SDO_GEOM_METADATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 ORA-13249, ORA-02289: Cannot Drop Sequence/Table . . . . . . . . . . . . . . 682 ORA-13249: Multiple Entries in sdo_index_metadata Table . . . . . . . . . . . 682 ORA-13207: Incorrect Use of the Operator . . . . . . . . . 682 ORA-13000: Dimension Number Is Out of Range. . . . . . . . . . . . . . . . . . . . 682 ORA-00904: . . . Invalid Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683 ORA-00939: Too Many Arguments for Function . . . . . . . . . . . . . . . . . . . . . 683 ORA-13030: Invalid Dimensionality for the SDO_GEOMETRY, or ORA-13364: Layer Dimensionality Does Not Match Geometry Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 PART 6 ■■■ Appendixes ■APPENDIX A Additional Spatial Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . 689 Tiling-Based Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 TILED_BINS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 TILED_AGGREGATES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 Neighborhood Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 AGGREGATES_FOR_GEOMETRY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 AGGREGATES_FOR_LAYER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 Clustering Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696 SPATIAL_CLUSTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696 Refining the Candidates for Site Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 Geometry Simplification for Speeding Up Analysis . . . . . . . . . . . . . . . . . . . . . . . . 698 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
  16. xvi ■CONTENTS ■APPENDIX B Linear Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 Concepts and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 Linear Referenced Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 Shape Points. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 Typical Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 Creating Linear Referenced Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 SDO_GTYPE in LRS Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 Constructing LRS Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 Spatial Indexes and Spatial Operators on LRS Geometries . . . . . . . . . . . . 707 Dynamic Segmentation Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 Clip a Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 Locate a Point. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 Project a Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 Intersecting LRS Segments with Standard Geometries . . . . . . . . . . . . . . . 710 Validation of LRS Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 Dynamic Segmentation on 3D Geometries . . . . . . . . . . . . . . . . . . . . . . . . . 711 Other Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712 ■APPENDIX C Topology Data Model in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 Sharing Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 Benefits of the Topology Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 Storing a Topology Data Model in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 Operating on a Topology in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 Creating a Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 Populating a Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 Associating a Feature Layer with a Topology . . . . . . . . . . . . . . . . . . . . . . . 719 Inserting, Updating, and Populating Feature Layers . . . . . . . . . . . . . . . . . . 720 Updating Topological Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 Querying for Topological Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Hierarchical Feature Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 ■APPENDIX D Storing Raster Data in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 The SDO_GEORASTER Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 Storage for SDO_GEORASTER Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 Metadata in SDO_GEORASTER Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
  17. ■CONTENTS xvii Populating SDO_GEORASTER Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 Manipulating Raster Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Generating Pyramids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Subsetting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 Georeferencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 Attaching Bitmap Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 Registering NODATA Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 Using Compression in GeoRaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 Visualizing Raster Data in Oracle MapViewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 ■APPENDIX E Three-Dimensional Modeling Using Point Clouds and TINs in Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 Storing Large Point Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 The SDO_PC Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 Populating a Point Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 Querying a Point Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 Other Manipulation Functions for Point Clouds. . . . . . . . . . . . . . . . . . . . . . 749 Storing Triangulated Irregular Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 The SDO_TIN Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750 Populating a TIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751 Querying a TIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754 Other Manipulation Functions for TINs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 ■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
  18. About the Authors ■RAVI KOTHURI has a PhD in computer science from the University of California, Santa Barbara, and has been an active researcher and developer in the spatial and multimedia areas for the past 15 years. Currently, he serves as project lead and software architect in the spatial development team of Oracle Corporation. He has more than 20 patents on specific Oracle technology and has authored numerous articles for database conferences and journals. Other activities include teaching database courses (most recently at Boston University), pre- senting at panel meetings and conferences, and reviewing of research articles for spatial and database conferences. Ravi enjoys music, movies, and playing with his children. ■ALBERT GODFRIND has more than 25 years of experience in designing, devel- oping, and deploying IT applications. His interest and enthusiasm for spatial information and geographical information systems started at Oracle when he discovered the spatial extensions of the Oracle database in 1998. Ever since, Albert has been “evangelizing” the use of spatial information both to GIS and IT communities across Europe, consulting with partners and customers, speak- ing at conferences, and designing and delivering in-depth technical training. Prior to joining Oracle Corporation, Albert held several positions in database engineering at Digital Equipment Corporation (DEC), where he worked on the development of the Rdb database system. ■EURO BEINAT has a PhD in economics and a master’s degree in electronics and systems engineering. He has been involved in consultancy for more than 10 years in evaluation and strategic advice in sectors ranging from IT, govern- ment, the oil industry, and large corporations. Currently, he is the managing director of Geodan Mobile Solutions and holds a chair on Location Services at the Vrije Universiteit of Amsterdam and at the University of Salzburg. His main skills combine geo-IT and the Internet, with an extensive competence in deci- sion analysis and strategy. xix
  19. About the Technical Reviewer ■CAREL-JAN ENGEL is a member of the OakTable Network, lives in the Netherlands, and works as a freelancer. He has been working in IT since 1982, and he started to work with Oracle version 4 in 1985. Fastforms (Forms 1.3) didn’t meet the requirements of the software project he was on, and he joined the team that was developing “better” programming tools and applications in C, based on the HLI, now known as the OCI. In 1992, he founded the Dutch software company Ease Automation, which he headed for almost ten years. Some of his projects during this time related to airports and had an important high-availability aspect to them, which inspired him to develop several techniques for standby databases, often pushing Oracle technology to its limits. In 1998, he won the Chamber of Commerce of Rotterdam’s Entrepreneur of the Year award. In 2002, he decided to continue his career as a freelancer. He has been a regular author for several (Dutch) Oracle-related magazines since 1998. xxi
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2