문제

In a sql query I can say

select * 
from location
where geoLocation.STDistance(0xE6100000010CDDB5847CD0EB42C033333333331F6240) < 10000

but how do I pass that 0xE61... bit in programatically.

when returning in from the database, it appears to be in a binary format. Thus just putting it into the query doesn't work. If I put it in as type binary it doesn't work either.

Is there a way to retrieve the Geolocation from the database that retains it in the above format, i've tried casting it to varchar but it ends up like POINT(....

도움이 되었습니까?

해결책

SQL has a bunch of static methods for creating geospatial data. Check this out (specifically the OGC static and Extended static links). For example:

DECLARE @g geography;
SET @g = geography::STPointFromText('POINT(-122.34900 47.65100)', 4326);
SELECT @g.ToString();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top