This project is read-only.

Function Units

Feb 7, 2008 at 4:19 AM
I am somewhat new to this, so please bear with me. I read a number of posts about the subject, but I still do not understand. I was able to get a spatial database setup and was able to add a number of simple point type objects to the database using the examples posted on this web site. So far so good, however, I am confused about the units which should be used and are returned by the various functions. The ST.IsWithinDistanceQuery is very helpful, however, I am not clear about the parameters this fucntion takes, and less clear about what it returns.
So Question one, the parameters of the ST.IsWithinDistanceQuery
ST.IsWithinDistanceQuery('Location', 'GeoPoint',
ST.GeomFromText('POINT(' + CAST(@CenterLon as varchar(100)) +
' ' + CAST(@CenterLat as varchar(100)) + ')', WHATISTHIS?), @ANDTHIS?) Please tell me what these parameters are?
Question 2
What I would like (perhaps expected) to see with the following SQL statement was a distance column in meters or kilometers:
SELECT *
FROM ST.IsWithinDistanceQuery('Location', 'GeoPoint',
ST.GeomFromText('POINT(' + CAST(@CenterLon as varchar(100)) +
' ' + CAST(@CenterLat as varchar(100)) + ')', 4236), @DistenceInMeters)
AS q
INNER JOIN Location AS t ON q.oid = t.LocationId
WHERE t.Enabled = 1
ORDER BY q.distance

However, what’s returned I am having a hard time making since of.? I know that two geo graphic coordinates can be accurately calculated, but there is only the “distance” column, what is this, and how can it be translated into meters or kilometers?

Thanks for the help