Changes between Version 16 and Version 17 of UsersWikiplpgsqlfunctions
- Timestamp:
- 09/22/09 13:25:39 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UsersWikiplpgsqlfunctions
v16 v17 17 17 thedirection float; 18 18 midpointrads float; 19 originalsrid int;20 19 arcenterutm geometry; 21 20 startpointutm geometry; … … 27 26 28 27 midpointrads := abs(st_azimuth(arcenterutm,startpointutm) - st_azimuth(arcenterutm,endpointutm)); 29 30 28 IF midpointrads > pi() THEN midpointrads:= (midpointrads - pi())/2; ELSE midpointrads:= midpointrads/2; END IF; 29 IF midpointrads > st_azimuth(arcenterutm,startpointutm) THEN midpointrads:= st_azimuth(arcenterutm,startpointutm)/2; 31 30 IF direction = 'cw' THEN thedirection := -1*midpointrads; ELSE thedirection := midpointrads; END IF; 32 31 pointonarc := ST_Translate( ST_Rotate( ST_Translate( startpointutm, -1*ST_X(arcenterutm), -1*ST_Y(arcenterutm)), thedirection), ST_X(arcenterutm), ST_Y(arcenterutm)); … … 37 36 LANGUAGE 'plpgsql' IMMUTABLE; 38 37 COMMENT ON FUNCTION st_createarc(geometry,geometry,geometry,text) IS 'Generates an arc based on starting point, ending point, centre of arc, and direction (clockwise: \'cw\', conter-clockwise: \'cc\'). All geometries must be of type POINT and this function returns a linestring of the arc based on the original SRID and 32 points per quarter circle. Requires the utmzone function.'; 38 39 39 40 40 41