Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

691 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