Spatial queries in SQL Server 2008 SQL Bits III – 13 th September 2008.

Slides:



Advertisements
Similar presentations
Chapter 4 Part C: Queries, Computations & Map Algebra.
Advertisements

Object Relational Model Spatial Queries. Query Model Spatial Layer Data Table where coordinates are stored Primary Filter Spatial Index Index retrieves.
Europe’s Premier Community SQL Server Conference # SQLBITS.
Center for Modeling & Simulation.  A Map is the most effective shorthand to show locations of objects with attributes, which can be physical or cultural.
Module 19 Working with SQL Server® 2008 R2 Spatial Data.
Raster Based GIS Analysis
Map Projections & Coordinate Systems
Your Data Any Place, Any Time Delivering Location Intelligence with Spatial Data.
Coordinate Systems, Datums and Map Projections D’Arcangelis 11/9/09
West Hills College Farm of the Future. West Hills College Farm of the Future Where are you NOW?! Precision Agriculture – Lesson 3.
Oracle8i Spatial Concepts. Concepts Geometric data types Oracle8i Spatial data model Spatial Layers Spatial query model Spatial indexing «Window» queries.
Oracle spatial – Creating spatial tables Object Relational Model Creating Spatial Tables.
Coordinate Systems, Datums and Map Projections
Geographic Information Systems
So What is GIS??? “A collection of computer hardware, software and procedures that are used to organize, manage, analyze and display.
NPS Introduction to GIS: Lecture 1
TECNOLOGIAS DE ARMAZENAMENTO DE INFORMAÇÃO ESPACIAL.
Projections and Coordinate Systems, Continued
Object Relational Model Creating Spatial Tables. Concepts Describe the schema associated with a spatial layer Explain how spatial data is stored using.
Uncontrolled copy not subject to amendment
Spatial and temporal data management Nothing puzzles me more than time and space; and yet nothing troubles me less, as I never think about them Charles.
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. Perform spatial analysis and modeling.
GIS Analysis. Questions to answer Position – what is here? Condition – where are …? Trends – what has changed? Pattern – what spatial patterns exist?
Introduction to ArcGIS for Environmental Scientists Module 2 – GIS Fundamentals Lecture 5 – Coordinate Systems and Map Projections.
Washington Metropolitan Area Transit Authority Voliya Arakkal Sr.GIS Analyst GIS in Public Transportation Conference September 15, 2011 Linear Referencing.
Spatial Concepts Mathematical Types of Space –Euclidean –Network –Metric –Topologic.
JTS Topology Suite JTS Topology Suite An API for Processing Linear Geometry Martin Davis, Senior Technical Architect
Spatial Data Models. What is a Data Model? What is a model? (Dictionary meaning) A set of plans (blueprint drawing) for a building A miniature representation.
Amanda Henley GIS Librarian Davis Library Reference September 2006
Taking Microsoft SQL Server into the World of Spatial Data Management Milan Stojic, Michael Rys Program Managers
GEOREFERENCING By Okan Fıstıkoğlu. GEOGRAPHIC COORDINATE SYSTEMS Geographic Coordinate System (GCS) uses a three dimensional spherical surface to define.
Creating High Performance Spatial Databases with SQL Server 2008 Alastair Aitchison.
 Trace the incremental algorithm for constructing convex data on the sample point data given below. Intermediate steps should be shown First, two steps.
6. Simple Features Specification Background information UML overview Simple features geometry.
Taking Microsoft SQL Server into the World of Spatial Data Management Michael Rys Principal Program Manager Microsoft DBI324.
School of Geography FACULTY OF ENVIRONMENT Introduction to ArcToolbox and Geoprocessing.
How to Spatially Enable Your IBM Informix Database Chris Bosch.
PostGIS and Spatial Queries Steve Signell, Instructor Robert Poirier, TA School of Science Rensselaer Polytechnic Institute.
SQL access and working with ST_Geometry Functions
Geodesy and Datums Ellipsoid and Geoid Geographic Coordinate system.
Map Basics, partII GEOG 370 Christine Erlien, Instructor.
PostGIS and Spatial Queries Steve Signell, Instructor Robert Poirier, TA School of Science Rensselaer Polytechnic Institute.
Joseph Jaquish 1/10. - Spatial Data Types - Spatial Database Architectures - Geographic Information Systems 2/10.
Spatial DBMS Spatial Database Management Systems.
John Pickford IBM H11 Wednesday, October 4, :30. – 14:30. Platform: Informix Practical Applications of IDS Extensibility (Part 2 of 2)
ST236 Site Calibrations with Trimble GNSS
Basic Coordinate Systems Grid System RG 620 May 23, 2014 Institute of Space Technology, Karachi Grid System RG 620 May 23, 2014 Institute of Space Technology,
What is GIS? “A powerful set of tools for collecting, storing, retrieving, transforming and displaying spatial data”
Spatial Data Models Geography is concerned with many aspects of our environment. From a GIS perspective, we can identify two aspects which are of particular.
GEOGRAPHY DATATYPES in SQL Server by jared nielsen linkedin.com/nielsendata.
UNIT 3 – MODULE 6: Data Analysis. TERMINOLOGY There are several terms that are important to know when discussing data analysis: – Entity – an individual.
Oracle Spatial Extension of the RDBMS Oracle by spatial data types and operations –introduced in version 8 (current version.
Get Familiar with Spatial Data. Slava Murygin – SQL SlavaSQL.BlogSpot.com.
GIS Project1 Physical Structure of GDB Geodatabase Feature datasets Object classes, subtypes Features classes, subtypes Relationship classes Geometric.
Introduction to Geodatabases
SIMULATION COMPONENT AND MODFLOW DATA MODEL. Simulation Component.
PostGIS and Spatial Queries
Get Familiar with Spatial Data
PostGIS and Spatial Queries
Fun with SQL Server Spatial Data
Physical Structure of GDB
Understanding & Using Spatial Data Features in SQL Server
Geographic Information Systems
Julia Powell Coast Survey Development Laboratory
Spatial Data Types And Indexing SQL Server 2008
Fun with SQL Server Spatial Data
JTS Topology Suite An API for Processing Linear Geometry
Spatial and temporal data management
Geography 413/613 Lecturer: John Masich
Vector Geoprocessing.
Presentation transcript:

Spatial queries in SQL Server 2008 SQL Bits III – 13 th September 2008

 New data types geometry and geography  Spatial references  Spatial operations  Spatial indexes  Case study

 80-90% of all data has a spatial element  Where are your customers?  Where are your assets?  Where are potential customers?  Where are the flood risks?  Where are your complaints coming from?  Where are the accident black-spots?  Where are crimes happening?

 Postcodes in Glasgow  Zoned  Historical reasons  G5 adjacent to G42  G40 in an island  Postcodes designed for delivering letters

 The data analysis engine  No useful rendering engine  Virtual Earth  Map Point  Other GIS systems  OGC Standards compliance  Plus some “extension” methods of their own

 X/Y coordinate on a planar grid  British National Grid  Works well to ~750,000km 2  Different projections

 Geodetic coordinates  Covers larger areas  International datasets  Approximation  Earth actually flattened sphere (oblate spheroid)  Different models  Airy 1830 (used by OS)  WGS84 (used by GPS)

 Spatial Reference Identifier  All spatial data has an SRID  SRIDs must match for spatial operations  Null returned if SRIDs don’t match  Geometry can have an SRID of 0  Not Geography.

 Point  LineString  Polygon  GeomCollection  MultiPolygon  MultiLineString  MultiPoint From BOL

SELECT a.Name AS StartVenue, b.Name AS EndVenue, a.Location.STDistance(b.Location) / As Distance FROM Venue AS a INNER JOIN Venue AS b ON a.Id < b.Id ORDER BY a.Id, b.Id GCU60 Dundee U62102 MS TVP MS Edin’ HBOSGCUDundee UMS TVP

 A linestring is a series of coordinates  1 dimension  Defines a linear object  Road  Railway line  River

 Can use  STGeomFromText  STGeomFromWKB  STLineFromText  STLineFromWKB  Parse

 Geography uses SI Units  Geometry uses the units of the planar system The square of the hypotenuse is equal to the sum of the square of the other two sides Not to scale 3 units 4 units ? units Distance from A to B: √( ) = 5 A B

 A series of coordinates in a closed ring  First and last coordinate are the same  2 dimensions  Defines an area

 Interior is everything inside an anti-clockwise ring  Everything on the left- hand side of the perimeter line.

The specified input does not represent a valid geography instance because it exceeds a single hemisphere. Each geography instance must fit inside a single hemisphere. A common reason for this error is that a polygon has the wrong ring orientation.

 Can use  STGeomFromText  STGeomFromWKB  STPolygonFromText  STPolygonFromWKB  Parse

 Estate Agent  Filter by price, # bedrooms, type – EASY!  Filter by location?  Until now very vague

N e a r a r a i l w a y s t a t i o n N e a r m y w o r k N e a r a m o t o r w a y j u n c t i o n Near a good school I n s i d e t h e c i t y O u t s i d e t h e c i t y

 Railway data  Stations  Routes

 Edinburgh - Glenrothes (via Kirkcaldy) Name DistKM Edinburgh Waverley Station 0 Haymarket South Gyle Burntisland Dalmeny Kinghorn Aberdour North Queensferry Dalgety Bay Inverkeithing Kirkcaldy Glenrothes With Thornton

 Decomposes space into 4 levels of grid  Level 1 is the top  Cells are uniform in a level  A level can be a 4x4, 8x8 or 16x16 grid  8x8 by default

 Table must have a primary key  Primary key cannot subsequently be changed.  Not on views  Maximum of 249 Spatial indexes per column

 Where geometry/ geography sizes vary  e.g. Rail routes  Small: Suburban lines  Large: Intercity lines

 Supports  STIntersects  STEquals  STDistance  One Geography must be a point  Both sides of the spatial operation must have the same SRID

 Must specify boundary of spatial area  Additional methods supported  STContains  STOverlaps  STTouches  STWithin

 CodePlex project  More spatial methods  Aggregations  Scripts

 GML  Import and export  M and Z  Can store  Cannot operate.  Other spatial Operations  Geometry has more!  Visualisation .NET application integration  Data Importing

 Slide Deck on my website   Blog posts on Spatial Data 