[postgis-users] Bug or Problem with st_transform

Stephen Woodbridge woodbri at swoodbridge.com
Tue May 18 08:39:42 PDT 2010


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



More information about the postgis-users mailing list