Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 363CE9FBA30 for ; Wed, 25 Apr 2007 11:17:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 04000-01-5 for ; Wed, 25 Apr 2007 11:17:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id A3AF09FBACC for ; Wed, 25 Apr 2007 11:17:03 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l3PEGus2036236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Apr 2007 08:17:00 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l3PEGuas005797; Wed, 25 Apr 2007 08:16:56 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l3PEGuji005796; Wed, 25 Apr 2007 08:16:56 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 25 Apr 2007 08:16:56 -0600 From: Michael Fuhr To: Nemo Terry Cc: pgsql-sql@postgresql.org Subject: Re: Which function transform x,y to latitude/longitude? Message-ID: <20070425141655.GA5472@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/245 X-Sequence-Number: 28245 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