A View Inside My Head

Jason's Random Thoughts of Interest
posts - 65, comments - 163, trackbacks - 9

Wednesday, March 04, 2009

For Jeff: Spatial Querying

A quick sample of usage as requested by my friend Jeff McWherter:

Querying for all data in a table where the "zip code polygon" is within 20 miles of a geocode point (must convert 20 miles to meters in the predicate)::

select * 
from dbo.fe_2007_us_zcta500 
where Boundary.STDistance('POINT(-79.8884595930576 43.2609696686268)') < (20 * 1609.344) 

posted @ Wednesday, March 04, 2009 6:08 PM | Feedback (1) | Filed Under [ SQL Spatial ]

Powered by: