blue sky thinking

30
BLUE SKY THINKING SQL Azure Geospatial Mashup

Upload: thomas-sykes

Post on 11-Feb-2017

80 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Blue Sky Thinking

BLUE SKY THINKINGSQL Azure Geospatial Mashup

Page 2: Blue Sky Thinking

ABOUT ME▪ Thomas Sykes▪ Data Platform Consultant for Quorum in Edinburgh▪ Using SQL Server since version 7.0▪ MCDBA, MCITP and MCSE in SQL Server▪ MCS in Azure Implementation and Hyper-V▪ Certified Technical Trainer

Page 3: Blue Sky Thinking

THIS SESSION▪ SQL Azure with Geospatial Data▪ Azure Websites with Bing Maps▪ Integrate another live data source

Page 4: Blue Sky Thinking

HOLIDAY CLIMBING

Page 5: Blue Sky Thinking

AZURE SQL DATABASE▪ Windows Azure SQL Database

▪ Microsoft’s PaaS offering for SQL Server Database Engine▪ With V12 is much closer to our IaaS or On-Premise Database Engine▪ Scalable with various options from Basic development to Mission Critical Premium

Page 6: Blue Sky Thinking

AZURE SQL DATABASE▪ Connect straight from Management Studio once you’ve allowed access▪ Database size based on DTU’s▪ Actively developing

Page 7: Blue Sky Thinking

AZURE SQL DATABASE

Page 8: Blue Sky Thinking

NEW AZURE SQL DATABASE

Page 9: Blue Sky Thinking

AZURE WEB HOSTING▪ Azure Websites - Microsoft’s Web Hosting Offering

▪ Various Tiers from Free, Shared, Basic, Standard Tier▪ Scalable -More servers/Bigger servers▪ Staged Publishing/Deployment slots

▪ http://<site>-<slot name>.azurewebsites.net/

Page 10: Blue Sky Thinking

AZURE WEB HOSTING

Page 11: Blue Sky Thinking

NEW AZURE WEB HOSTING

Page 12: Blue Sky Thinking

SQL SPATIAL▪ A spatial data type, such as geography (or geometry) can be indexed with a spatial index▪ Various functions supported by spatial indexes▪ We will use the STDistance function

▪ Returns the shortest distance between two geography points

Page 13: Blue Sky Thinking

DATA - GEOSPATIALS▪ Get started with free digital map data

▪ OS Locator - A searchable gazetteer of road namesWe need current postcode’s▪ Code-Point Open - All of the current postcode

Page 14: Blue Sky Thinking

DATABASE – POSTCODESFor the postcodes table the obvious candidate for clustered index is the postcode field

Page 15: Blue Sky Thinking

DATABASE – HILLSFor the Hills table a natural unique index would Latitude and Longitude

Page 16: Blue Sky Thinking

DATABASE

Spatial Reference System Identifier (SRID) WGS84 — SRID 4326

"The World Geodetic System (WGS) is a standard for use in cartography, geodesy, and navigation. It comprises a standard coordinate system for the Earth, a standard spheroidal reference surface (the datum or reference ellipsoid) for raw altitude data, and a gravitational equipotential surface (the geoid) that defines the nominal sea level." - Wikipedia

Page 17: Blue Sky Thinking

DATABASELoch Ness Centre Exhibition Experience at IV63 6TU

Page 18: Blue Sky Thinking

DATABASEUsing nearest neighbour in SQL Azure we get the results:

Page 19: Blue Sky Thinking

DEMO

Page 20: Blue Sky Thinking

BING MAPS - RENDER

Page 21: Blue Sky Thinking

DATA – WEATHER

DataPoint is a way of accessing freely available Met Office data feeds in a format that is suitable for application developers. UK 3-hourly site-specific forecast -A quality controlled forecast out to 5 days for more than 5,000 locations. The DataPoint service is operating as BETA

Page 22: Blue Sky Thinking

SCOTTISH WEATHER ICON

Page 23: Blue Sky Thinking

DATA – WEATHER – STATION DATA

We can either get an XML stream or download the weather station locations as below;

Page 24: Blue Sky Thinking

DATA – WEATHER - GET STATIONDECLARE @CurrentLocation geographySET @CurrentLocation = geography::Point(@lat,@long, 4326)SELECT TOP(1) ID,name,ROUND(GeoLocation.STDistance(@CurrentLocation)/1000,2) AS [Distance (Km)]FROM [dbo].[WeatherPlaces] WITH(INDEX([ix_GeoLocation]))WHERE GeoLocation.STDistance(@CurrentLocation)IS NOT NULLORDER BYGeoLocation.STDistance(@CurrentLocation) ASC

Page 25: Blue Sky Thinking

DATA – WEATHER

Page 26: Blue Sky Thinking

DATA – DISPLAY WEATHER

Page 27: Blue Sky Thinking

THE SITE - VIDEO

Page 28: Blue Sky Thinking

USEFUL LINKS▪ Azure

▪ http://azure.microsoft.com/en-us/documentation/articles/sql-database-preview-whats-new/▪ http://azure.microsoft.com/en-us/pricing/details/sql-database/▪ http://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-get-started/

▪ OS▪ http://www.ordnancesurvey.co.uk/business-and-government/products/opendata-products.html

▪ Met Office - DataPoint▪ http://www.metoffice.gov.uk/datapoint

Page 29: Blue Sky Thinking

CONTACT▪ Thomas Sykes▪ Blog: sqltomato.com▪ twitter: @sqltomato▪ email:[email protected]

Page 30: Blue Sky Thinking

THANK YOU