Spatial Data and Windows Azure SQL Database

Slides:



Advertisements
Similar presentations
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
Advertisements

Hope Foley Perpetual Technologies SQL Saturday #51 - Nashville.
Introduction to GIS Ghassan Mikati, Ph.D GIS Expert.
Jeremy Boyd Director – Mindscape MSDN Regional Director
Building a social networking portal on Windows Azure in 1 hour Saranya Sriram Developer Evangelist Microsoft, India.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Rebecca Boger Earth and Environmental Sciences Brooklyn College.
Building Ad-Hoc Reports using the SQL Server 2005 Reporting Services (SSRS) Report Builder (SQL307) Adrian Rupp Business Intelligence Solutions Specialist.
Building Web Applications with SQL Azure David Robinson Senior Program Manager SQL Azure
Overview SQL Server 2008 Overview Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP, MCTS Microsoft Web Development MCP ITIL.
Creating Business Workflow Using SharePoint Designer 2007 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft SQL Server.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
SQL Server 2008 Spatial Summary 2 Spatial Data Types (CLR UDT) Comprehensive set of Spatial Methods High Performance Spatial Indexes Spatial Library Sink/Builder.
Austin code camp 2010 asp.net apps with azure table storage PRESENTED BY CHANDER SHEKHAR DHALL
Windows Azure Tour Benjamin Day Benjamin Day Consulting, Inc.
Taking Microsoft SQL Server into the World of Spatial Data Management Milan Stojic, Michael Rys Program Managers
Introducing Reporting Services for SQL Server 2005.
Geographic Information System GIS This project is implemented through the CENTRAL EUROPE Programme co-financed by the ERDF GIS Geographic Inf o rmation.
Creating High Performance Spatial Databases with SQL Server 2008 Alastair Aitchison.
How do we represent the world in a GIS database?
Microsoft SharePoint Server 2010 for the Microsoft ASP.NET Developer Yaroslav Pentsarskyy
Intro to GIS and ESRI Trainers: Randy Jones, GIS Technician, Douglas County Jon Fiskness, GISP GIS Coordinator, City of Superior.
SQL access and working with ST_Geometry Functions
GIS Data Structures How do we represent the world in a GIS database?
John Pickford IBM H11 Wednesday, October 4, :30. – 14:30. Platform: Informix Practical Applications of IDS Extensibility (Part 2 of 2)
Geographic Data in GIS. Components of geographic data Three general components to geographic information Three general components to geographic information.
Intro to GIS & Pictometry Trainers: Randy Jones, GIS Technician, Douglas County Jon Fiskness, GISP GIS Coordinator, City of Superior.
Interoperability. Session Objectives and Takeaways Session Objective(s): – Get up to speed on SQL Azure – Learn about the new features in SQL Azure –
ESRI Education User Conference – July 6-8, 2001 ESRI Education User Conference – July 6-8, 2001 Introducing ArcCatalog: Tools for Metadata and Data Management.
SSMS SQL Server Management System. SQL Server Microsoft SQL Server is a Relational Database Management System (RDBMS) Relational Database Management System.
The Jukebox is a.NET web application that plays streaming music files to it’s clients according to their favorites musical genres. Clients can rate the.
Building web applications with the Windows Azure Platform Ido Flatow | Senior Architect | Sela | This session.
Get Familiar with Spatial Data. Slava Murygin – SQL SlavaSQL.BlogSpot.com.
Lesson 3 GIS Fundamentals MEASURE Evaluation PHFI Training of Trainers May 2011.
GIS Data Shape files, Rasters, Coordinate Systems, ArcGIS.
Windows Azure SQL Reporting for App developers
Windows Communication Foundation and Web Services
Geog. 314 Working with tables.
Introduction ITEC 420.
DBMS Programs MS SQL Server & MySQL
Building Enterprise Applications Using Visual Studio®
Get Familiar with Spatial Data
Fast Track to SPATIAL Reporting!
Reporting with Reporting Services
Deploying Web Application
GML in CDI and CSR ISO using Ends&Bends
Data Platform and Analytics Foundational Training
Fun with SQL Server Spatial Data
Introduction to Visual Basic 2008 Programming
Beyond the BDC\BCS Model
Understanding & Using Spatial Data Features in SQL Server
Introduction to GIS.
Physical Structure of GDB
Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek
Created by Kamila zhakupova
Presenter Date | Location
Windows Communication Foundation and Web Services
Geographic Information Systems
Entity Framework 4 and WCF Data Services 4
Design and Consume DataWindows in Visual Studio 2005
Fun with SQL Server Spatial Data
Jim Nakashima Program Manager Cloud Tools
Saranya Sriram Developer Evangelist | Microsoft
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Lecture 2 Components of GIS
Implementing Entity Framework with MVC Jump Start
Overview of Databases and Salesforce Chapter 1
Mark Quirk Head of Technology Developer & Platform Group
Microsoft Azure Services Platform
Paul Larsen The Value of Hybrid Integration
Presentation transcript:

Spatial Data and Windows Azure SQL Database Windows Azure SQL Database and Geospatial support Mihail Mateev Senior Technical Evangelist, TL @ Infragistics

Добро Пожаловать!

About me Mihail Mateev is a Senior Technical Evangelist, Team Lead at Infragistics Inc., Community Lead for Europe Mihail works in various areas related to Microsoft technologies : Silverlight, WPF, WP, LightSwitch, WCF, ASP.Net MVC,, MS SQL Server and Windows Azure

Agenda What is Spatial Data Spatial Reference System Geospatial Features Spatial Data Types Creating Spatial Data Import Spatial Data Windows Azure SQL Database Architecture Migrating Spatial Data to SQL Azure Using Spatial Data in Windows Azure SQL Database

What is Spatial Data Spatial data describes the position, shape and orientation of objects in space

What is Spatial Data Analyzing sales trends Analyzing the best placement depending of different criteria Navigating to s destination using a GPS device Allowing customers to track the deliveries Finding the optimum route for transportation tasks Reporting geospatial information on the map rather than in a tabular or chart format

Spatial Reference Systems Define positions on a three-dimensional, round model of the earth

Spatial Reference Systems Describe the position of points on the earth surface as the lie on a flat, two-dimensional plane. - X + Y - X - Y + X - Y X Data usually here Y

Spatial Reference Systems Datum is a set of reference points on the Earth's surface against which position measurements are made Local datum NAD27 Ellipsoid CLARKE 1866 Earth-centered datum NAD83 Ellipsoid GRS80 + * * Earth surface Center of the Earth's mass

Spatial Reference Systems Reference ellipsoid An approximation of the surface shape of the earth (or rather, the geoid) spheroid used for the needs of geodesy at some of the earth's surface

Geospatial Features Points Polylines Polygons Points Polylines

Geospatial Features Vector Data: describes discrete spatial objects by defining the coordinates of geometries that approximate the shape of those features X,Y X,Y X,Y X,Y

Geospatial Features Raster Data: represents spatial information using a matrix of cells. These cells are arranged into a grid that is overlaid onto the surface of the earth. Rows X,Y Columns

SQL Server Spatial Data Types SQL Server supports two different spatial data types GEOMETRY and GEOGRAPHY

Shapefile format Donut shapefile Donut.dbf table Shape field accesses separate coordinate files

Spatial Data Types Spatial data and SQL Server Point MultiPoint LineString MultiLineString Polygon MultiPolygon GeometryCollection

Creating Spatial Data Creation of spatial objects

Creating Spatial Data Creation of spatial objects Creating instances of UDT (User Defined Types) Geometry and Geography data types are implemented as user-defined types (User Defined Types, UDT), written on. NET. They are automatically installed with the server and are available for use in any database, SQL Server. Any variable, parameter, or column of a table can be declared as the type of Geometry. Note that the type name is not case sensitive. DECLARE @g Geometry

Creating Spatial Data The use of spatial data Use STGeomFromText () to create a LineString DECLARE @g Geometry SET @g = Geometry::STGeomFromText('LINESTRING(0 0, 10 10, 21 2)', 0)

Creating Spatial Data The use of spatial data Use STGeomFromText () and STPointFromtext () DECLARE @Glasgow as geometry SET @Glasgow = geometry::STPointFromText('POINT(258647 665289)', 27700) DECLARE @Glasgow2 as geometry SET @Glasgow2 = geometry::STGeomFromText('POINT(258647 665289)', 27700)

Creating Spatial Data The use of spatial data Z and M coordinates Z coordinate represents the height or the height of a point. M coordinates are stored "measure" value of point. These coordinates can be used to provide additional details of a point, which can be expressed as a double-precision Imagine WKT from the Z and M coordinates: POINT (x y z m) or PONT (longitude latitude z m)

Creating Spatial Data The use of spatial data Management of spatial data CREATE TABLE SpatialTable      (Id int IDENTITY (1,1),      GeomCol1 geometry,      GeomCol2 AS GeomCol1.STAsText ()); GO INSERT INTO SpatialTable (GeomCol1) VALUES (geometry :: STGeomFromText ('LINESTRING (100 100, 20 180, 180 180), 0));

Creating Spatial Data The use of spatial data Management of spatial data STBuffer SELECT @g.STBuffer(8), @g.STBuffer(8).ToString() STExteriorRing SELECT @g.STBuffer(8).STExteriorRing(), @g.STBuffer(8).STExteriorRing().ToString()

Creating Spatial Data The use of spatial data Management of spatial data STArea, STLength DECLARE @g GEOMETRY = 'POLYGON((10 10, 10 40, 40 40, 10 10))' SELECT @g.STArea() as Area, @g.STLength() as Length

Creating Spatial Data Using Stored Procedures CREATE PROCEDURE [dbo].[get_SelectedData] @pCntrNameValue nvarchar(255) BEGIN SET NOCOUNT ON; SELECT geom.STBuffer(2) as geom, CNTRY_NAME, POP_CNTRY FROM world WHERE CNTRY_NAME = @pCntrNameValue END

Indexing The Need for a Spatial Index How Does a Spatial Index Work? The Primary and Secondary Filter Primary filter: Secondary filter:

Indexing The Grid Structure of a Spatial Index

Indexing The Grid Structure of a Spatial Index

Indexing Optimization Rules a Multilevel Grid Index Covering Rule

Indexing Using Spatial Indexes: USING GEOMETRY_GRID WITH ( BOUNDING_BOX = (0, 0, 4096, 4096), GRIDS = ( LEVEL_1 = MEDIUM, LEVEL_2 = MEDIUM, LEVEL_3 = MEDIUM, LEVEL_4 = MEDIUM), CELLS_PER_OBJECT = 16);

Indexing Using Spatial Indexes: SELECT id FROM Points WITH(INDEX(sidxPoints)) WHERE shape.STIntersects(@Polygon) = 1;

Creating Spatial Data Using Stored Procedures

Import Spatial Data SQL Server import and export spatial data formats Well Known Text, Well Known Binary Geographic Markup Language (GML) Shapefile

Import Spatial Data Import spatial data in SQL Server Conversion Utilities: ShapeToSQL: www.social.msdn.microsoft.com Shp2text: www.obviously.com FME : www.safe.com Manifold: www.manifold.net

Windows Azure SQL Database Architecture There are four different levels of abstraction, which work together to provide a relational database for your application: Client layer Services layer Platform layer Infrastructure layer SQL Azure offers only DTS endpoint For each Windows Azure SQL database instance there was created 3 copies of SQL

Windows Azure SQL Database Architecture Azure SQL Database Disadvantages Azure SQL Database does not support the following functions of the database Service Broker HTTP access CLR stored procedures

Windows Azure SQL Database Architecture Azure SQL Database Disadvantages Azure SQL Database support spatial data types, but developers need to deploy libraries with spatial CLR types with their applications. Windows Azure has no installed predefined SQL spatial data types Azure SQL Database does not support the following functional features Distributes query Distributed transactions Any SQL query and views that change or get physical information resources

Migrating Spatial Data to SQL Azure SQL Server 2008/2008 R2 Microsoft SQL Management Studio for SQL Server 2008/2008 R2 does not support the transfer of spatial data in Azure SQL Database SQL Azure Migration Wizard: http://sqlazuremw.codeplex.com/

Migrating Spatial Data to SQL Azure SQL Server 2012 Microsoft SQL Management Studio for SQL Server 2012 does supports the transfer of spatial data in Azure SQL Database

Migration of systems with spatial data in Windows Azure SQL Database Create a new Azure SQL database Database migration – migrate your databse from the local SQL Server to SQL Azure Add a new Windows Azure Storage Account and Web services Add web project role in the decision Change settings in the Web.config and ServiceReferences.ClientConfig Publish Windows Azure Cloud Service

Using Spatial Data in Windows Azure SQL Database Processing of spatial data using .NET in Windows Azure SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlCommand.CommandText = "get_WorldData"; sqlConnection.Open(); SqlDataReader reader = sqlCommand.ExecuteReader(); if (reader != null) while (reader.Read()) { Dictionary<string, string> valueDictionary = new Dictionary<string, string>(); for (int i = 0; i < reader.FieldCount; i++) valueDictionary.Add(reader.GetName(i), reader.GetValue(i).ToString()); } list.Add(valueDictionary); ....

Using Spatial Data in Windows Azure SQL Database Using Entity Framework 5 List<SpatialPoint> multiPoints = new List<SpatialPoint>(); var numPoints = country.geom.Envelope.ElementAt(1).PointCount; for (int i = 1; i <= numPoints; i++) { SpatialPoint pnt = new SpatialPoint((double)(country.geom.Envelope.ElementAt(1). PointAt(i).XCoordinate), (double)(country.geom.Envelope.ElementAt(1).PointAt(i). YCoordinate)); multiPoints.Add(pnt); } SpatialRect rect = multiPoints.GetBounds();

Using Spatial Data in Windows Azure SQL Database Windows Azure Web Site and spatial data Creating a Windows Azure Web Site

Using Spatial Data in Windows Azure SQL Database What libraries to use? Microsoft.SqlServer.Types.dll (managed) .NET library \Program Files(x86)\Microsoft SQL Server\110\SDK\Assemblies SQLServerSpatial.dll / SQLServerSpatial110.dll (unmanaged) C++ library \Windows\System32

Using Spatial Data in Windows Azure SQL Database Getting libraries Project –> Add Existing Item \Windows\SysWOW64 -> msvcp110.dll and msvcr110.dll files (Visual Studio 2012) or msvcp100.dll и msvcr100.dll  (Visual Studio 2010) .

Using Spatial Data in Windows Azure SQL Database Getting libraries Set the properties of msvcp110.dll, msvcr110.dll and SqlServerSpatial110.dll to “Copy to Output directory = Copy always”

Demo

Spatial Data and Windows Azure Storage Using spatial data in the Windows Azure Blob Storage Accessing the Windows Azure Storage is done via a storage account. A storage account can have many blob containers. A container is a user-defined set of blobs that has only properties, which include a list of the blobs it contains. Containers don’t store data directly.

Spatial Data and Windows Azure Storage Windows Azure Blob Storage Windows Azure Blob Storage Concepts

Spatial Data and Windows Azure Storage Windows Azure Blob Storage Blob URL http://<Account>.blob.core.windows.net/<Container>/<BlobName> URL: http://sally.blob.core.windows.net/music/rock/rush/xanadu.mp3 Types of Blobs Block Blob Page Blob

Spatial Data and Windows Azure Storage Steps to Implement Azure Application Reading Shapefiles from Blob Storage Implement a WCF to upload and download files, using Windows Azure Blob Storage. Add in the client application (ASP.Net / Silverlight ) XamMap component. Implement shapefile loading from Isolated Storage to XamMap. Create a new Windows Azure Storage Account and a Hosted Service (if you are using a Windows Azure Account). Add a Web Role project in Solution Edit settings in ServiceReferences.ClientConfig . Publish the Windows Azure Cloud Service

Useful links Shape To SQL Tools SAFE Software Infragistics Blogs http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools.aspx SAFE Software http://www.safe.com/ Infragistics Blogs http://blogs.infragistics.com/ www.infragistics.com/mihail_mateev/

Спасибо за внимание!

Вопросы и ответы

Спонсоры