# [postgis-users] problem to transform coordinates

Guido Lemoine guido.lemoine at jrc.it
Mon Aug 4 08:58:50 PDT 2008

```Ah, this is more likely. You use km instead of m. And do the classical
Easting, Northing swap. Being in Brasil makes more sense for someone
called Pinto and using of 22523. Forget the South Pole explanation.

GL

Obe, Regina wrote:
> I get the same wrong answer so your install is fine.
>
> I don't think your coordinates are in 22523.  They seem to be truncated
> and flipped.
>
> For example
> Select ST_AsText(ST_Transform(ST_GeomFromText('POINT(-45
> -20.65)',4326),22523 ))
>
> Gives me
> POINT(500024.031982543 7716597.82168034)
>
> So its like your coordinates are flipped and then divided by 1000 or
> something
>
> Assuming that is what is happening - then your point should be
> - POINT(500290 7650676)
>
> SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(500290
> 7650676)',22523), 4326))
>
> Which would give me
>
> POINT(-44.9974366430774 -21.2456507664743)
>
> Is that more like what you were expecting for an answer?
>
> Hope that helps,
> Regina
>
> ________________________________
>
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> Felipe Fedel Pinto
> Sent: Monday, August 04, 2008 10:49 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] problem to transform coordinates
>
>
> SELECT ST_AsText(coord_22523)
> FROM coordsformiga limit 2;
> return:
>         st_astext
> -------------------------
>  POINT(7650.676 500.29)
>  POINT(7624.401 592.751)
> (2 rows)
>
>
>
> SELECT ST_AsText(ST_Transform(coord_
>
> 	22523, 4326))
> 	FROM coordsformiga limit 2;
>
> return:
>                  st_astext
> -------------------------------------------
>  POINT(140.139757378998 -89.9975973774248)
>  POINT(140.139757378998 -89.9975973774248)
> (2 rows)
>
>
> SELECT postgis_full_version();
>                                postgis_full_version
>
> ------------------------------------------------------------------------
> ----------
>  POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21 Dec 2007"
> USE_STATS
> (1 row)
>
>
>
>
>
> On Mon, Aug 4, 2008 at 10:20 AM, Obe, Regina <robe.dnd at cityofboston.gov>
> wrote:
>
>
> 	Felipe Fedel,
>
> 	Can you send a sample of your data - results of the 2 queries
> below
>
> 	SELECT ST_AsText(coord_22523)
> 	FROM coordsformiga limit 2;
>
> 	-- and result you get when you do
> 	SELECT ST_AsText(ST_Transform(coord_22523, 4326))
> 	FROM coordsformiga limit 2;
>
> 	Also what does
>
> 	SELECT postgis_full_version();
>
> 	give
>
> 	Only thought I have that could be wrong is your coordinates are
> not
> 	really 22523 or there is a problem with your proj 4 install. The
> above
> 	queries should pinpoint that.
>
>
> 	Hope that helps,
> 	Regina
>
> 	________________________________
>
> 	From: postgis-users-bounces at postgis.refractions.net
> 	[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf
> Of
> 	Felipe Fedel Pinto
>
> 	Sent: Monday, August 04, 2008 9:27 AM
> 	To: PostGIS Users Discussion
> 	Subject: Re: [postgis-users] problem to transform coordinates
>
>
>
> 	it also happens when I use ST_Transform and return the same
> thing from
> 	SELECT proj4text FROM spatial_ref_sys WHERE srid = 22523;
>
>
> 	Do you have another idea??
>
> 	Thanks!!!!
>
> 	Felipe Fedel
>
> 	On Thu, Jul 31, 2008 at 1:13 AM, Paragon Corporation
> <lr at pcorp.us>
> 	wrote:
>
>
> 	       Maybe there is something wrong with your entry in the
> 	spatial_ref_sys table for that SRID.  Also provide two sample
> 22523
> 	points and what the ST_Transform looks like.
>
> 	       Also please use ST_Transform if you are using a PostGIS
> install
> 	> 1.2
>
> 	       What does
>
> 	       SELECT proj4text
> 	       FROM spatial_ref_sys
> 	       WHERE srid = 22523
>
> 	       give you?
>
> 	       Mine gives
> 	       +proj=utm +zone=23 +south +ellps=intl
> 	+towgs84=-206,172,-6,0,0,0,0 +units=m +no_defs
>
> 	       Hope that helps,
> 	       Regina
>
> 	________________________________
>
> 	       From: postgis-users-bounces at postgis.refractions.net
> 	[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf
> Of
> 	Felipe Fedel Pinto
> 	       Sent: Wednesday, July 30, 2008 7:26 PM
> 	       To: postgis-users at postgis.refractions.net
> 	       Subject: [postgis-users] problem to transform coordinates
>
>
> 	       To transform coordinates in PostGis I use the followed
> function:
>
> 	       UPDATE <table> SET <new_geometry_column> =
> 	transform(<original_geometry_column>,<new_SRID>);
>
> 	       I have been having a weird problem when I try to
> transform
> 	coordinates that are in a SRID=22523.
> 	       Ex: I have to transform them to a SRID=4326
>
> 	       UPDATE coordsformiga SET coord_4326 =
> 	transform(coord_22523,4326);
>
> 	       where coordsformiga is the table,
> 	                 coord_22523 is the original geometry column
> with the
> 	coordinates in a SRID=22523
> 	                 coord_4326 I'd be the geometry column with the
> 	coordinates transformed in a SRID=4326
>
> 	       the problem is:
> 	       After the function, in the geometry column (coord_4326),
> all of
> 	the 97 coordinates have the same values.
> 	       But it's happening only with a SRID=22523.
>
> 	       Anybody knows what is happening??
>
> 	       thanks
>
>
>
> 	       _______________________________________________
> 	       postgis-users mailing list
> 	       postgis-users at postgis.refractions.net
>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
>
>
> 	-----------------------------------------
> 	The substance of this message, including any attachments, may be
> 	confidential, legally privileged and/or exempt from disclosure
> 	pursuant to Massachusetts law. It is intended
> 	contact the sender and delete the material from any computer.
>
>
> 	_______________________________________________
> 	postgis-users mailing list
> 	postgis-users at postgis.refractions.net
> 	http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

--
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Support to External Security
Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Disclaimer:
Views expressed are those of the individual and do not represent
the views of the European Commission

```