[postgis-users] Surplus pixels in raster for geometry smaller than pixel scale

David Swain david.swain at maruedr.com
Fri Apr 20 08:20:06 PDT 2018


Hi all,

I hope this is the right place and approach to get support for my issue. Apologies if it isn't.
Question also posted to the Gis reddit if I'm more likely to get help as replies on there (https://www.reddit.com/r/gis/comments/8dnsr2/could_a_more_experienced_giser_tell_me_why_i_get/)

In PostGis I run the following query:

    SELECT
      (ST_MetaData(ST_AddBand(ST_MakeEmptyRaster(1, 1, 2, 2, 10::FLOAT, 10::FLOAT, 0, 0), '1BB'))).*
    UNION ALL
    SELECT
      (ST_MetaData(ST_AsRaster(
          ST_MakeEnvelope(2, 2, 3, 3),
          0.5 :: FLOAT, 0.5 :: FLOAT,
          0, 0, '1BB', 1, 0, 0, 0, true
      ))).*
    UNION ALL
    SELECT
      (ST_MetaData(ST_AsRaster(
          ST_MakeEnvelope(2, 2, 3, 3),
          1 :: FLOAT, 1 :: FLOAT,
          0, 0, '1BB', 1, 0, 0, 0, true
      ))).*
    UNION ALL
    SELECT
      (ST_MetaData(ST_AsRaster(
          ST_MakeEnvelope(2, 2, 3, 3),
          10 :: FLOAT, 10 :: FLOAT,
          0, 0, '1BB', 1, 0, 0, 0, true
      ))).*
    ;

That gives me results:

    upperleftx | upperlefty | width | height | scalex | scaley | skewx | skewy | srid | numbands
    -----------+------------+-------+--------+--------+--------+-------+-------+------+----------
             2 |          2 |     1 |      1 |     10 |     10 |     0 |     0 |    0 |        1
             2 |          2 |     2 |      2 |    0.5 |    0.5 |     0 |     0 |    0 |        1
             2 |          2 |     1 |      1 |      1 |      1 |     0 |     0 |    0 |        1
             0 |        -10 |     2 |      2 |     10 |     10 |     0 |     0 |    0 |        1

What gets me is the final row. Why would the biggest pixel scale give a 2x2 raster?
If I dump the points I see

    {{NULL,NULL},{1,NULL}}

So it's created some null pixels for no reason that I understand.
Is this a bug? Could someone explain this behaviour for me?


David Swain

maru/edr<http://www.maruedr.com>
Follow us on LinkedIn<https://www.linkedin.com/company-beta/202826/>
Direct Dial:  +44 (0) 1489779830
Switchboard: +44 (0)1489 772920


The HUB | Berrywood Business Village | Southampton | SO30 2UN

We give ambitious businesses like yours the confidence to put the Voice of the Customer at the heart of important business decisions, driving sustainable growth.<http://www.maruedr.com>

*Email Confidentiality notice*. This email is private and confidential. If you have received this message in error, please notify us and remove it from your system. Any attachment(s) to this message have been checked for viruses, but please rely on your own virus checker and procedures.  Please note that email is not a secure communications medium. We advise that you understand and observe this when emailing us.

Maru/edr is a private limited company registered at the Registrar Of Companies for England and Wales. Company registration number: 5424597
Registered Office: The HUB, Hedge End, Hampshire, SO30 2UN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180420/f2da8531/attachment.html>


More information about the postgis-users mailing list