Re: Which function transform x,y to latitude/longitude?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Nemo Terry <ntuser155(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Which function transform x,y to latitude/longitude?
Date: 2007-04-25 14:16:56
Message-ID: 20070425141655.GA5472@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Apr 25, 2007 at 05:02:02PM +0800, Nemo Terry wrote:
> For example x= 38356.62 y= 42365.19.how to transform it to latitude
> 1.399948, longitude 193.92644?

Do you mean longitude 103.92644? In what datum are the lat/lon
coordinates? Where did you get the transformation in your example?

> Which function I could use? I don’t know the algorithm.
>
> Initial data is: ("+proj=cass +a=6378137.0 +rf=298.257223563
> +lat_0=1.287639n +lon_0=103.8516e +x_0=30000 +y_0=30000").

What's the source of these parameters?

You can perform transformations outside the database with PROJ.4
or inside the database with the PostGIS transform() function (which
uses PROJ.4).

http://proj.maptools.org/
http://postgis.refractions.net/

I don't see any exact matches in the PostGIS spatial_ref_sys table
for the parameters you posted you so if you use PostGIS then you
might have to insert a row to create your own spatial reference
system. However, I did a few tests with your parameters and various
datums for the lat/lon and couldn't get the exact transformed values
in your example.

You might get more help on the PROJ.4 and PostGIS mailing lists.

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2007-04-25 17:59:48 Re: Query Join Performance
Previous Message Richard Albright 2007-04-25 13:54:29 Re: plpgsql array looping