Search code examples
sqlbuffertransformpostgisspatial

PostGIS, ST_Transform (no function exists..)


I have the following code to get 30m geometry shapes from a point layer already created

CREATE TABLE intrsct_buff AS ( SELECT ST_Transform( ST_Buffer( ST_Transform(pt.geom,4326)::geography, 30.0), 2263) as geom, pt.count FROM public.intrsct_pts as pt );

I keep receiving the error: LINE 3 function st_transform(geography, integer) does not exist What do I need to add in front of ___,SRID 2263? That seems to be the ST_Transform function where they say I have an error


Solution

  • You need to transform the geography back into geometry; ST_Transform does not work with geography:

    CREATE TABLE intrsct_buff AS ( 
      SELECT
        ST_Transform(
          ST_Buffer(
            ST_Transform(
              pt.geom,
              4326
            )::geography,
            30.0
          )::geometry,
          2263
        ) as geom,
        pt.count
      FROM
        public.intrsct_pts as pt
    );