Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Storing geospatial data from lat-long info?

Author  Topic 

yankleber
Starting Member

5 Posts

Posted - 2011-09-26 : 14:05:29
Hi,

Hopefully my question won't be too hard to be answered. :)

I have an old geo system written in Flash that uses UTM coordinates.

Now we are starting to convert the old app into a brand new SilverLight app with Telerik RadMap control.

Anyway, the case is that I have to transfer all of my UTM coordinates (that are in float type) to a new table but as geography type.

I know how to convert UTM for Lat/Long and put it in the text format as when it is spitted out with the STAsText() method, like this:

POLYGON ((-94.264725 45.56300, -94.265000 45.56320, -94.264725 45.56320, -94.264725 45.56300 ))

However, I need to know how to cast it into binary type to properly store it in a geography table column.

Any idea?

Thanks!

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-09-26 : 14:32:56
I don't have much experience with this but can't you store it using: STGeomFromText? (assuming you have a valid polygon input)
That is the way the example in Books Online do it.

Be One with the Optimizer
TG
Go to Top of Page

yankleber
Starting Member

5 Posts

Posted - 2011-09-26 : 16:22:37
Thanks, TG - it really helped a LOT!!!!!
However, actually the method that will be useful for me is the STPolyFromText()

:)
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-09-26 : 18:02:23
Great - glad you got it!

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -