Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SPATIAL SQL Server 2008


SPATIAL SQL Server 2008

Author
Message
prbscosta
prbscosta
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
How can I use STTOUCHES with a GEOMETRY field? Can it be converted? How?

Regards
zerko
zerko
SSC Eights!
SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)SSC Eights! (950 reputation)

Group: General Forum Members
Points: 950 Visits: 712
A couple of points on this post, (given it has been here unanswered for quite a while, the info may be a bit late to help for the original post, but may help others)

first, the Geography and Geometry methods are case sensitive, so you must use STTouches()

second, STTouches() return type is Boolean ... so can be used wherever a boolean comparison is required (Case statements, IF..Then, etc) but not sure what the question "Can it be converted?" is referring to here. If this is referring to using this method against Geography data, the answer would be 'no, not without converting the data type'

finally, the example in 'online help' (see http://msdn.microsoft.com/en-us/library/bb933953.aspx) will always return 'false' as it is testing a linestring geometry against a point geometry. The text of the help topic states that "Two geometry instances touch if their point sets intersect, but their interiors do not intersect." As neither the linestring nor the point geometries have an interior, the result is always false.

a better example of using STIntersects(), here checking if a line touches a polygon. This example returns 'true':
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 2, 2 0, 4 2, 0 2))', 0);
SET @h = geometry::STGeomFromText('LINESTRING(3 2, 4 3)', 0);
SELECT @g.STTouches(@h);



Note also that the function should always be symmetrical, so that @g.STTouches(@h) will return the same as @h.STTouches(@g)

Hope this helps.
anthony.green
anthony.green
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6102 Visits: 6078
carlecot88ssn (1/18/2013)
Diverse fashion principles can be recognized with different designers. Various people also think of it as the typical vintage style dragged from the early 70s. These explanations are correct and this is what the designers after these immense styles wish their constantly increasing customers to keep on believing.:-P


Reported



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search