Ticket #1238 (closed defect: fixed)

Opened 20 months ago

Last modified 20 months ago

[raster] Resample and upperleftx , upperlefty

Reported by: standa Owned by: pracine
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: trunk
Keywords: ST_Resample Cc:

Description

Hi I load in the raster having SRID = 4326 I like to reproject this raster to the 3844 when I test

SELECT rid, (foo.md).* FROM (SELECT rid,ST_MetaData(ST_Resample(rast,3844,0.002,0.002)) As md FROM dem_table1 WHERE rid=1) as foo;

and obtain the same upperleftx , upperlefty as for the original raster. I tested also ST_Transform - the same result -> is it OK? Thank you

Change History

Changed 20 months ago by dustymugs

  • summary changed from Resample and upperleftx , upperlefty to [raster] Resample and upperleftx , upperlefty

No. That is incorrect. What versions (and revisions) of GDAL and PostGIS are you using? I created a test transforming from 4326 to 3844

SELECT rid, (ST_Metadata(rast)).* FROM (
(
SELECT
	1 AS rid,
	ST_AddBand(
		ST_MakeEmptyRaster(1, 1, 24.818115, 45.822675, 0.01, 0.01, 0, 0, 4326),
		1, '8BUI', 1
	) AS rast
) UNION ALL (
SELECT
	2 AS rid,
	ST_Transform(
		ST_AddBand(
			ST_MakeEmptyRaster(1, 1, 24.818115, 45.822675, 0.01, 0.01, 0, 0, 4326),
			1, '8BUI', 1
		),
		3844
	) AS rast
)
) AS foo;

If you run the SQL above, the results should be similar to:

rid;upperleftx;upperlefty;width;height;scalex;scaley;skewx;skewy;srid;numbands
1;24.818115;45.822675;1;1;0.01;0.01;0;0;4326;1
2;485990.139598202;481453.235469657;1;1;958.718116254953;-958.718116254953;0;0;3844;1

The results above are from a machine running GDAL svn-trunk r23215 and PostGIS svn-trunk r7964.

Changed 20 months ago by dustymugs

A thought occurred to me. Are you running Windows?

Changed 20 months ago by standa

Windows

Changed 20 months ago by standa

I obtain wrong result = I have wrong version

I am using version downloaded from

 http://www.postgis.org/download/windows/experimental.php#wktraster

For PostgreSQL 9.0(compiled .....)

Where I can download proper one? I am new in this area.

Changed 20 months ago by dustymugs

I'm pretty sure that you have the correct version. But, I can't tell which Windows package you are using. You should be using  http://www.postgis.org/download/windows/pg90/experimental/postgis/postgis-pg90-binaries-2.0.0svn.zip

My guess is that GDAL isn't able to find the PROJ library since the upper-left corner isn't changing. You may want to try setting the environmental variable PROJSO and see if that helps.

 http://trac.osgeo.org/gdal/wiki/ConfigOptions#PROJSO

Can you post your results from the SQL query I posted?

As I don't use Windows, I'm hoping Regina can chime in and offer some wisdom.

Changed 20 months ago by standa

rid;upperleftx;upperlefty;width;height;scalex;scaley;skewx;skewy;srid;numbands 1;24.818115;45.822675;1;1;0.01;0.01;0;0;4326;1 2;24.818115;45.832675;1;1;0.00999999999999979;-0.00999999999999979;0;0;3844;1

Changed 20 months ago by standa

I am going home - I will connect in 1 hour. I use Transform for shape - and it look OK

Changed 20 months ago by dustymugs

Can you set the environmental variable PROJSO to the path and filename of the PROJ library and try again?

Changed 20 months ago by standa

  • status changed from new to closed
  • resolution set to fixed

Thank you very much - it work. :)

Note: See TracTickets for help on using tickets.