0

I am trying to select all the parks within 200m or a railway. I can easily create and visualise the 200m buffer. However when i try and find only the parks that intersect it i get all parks returned, not just those in the intersection area. This is the code i have so far:

SELECT 
P.[geogtab] as parks, 
P.[id] as park_id 
FROM [dbo].[railway] S 
inner JOIN
[dbo].[parks] P 
ON
S.geogtab.STBuffer(200).STIntersects(P.geogtab) = 1

geogtab is my geography column and it is indexed. Is there an error in my syntax that causes all items from Table P (the parks) ?

asked Mar 2, 2018 at 16:57
2
  • 1
    is your data in a meters projection or have you asked for a 200 degree buffer? Commented Mar 2, 2018 at 17:04
  • its geography so always meters i assume? But as a check i viewed the buffer on a map and that is the right size. I also just did a check IsValid() is true for the object being buffered Commented Mar 2, 2018 at 18:04

1 Answer 1

0

You likely have a projection error, or a unit error between two projections (ie, meters vs. decimal degrees). Make sure both your files are in a common projection, using meters, and try again. Try using epsg:5070, USA_Contiguous_Albers_Equal_Area_Conic_USGS_version

answered Mar 2, 2018 at 21:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.