[postgis-users] PostGIS ST_EuclideanDistance() not working. Wrong upperleftx and y?

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Jun 22 10:54:24 PDT 2017


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

Pierre

De : postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Vitor Sapucaia
Envoyé : 21 juin 2017 04:58
À : postgis-users at 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170622/83de9ab6/attachment.html>


More information about the postgis-users mailing list