Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:24:59+00:00 2026-05-23T16:24:59+00:00

Hi I have a point cloud in my database (Sql server 2008 spatial). That

  • 0

Hi I have a point cloud in my database (Sql server 2008 spatial). That is about 6 million records. There are 3 columns: id, value , geom.
What is the most optimized way of getting the ‘value’ at input lat long ??

I am new to spatial queries in SQL Server 2008. Can some one post simple example of finding the point in geom column, matching or closest from the input lat long?

Thanks
Shaunak

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:25:00+00:00Added an answer on May 23, 2026 at 4:25 pm

    Assuming that you have a table Wifi with columns: id, placeName, locationCoord (geography):

    CREATE TABLE [dbo].[WiFi](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [placeName] [varchar](500) NULL,
    [locationCoord] [geography] NULL,
    CONSTRAINT [PK_WiFi] PRIMARY KEY CLUSTERED ([id] ASC))
    

    Here the locationCoord is a geography type. Lets say the input is a latitude and longitude as varchar datatypes. You can get the nearest points/locations by using something like:

    declare @longitude varchar(50) = '-77.26939916610718', @latitude varchar(50) = '39.168516439779914'
    
    declare @ms_at geography, @locationString nvarchar(1000)
    
    set @locationString = 'SELECT @ms_at = geography::STGeomFromText(''POINT(' + @longitude + ' ' + @latitude + ')'', 4326)'
    
    exec sp_executesql @locationString, N'@ms_at geography OUT', @ms_at OUT
    
    select nearPoints.placeName, nearPoints.locationCoord.STDistance(@ms_at) as distance 
    ,RANK() OVER (ORDER BY nearPoints.locationCoord.STDistance(@ms_at)) AS 'Rank'
    from
    (
    select r.id, r.placeName, r.locationCoord 
    from WiFi r 
    where r.locationCoord.STIntersects(@ms_at.STBuffer(10000)) = 1
    ) nearPoints
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that floating point calculations have accuracy issues and there are plenty of
I am working on a project which uses a relational database (SQL Server 2008).
I have a very large point cloud (> 100000 points) that I'd like to
Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2},
I have a point in a rectangle that I need to rotate an arbitrary
I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got
I have a floating point value X which is animated. When in rest it's
I have a 3D volume and a 3D point cloud. How can I draw
If I have a set of 3d points (AKA point cloud) what is the
I've gotten to the point where I have made a few classes that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.