Sudeep Kulkarni
Sudeep Kulkarni

Reputation: 13

Converting cartesian coordinates to latitude/longitude in Geographical Data

I have a database, which uses the GGRS87 reference system, and contains x-y coordinates of objects. I need to convert them to lat/lon, so that I can store them in SQL Server 2012 using Geography data type.

Or is there a way I can use those x-y coordinates directly to create a geography data? Please let me know.

Upvotes: 1

Views: 2882

Answers (1)

pecoanddeco
pecoanddeco

Reputation: 145

You can use the xy value directly to create the geometry objects, as long as you know the SRID code for the GGRS87 co-ordinate system (I think it's 4121).

Then use the STGeomFromText method to create your features. E.g.

INSERT INTO SpatialTable (GeogCol1)
VALUES (geography::STGeomFromText('POINT(122 47)', 4121));

Upvotes: 1

Related Questions