[postgis-users] Mathematical Operators

Bob Pawley rjpawley at shaw.ca
Wed Jun 24 09:59:27 PDT 2009


I would like to have mathematical operators accessed from a table ie. the minus in the red expression - in the following function to +.

 update fluids
 set flow_arrow_ithe_geom  = 
 ( select (st_translate(graphics.utilities_dgm.the_geom, 
  st_x(p_id.p_id.ithe_geom) -
  (ST_distance(p_id.p_id.the_geom, p_id.p_id.ithe_geom)/ (graphics.ip_matrix.flow_arrow_divider)) -
 st_x (st_startpoint(graphics.utilities_dgm.the_geom)) ,
 st_y (p_id.p_id.ithe_geom) - 
 st_y (st_startpoint(graphics.utilities_dgm.the_geom)))) 
  from graphics.utilities_dgm, p_id.p_id, p_id.processes   
  where p_id.p_id.process_id = p_id.processes.process_id 
  and p_id.processes.fluid_id =  fluids.fluid_id
  and graphics.utilities_dgm.utilities_description = 'Arrow_Flow_Direction' 
  and graphics.utilities_dgm.orientation = p_id.p_id.ip_orient )
  from p_id.p_id, graphics.ip_matrix, p_id.processes
  where ST_GeometryType(p_id.p_id.ithe_geom) = 'ST_Point'
  and graphics.ip_matrix.ip_number =  p_id.processes.ip_number
  and p_id.processes.fluid_id = fluidid
  and graphics.ip_matrix.spatial_ref = p_id.p_id.proc_graphic_position 
  and (p_id.p_id.number_of_ips >  graphics.ip_matrix.ip_total
  or p_id.p_id.number_of_ips =  graphics.ip_matrix.ip_total)
  and p_id.p_id.process_id = p_id.processes.process_id
  and p_id.processes.fluid_id = fluidid;

I've attempted to replace the minus with the expression (graphics.ip_matrix.factor) which leads to the math operators column.

I get an error at the first bracket.

Is there a way around this other than a second function containing the + operator??

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090624/e86d785a/attachment.html>

More information about the postgis-users mailing list