[postgis-devel] ST_ShiftLongitude

Paul Ramsey pramsey at cleverelephant.ca
Tue Feb 23 06:43:50 PST 2010


How about this?

insert into spatial_ref_sys (srid, proj4text) values
(444444,'+proj=longlat +pm=40 +ellps=WGS84 +no_defs');
select asewkt(transform('SRID=4326;POINT(0 0)',444444));

          asewkt
--------------------------
 SRID=444444;POINT(-40 0)
(1 row)


On Tue, Feb 23, 2010 at 6:08 AM, strk <strk at keybit.net> wrote:
> Hi guys,
> I'm in need to do some "longitude shifting" and went looking
> at the function I wrote long time ago (ST_ShiftLongitude).
>
> That function is documented to translate every point with X<0 to X+=360.
>
> What I need is shift on a different "prime meridian" (correct name?),
> so I was thinking to take the condition (X<0 currently) as a parameter.
>
> Now, one problem I found is that the ST_ShiftLongitude really does
> more then documented, that is it takes any point with X>180 and
> translate them back to X-=360 (!)
> This was to allow symetrical operations (shit/unshift).
>
> Another problem is the name of this function, which I find somewhat
> confusing in that it's not a "shift" happening, but a "conditional
> shift" which I pretty much see like taking a piece of paper with
> the printed muap on cutting it to a given longitude-value (0 by default
> for the current function) and glueing the two pieces again swapped.
>
> 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)
>
> As you can see the current 'symmetrical' behaviour can't be implemented
> by only using the parameters above (as the range [param 3] changes after
> the cut&glue operation and can't be assumed.
>
> Problem with current ST_ShiftLongitude is then probably hard-coding
> of the valid range.
>
> I hope someone will be able to follow this disquisition :)
> Writing here for your opinion on the value of generalizing such
> function.
>
> --strk;
>
>  ()   Free GIS & Flash consultant/developer
>  /\   http://foo.keybit.net/~strk/services.html
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list