Wondering how would i go about getting this to work.
I have a table with location data (lat, long, homevalue) in sql server 2008. Given a lat long say (32.113, -81.3225), i want to draw a 50 mile radius circle and get the number of locations and total home value within the circle buffer.
Thanks vic
Mapoholic,
Thanks for your reply. If i understand you correctly, you are using the "shape" as an attribute to perform stintersect and stbuffer on the location table. My limitations are that, i have the location table which has just the lat, long, homevalue in dollars. I need to independently draw a cirlce based on the given lat long, which if i am doing it right would be like this
DECLARE @Result geography SELECT @Result = geography::Point(32.113, -81.3225,4326); select @Result.STBuffer(10000);
and then i need to JOIN or use some method to check if the lat longs in the location table are within the @Result.STBuffer(10000). Any ideas?
Thanks again
vic
shape
, and so the query is testing the intersection of a buffered point and each row of thelocations
table. Beware that doing such queries on large areas that haven't been projected will give you incorrect results. This would be ok at city level, but would be very poor at state or country size. PostGIS has a geography type that alleviates some of these problems, but I don't know if SQL-server does. – MerseyViking Jul 27 '11 at 13:31select * from pois_wgs84 where geography::STPointFromText('POINT(' + CAST(x_col as varchar) + ' ' + CAST(y_col as varchar) +')', 4326) .STIntersects(geography::STPointFromText('POINT(32.113 -81.3225)', 4326).STBuffer(10))=1 (assuming your lat/lon columns are called X_COL, Y_COL
– mapoholic Jul 28 '11 at 13:46