[GIS] Change coordinate system using SQL or Javascript

coordinate systemjavascriptsql server

Is there any built in function in SQL Server 2008 R2 which can transform the cordinates from 102100 to 4269 coordinate system something equivalent to ST_Transform from postgres.
If there is algorithm to transform coordinates then that can also help or the Javascript library then that could also help.

Best Answer

There is no standard spatial function within SQL Server to do this. You will need to use SQL Server Spatial Tools or if you are geodetically inclined, create your own function.

The proj4js JavaScript library can, one trick is to ensure your projections are defined. Also ensure you are including a version of the proj4js library that supports your projections, or you will need to do it manually by defining that projections parameters.

Here is some kind of psuedo code that should work:

var source = new Proj4js.Proj('EPSG:4326');
var destination = new Proj4js.Proj('EPSG:4629');

var point = new Proj4js.Point(-43.81347656248869,51.17934297927967);
Proj4js.transform(source, destination, point);