Solved

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

Posted on 2011-09-12
2
680 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

789 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