[postgis-devel] ST_ShiftLongitude

strk strk at keybit.net
Tue Feb 23 07:25:31 PST 2010


On Tue, Feb 23, 2010 at 03:08:05PM +0100, strk wrote:

> So, what I think should be paremetrized is:
> 	1: X-value for where to cut (longitude)
> 	2: Side to move (left to right or right to left)
> 	3: range of the whole block
> 	   (minx if moving right to left, maxx if moving left to right)

I'm thinking the parameter could be reduced to 2:

	1: X-value representing the cut-line
	2: shift amount

If shift amount is negative we're moving left
if it's positive we're moving right.

The function should check component geometries of a feature
to fall *completely* on the left (moving right) or right (moving left)
of the given X-value and only move those. Doing so will avoid introducing
invalid geometries.

The function would not be symmetric anymore.
Going from -180..180 to 0..360 would be done with:
	ST_ShiftLongitude(the_geom, 0, +360)
Going from 0..360 to -180..180 would be done with:
	ST_ShiftLongitude(the_geom, 180, -360)

How do you like it ?
If we want to keep the same function (would be easier) this
would mean taking no args as a default of 0, +360 and loosing
the current symmetricity (which again is not documented).

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://foo.keybit.net/~strk/services.html



More information about the postgis-devel mailing list