title: Access PostGIS Functions from plv8
body: <p>I am trying to write a plv8 function that returns an integer representing a UTM zone value.  The function utilizes PostGIS functions.  Here is the (not-functioning) idea:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION utm_z(geometry)
    RETURNS integer AS
    $$
      var geom_geog = st_transform($1, 4326);
      var utm_zone = Math.floor((st_x(geom_geog)+180)/6)+1;
      return utm_zone;
    $$ LANGUAGE plv8;
  </code></pre>
  
  <p>When invoking that function I get</p>
  
  <p><code>ERROR:  ReferenceError: st_transform is not defined</code></p>
  
  <p>How am I able to access those PostGIS functions from inside plv8?</p>
  
  <p>EDIT:
  PostGIS is installed and functioning in this DB.
  <a href="https://i.stack.imgur.com/1eLWP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1eLWP.png" alt="enter image description here"></a></p>