3

I'm working with thematic maps with ST_ColorMap function smoothly until I try to create my own thematic map(colormap).

WITH
 canvas AS (
        SELECT ST_Raster(
                ST_SetSRID(ST_Extent(geom), 4326),
                800,
                (800 * (SELECT (Max(ST_YMax(geom)) - Min(ST_YMin(geom))) / (Max(ST_XMax(geom)) - Min(ST_XMin(geom)))))::integer,
                '32BF', 0, 0) AS rast
          FROM estado
           )
SELECT ST_AsPNG(
        ST_ColorMap(
         ST_Union(ST_AsRaster(geom, canvas.rast, '32BF'::text, aland, 0)),'
                 100% 255   0   0
                  80% 160   0   0
                  50% 130   0   0
                  30%  30   0   0
                  20%  60   0   0
                   0%   0   0   0
                   nv 255 255 255
                  ')) AS rast

I get the following error:

ERROR:  Unknown colormap keyword: 
100% 255   0   0
 80% 160   0   0
 50% 130   0   0
 30%  30   0   0
 20%  60   0   0
  0%   0   0   0
  nv 255 255 255

I tried the first example in the documentation for PostGIS: ST_ColorMap, and I get the same error. Only works fine with pre-defined colormap keywords.

Any ideas?

PostgreSQL version: "PostgreSQL 9.3.5, compiled by Visual C++ build 1600, 64-bit"

PostGIS version: "POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER"

1
  • You will need to add a bit more information, such as the query you are running. Commented Oct 30, 2014 at 19:38

1 Answer 1

2

The problem is the line break after the opening apostrophe. :$

1
  • I can't believe this is the right answer
    – wxactly
    Commented Feb 28 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.