none
Querying all points within geography coordinates returns no data RRS feed

  • Question

  • Bing Maps is giving me bounding coordinates as opposite points on a box that looks like this:

    '34.763402330018245,-76.65003395080568,34.692861148846255,-76.86890220642091'

    In my SQL Query, I using that data to draw the box as a polygon in the clockwise direction, but not getting any data. If I draw it counter-clockwise, I appear to get everything outside of the box.

    SET @g = geography::STPolyFromText('POLYGON((
    34.763402330018245 -76.65003395080568,
    34.692861148846255 -76.65003395080568,
    34.692861148846255 -76.86890220642091,
    34.763402330018245 -76.86890220642091,
    34.763402330018245 -76.65003395080568))', 4326);

    In my Where, I have @g.STContains(geography::Point(p.Latitude, p.Longitude,4326 )) = 1

    Can someone tell my what I am doing wrong?

    Friday, December 6, 2019 11:58 AM

All replies

  • Hi zBestDataLLC,

     

    >>Can someone tell my what I am doing wrong?

     

    Would you please try to use geometry instead of geography?

     

    Best regards,

    Dedmon Dai


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, December 9, 2019 3:27 AM