[postgis-users] Bug or Problem with st_transform

Charles Galpin cgalpin at lhsw.com
Tue May 18 10:15:47 PDT 2010


Steve, I get the same results on 1.4 and 1.5 (but they differ from yours)

On 1.4

"PostgreSQL 8.4.2, compiled by Visual C++ build 1400, 32-bit"
"POSTGIS="1.4.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" USE_STATS"

"LINESTRING(0 0,4030 0,4030 4030,0 4030)";
"LINESTRING(0 0,2.46766330028192e-013 4030,-4030 4030,-4030 2.46766330028192e-013)";
"LINESTRING(0 0,2.21673965870407e-018 0.0362021035411944,-0.0362021059500167 0.0362021035411944,-0.0362021059500167 0)";
"LINESTRING(-71.26162 42.30028,-71.26162 42.3364821035412,-71.29782210595 42.3364821035412,-71.29782210595 42.30028)"

On 1.5 

"PostgreSQL 8.4.2 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42), 64-bit"
"POSTGIS="1.5.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.6.26" USE_STATS"

"LINESTRING(0 0,4030 0,4030 4030,0 4030)";
"LINESTRING(0 0,2.46766330028192e-13 4030,-4030 4030,-4030 2.46766330028192e-13)";
"LINESTRING(0 0,2.21673965870407e-18 0.0362021035411944,-0.0362021059500167 0.0362021035411944,-0.0362021059500167 0)";
"LINESTRING(-71.26162 42.30028,-71.26162 42.3364821035412,-71.29782210595 42.3364821035412,-71.29782210595 42.30028)"

hth,
charles

On May 18, 2010, at 11:39 AM, Stephen Woodbridge wrote:

> Mark Cave-Ayland wrote:
>> Stephen Woodbridge wrote:
>>> Hi guys,
>>> 
>>> This is looking like it might be a bug on version "POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS" which I know is ancient, but upgrading is not trivial.
>>> 
>>> What I am trying to do is construct a shape in 900913 in meters and then rotate, transform it to 4326 and translate it to a location.
>>> 
>>> The problem is the transform does not look correct. To just rough out the math, 4030 meters should be about 0.036202 degrees based on
>>> 4030/40075016*360 = 0.036202 but st_transform is giving back numbers like -5.67596869587729e-09
>>> 
>>> Is this a known problem on this version?
>>> Is my logic faulty?
>>> Is there a better way to do this?
>>> 
>>> Thanks,
>>>  -Steve
>> Hi Steve,
>> The first thing I would suggest is that you run the same query on a spare fresh 1.4/1.5 installation and see what happens. The transformation code had a good tidy up and some logic corrections within that timeframe, including better reporting of error messages.
> 
> Hi Mark, et al,
> 
> 1) Can someone run this query 1.4 and report back the results:
> 
> SELECT astext(st_linefromtext('LINESTRING(0 0,4030 0,4030 4030,0 4030)', 900913)),
>       astext(st_rotate(st_linefromtext('LINESTRING(0 0,4030 0,4030 4030,0 4030)', 900913), radians(90))),
>       astext(st_transform(st_rotate(st_linefromtext('LINESTRING(0 0,4030 0,4030 4030,0 4030)', 900913), radians(90)), 4326)),
> 
> astext(st_translate(st_transform(st_rotate(st_linefromtext('LINESTRING(0 0,4030 0,4030 4030,0 4030)', 900913), radians(90)), 4326),-71.26162, 42.30028));
> 
> It assumes that you have 900913 loaded in your spatial_ref_sys table.
> 
> 2) Does anyone know where I can get postgis 1.4 for debian lenny. I can get postgresql 8.4 from from backports.org, but they do not have postgis there. Ideally, at package like postgresql-8.3-postgis based on 1.4 would be simplest, but I'm willing to take a couple of days to dump and reload all my databases to upgrade to postgresql 8.4 also.
> 
> Thanks,
> -Steve
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list