Re: [postgis-users] Bug or Problem with st_transform
Those are the correct answers... On Tue, May 18, 2010 at 10:15 AM, Charles Galpin wrote: > 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@postgis.refractions.net >> http://postgis.refractions.net/mailman/listinfo/postgis-users > > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Bug or Problem with st_transform
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@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Bug or Problem with st_transform
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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Bug or Problem with st_transform
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. HTH, Mark. -- Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063 Sirius Labs: http://www.siriusit.co.uk/labs ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Bug or Problem with st_transform
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 900913 definition: 900913;"spatialreference.org";900913;"PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown", SPHEROID["unnamed",6378137,0]],PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"], PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",0], PARAMETER["false_easting",0],PARAMETER["false_northing",0], UNIT["Meter",1], EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@null +wktext +no_defs"]]";"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@null +wktext +no_defs" Test query showing problem: 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)) I also get messages: WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) WARNING: transform: -38 (failed to load NAD27-83 correction file) The results are: "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,3.47552844773335e-25 5.67596699566489e-09,-5.67596869587729e-09 5.67596699566489e-09,-5.67596869587729e-09 0)"; "LINESTRING(-71.26162 42.30028,-71.26162 42.300280005676,-71.261620005676 42.300280005676,-71.261620005676 42.30028)" ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users