Solved

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

Posted on 2011-09-12
2
681 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

730 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