Friday, 6 September 2013

SQL Server 2012 Spatial data

SQL Server 2012 Spatial data

new to Spatial data in sql server 2012. I am trying to show SUM of
donation by location(city, state, country) on donation website. I am
getting address from PayPal for each donation and for donators privacy I
do not want to show it on the map, instead I want to point by city
SUMSUM(d.Amount) , zoom by SUM(d.Amount) by states and counties. I created
tables like city, state and country and each has a GEOGRAPHY DATA
converted from LONGITUDE AND LATITUDE addresses from PayPal. how can I
create POLYGON STWithin or better idea around that address? so far I have
a script for SPROC: SELECT SUM(d.Amount)AS Total ,d.CityId INTO #CityGroup
FROM dbo.Donation d INNER JOIN dbo.City s ON s.CityId = d.CityId
WHERE d.CityId IS NOT NULL --AND s.Geo.STWithin( GROUP BY d.CityId
SELECT d.Total , s.Name AS Location, s.Geo.Lat AS Latitude, s.Geo.Long AS
Longitude FROM #CityGroup d INNER JOIN dbo.City s ON s.CityId = d.CityId
ORDER BY d.Total DESC
DROP TABLE #CityGroup all I have GEOGRAPHY data
0xE6100000010CF35DA516A53B44404E621058399A52C0 and LONGITUDE and LATITUDE.
ANY IDEAS PLEASE . THANK YOU

No comments:

Post a Comment