Try setting the ST_MakeEmptyRaster() upperlefty parameter to a negative value 
(-1).

Pierre

De : postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] De la part de 
Vitor Sapucaia
Envoyé : 21 juin 2017 04:58
À : postgis-users@lists.osgeo.org
Objet : [postgis-users] PostGIS ST_EuclideanDistance() not working. Wrong 
upperleftx and y?

Hello guys!

I need help on this question that I've posted on GIS stackexchange:
https://gis.stackexchange.com/questions/244622/postgis-st-euclideandistance-not-working-wrong-upperleftx-and-y?noredirect=1#comment383015_244622

here is the question:


I'm trying to make this ST_EuclideanDistance() function work, but no success so 
far. I'm not getting the expected result because the raster seems to be drawn 
at a wrong location.

Documentation:

https://trac.osgeo.org/postgis/wiki/PostGIS_Raster_SoC_Idea_2012/Distance_Analysis_Tools

Firstly, I'm considering this test page to test the function:

https://trac.osgeo.org/postgis/wiki/PostGIS_Raster_SoC_Idea_2012/Distance_Analysis_Tools/test

When running the second test case:

CREATE TABLE test_source_raster_1 AS

SELECT

    1 AS rid, rast

  FROM

    (SELECT

       ST_MakeEmptyRaster(10,10,0,0,1,1,0,0,4326) AS rast

     ) foo;

CREATE TABLE test_source_geometry_1 AS

SELECT

    generate_series(1,10) AS id,

    ST_RandomPoints(the_geom,10) AS the_geom

  FROM

    (SELECT

       ST_SetSRID(ST_Extent(rast::geometry), 4326) AS the_geom

    FROM test_source_raster_1) foo;

CREATE TABLE test_ref_raster_1 AS

SELECT

  1 AS rid, rast

  FROM

    (SELECT

       ST_MakeEmptyRaster(10,10,0,0,1,1,0,0,4326) AS rast

    ) foo;

 CREATE TABLE test_eudist_1_a_i_1 AS

   (SELECT

      1 AS rid,

      ST_EuclideanDistance(

         rast,'32BF','public',

         'test_source_geometry_1', 'the_geom', True

       ) AS rast

     FROM test_ref_raster_1);

I'm getting this result (every raster pixel is null):

[results]<https://i.stack.imgur.com/xPn7Z.png>

And this is the expected result I should have gotten:

[expected]<https://trac.osgeo.org/postgis/raw-attachment/wiki/PostGIS_Raster_SoC_Idea_2012/Distance_Analysis_Tools/test/test_eudist_1_a_i_1.gif>
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to