Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this article I will describe the Detach & Attach 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.
In this article I will describe the Backup & Restore 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.
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

759 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

19 Experts available now in Live!

Get 1:1 Help Now