Solved

Conversion of LineString to GEOGRAPHY throwing an error that makes no sense

Posted on 2011-09-12
2
677 Views
Last Modified: 2012-06-27
I am hoping someone can assist me understanding a very confusing set of circumstances:
I have a database of geographic locations (Latitude / Longitude) that make up routes a person has travelled. To work out the distance travelled I transform these Lat/Lon pairs into a LINESTRIMG, and convert it to type GEOGRAPHY (and then I manipulate it). The problem I am having is repreesented by the code attached (I have many similar examples, but this is the most confusing).

It is not a string length problem; instead it is something to do with the pattern of the data and I am in the dark as to where the problem cound be. GEOGRAPHY-Data.txt
0
Comment
Question by:Bird757
2 Comments
 
LVL 7

Accepted Solution

by:
kemi67 earned 500 total points
ID: 36527577
I agree that there is a problem in the data set.
Linestring must meet some criteria as written here:
http://technet.microsoft.com/en-us/library/bb895372.aspx

Accepted Instances
Accepted LineString instances can be input into a geometry variable, but they may not be valid LineString instances. The following criteria must be met for a LineString instance to be accepted. The instance must be formed of at least two points or it must be empty. The following LineString instances are accepted.

Valid Instances
For a LineString instance to be valid it must meet the following criteria.
The LineString instance must be accepted.
If a LineString instance is not empty then it must contain at least two distinct points.
The LineString instance cannot overlap itself over an interval.

So, as you have done, you must remove the first segment because starting point and ending point are the same.
Furthermore I think that you must search for overlapping over an interval: probabily this is the cause
Do you have a tool to draw the path, so you can visual check overlapping ?
0
 

Author Closing Comment

by:Bird757
ID: 36528033
Important to note; there cannot be a duplicate data point! Lines can cross but what was causing my error was an exact repeat of a co-ordinate.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now