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

Vitor Sapucaia vsfortunato at gmail.com
Wed Jun 21 00:36:25 PDT 2017


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):

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

And this is the expected result I should have gotten: [image: 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-devel/attachments/20170621/f4ce476b/attachment.html>


More information about the postgis-devel mailing list