2. 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
3. THIS SESSION
▪ SQL Azure with Geospatial Data
▪ Azure Websites with Bing Maps
▪ Integrate another live data source
5. 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
6. AZURE SQL DATABASE
▪ Connect straight from Management Studio
once you’ve allowed access
▪ Database size based on DTU’s
▪ Actively developing
12. 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
13. 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
14. DATABASE – POSTCODES
For the postcodes table the obvious candidate for
clustered index is the postcode field
15. DATABASE – HILLS
For the Hills table a natural unique index
would Latitude and Longitude
16. 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
21. 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
23. DATA – WEATHER – STATION DATA
We can either get an XML stream or download the weather station
locations as below;
24. DATA – WEATHER - GET STATION
DECLARE @CurrentLocation geography
SET @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 NULL
ORDER BY
GeoLocation.STDistance(@CurrentLocation) ASC