pg.ddx.io  postgis-users@lists.osgeo.org mailing list archive (PostGIS users)  
help / color / mirror / Atom feed
From: Gary Townsend <garyt@spatialmapping.com>
Subject: [postgis-users] (no subject)
Date: Fri, 8 Jun 2007 14:16:59 -0700
Message-ID: <004e01c7aa12$5a0615f0$8a00a8c0@spatialmapping.com> (raw)

Below is a function I am trying to create that will take a series of
geographic points form a UTM projection and translate it to lat/long that's
not the problem though the translation works wonderfully as a separate
select statement. I'm trying to encapsulate this into a function now and I
am getting a problem returned saying: 

 

ERROR: syntax error at or near "$2"

SQL state: 42601

Character: 137

Context: PL/pgSQL function "vts_insert_stop" line 10 at select into
variables

 

I'm not sure where I've gone sideways on this but seeing as how I'm still
learning the pgplsql syntax I figured it could be anywhere I thought maybe
someone here may have a better soloution to what I'm trying to do or can see
what I'm doin wrong.

 

 

CREATE OR REPLACE FUNCTION vts_insert_stop(text, text, numeric, numeric,
numeric)

  RETURNS numeric AS

'

 

DECLARE

      stopnum ALIAS for $1;

      stopdes ALIAS for $2;

      stopeasting ALIAS for $3;

      stopnorthing ALIAS for $4;

      projection ALIAS for $5;

      transCoord RECORD;

BEGIN

      SELECT INTO transCoord X(SubSel.transformed_geom),
Y(SubSel.transformed_geom) FROM (

        SELECT SetSRID(

          Transform(

            GeomFromText(

            ''POINT('' || stopeasting || '' '' stopnorthing || '')'',
projection

            ), 4326

          ),

        -1) AS transformed_geom) SubSel;

      

      INSERT INTO
vts_route_stops(stop_number,stop_description,stop_latitude,stop_longitude)

      VALUES(stopnum,stopdes,transCoord.Y,transCoord.X);

 

      RERTURN void;

 

END'

  LANGUAGE 'plpgsql' VOLATILE;

 

 

 





Gary Townsend (Systems Programmer & Developer )

Spatial Mapping Ltd.

#200 484 2nd Ave. Prince George, B.C., Canada V2L 2Z7

Phone: 250 564 1928

Fax: 250 564 0751

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070608/40dccc3a/attachment.html;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2661 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070608/40dccc3a/attachment.gif;



view thread (131+ messages)  latest in thread

Message-ID: <004e01c7aa12$5a0615f0$8a00a8c0@spatialmapping.com>
Permalink:  ../004e01c7aa12$5a0615f0$8a00a8c0@spatialmapping.com/

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgis-users@lists.osgeo.org
  Cc: garyt@spatialmapping.com
  Subject: Re: [postgis-users] (no subject)
  In-Reply-To: <004e01c7aa12$5a0615f0$8a00a8c0@spatialmapping.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox