[Mapserver-users] FW: [postgis-users] Postgis Transform Problem

Vincent Schut schut at sarvision.com
Wed Jul 2 03:42:14 EDT 2003


Benjamin,

my 2c on latlon and mercator:
tmerc is 'transverse mercator', as used in the abreviation 'UTM': Universal 
Transverse Mercator.
'Exercising tmerc at the boundaries': in latlon systems (which are essentially 
unprojected, though they are sometimes called latlon or geographic 
'projections'), the north and south pole are single points. In projections 
like (transverse) mercator however, the north and south pole are either not 
there (they fall outside the valide projection area) or can be regarded as 
being stretched till these 'points' occupy the entire northern and southern 
boundary line of the projection of the entire earth. You might better 
understand this if you look at these projections as wrapping the earth in a 
vertical cilinder and projecting each point of the sphere of the earth onto 
its nearest point on the surface of the cilinder. There are only 2 points 
that are undefined in this, because they are similarly equal in distance to 
more than one point, to be specific an entire line: the most upper and lower 
points of the spere, or any latlon point that has a latitude of 90 or -90. 
Try cs2cs with any other value as lon, and 90 or -90 as lat, and it will give 
you the same non-output as 180, 90, because all these coordinates are the 
same point: north or south pole.
I don't know how arcview does it, but it must be some workaround of the normal 
projection formula, cause that will not give you one single point for these 
coordinates. It will either give you a line, or a 'undefined' result.

On Wednesday 02 July 2003 00:46, Benjamin Wragg wrote:
> 179.99 and 89.99 work OK. The problem is that I receive on a regular
> basis minx,miny,maxx,maxy coordinates which define the area of a
> hardcopy map boundary. Since many hardcopy maps are made of the entire
> earth, the coordinates sent are -180,-90,180,90. I then create PostGIS
> features from these coordinates.
>
> If I project the data in ArcView 8 I get something like the attached
> image. The purple/pink is a box I defined as -180,-90,180,90 using WGS84
> and then projected it to Mercator. I was hoping to achieve similar using
> PostGIS.
>
> What did you mean by 'exercising tmerc at the boundaries'? 'tmerc'?
>
> Thanks,
>
> Benjamin
>
> (I removed the image for the list. If you need it let me know)
>
> -----Original Message-----
> From: Paul Ramsey [mailto:pramsey at refractions.net]
> Sent: Tuesday, 1 July 2003 11:57 PM
> To: bwragg at tpg.com.au
> Subject: Re: FW: [postgis-users] Postgis Transform Problem
>
>
> cs2cs exercises proj4 which is what postgis uses, so the test is
> equivalent.
> You realize that you are exercising tmerc at the boundaries, right? I
> do not know what the correct behavior should be at that coordinate.
> What happens when you try 179.99 89.99?
>
> On Monday, June 30, 2003, at 10:53 PM, Benjamin Wragg wrote:
> > I tried the cs2cs utility. I think I'm passing the correct paramaters.
> > If I enter the following:
> >
> > 	cs2cs +proj=latlong +ellps=WGS84 +to +proj=merc +lon_0=150.0
> > 	180 90
> >
> > I get
> >
> > 	*	* 0.00
> >
> > If I type any other coordinate I get a figure back. So is the cs2cs
> > utility what Postgis uses to project it's coords? If it does, it seems
> >
> > this is whats causing the problem.
> >
> > Thanks,
> >
> > Benjamin
> >
> > -----Original Message-----
> > From: postgis-users-bounces at postgis.refractions.net
> > [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> > Paul Ramsey
> > Sent: Wednesday, 25 June 2003 10:55 PM
> > To: bwragg at tpg.com.au; PostGIS Users Discussion
> > Subject: Re: [postgis-users] Postgis Transform Problem
> >
> >
> > Those coordinates are right on the edge of the global plane, could be
> > hitting the edge of validity in the reprojection library. Try testing
> > the same stuff directly using the proj4 cs2cs utility.
> >
> > On Tuesday, June 24, 2003, at 10:35 PM, Benjamin Wragg wrote:
> >> I'm having a problem with the transform function in Postgis. If I run
> >> the following query:
> >>
> >> select transform(GeometryFromText('MULTIPOLYGON(((112 -45 ,112 -10
> >> ,155 -10 ,155 -45,112 -45)))',4326),54004)
> >>
> >> I get:
> >>
> >> SRID=54004;MULTIPOLYGON(((12467782.9688466
> >> -5591295.91855339,12467782.9688466 -1111475.10285223,17254521.0729574
> >> -1111475.10285223,17254521.0729574 -5591295.91855339,12467782.9688466
> >> -5591295.91855339)))
> >>
> >> But if I do:
> >>
> >> select transform(GeometryFromText('MULTIPOLYGON(((-180 -90 ,-180 90
> >> ,180 90 ,180 -90,-180 -90)))',4326),54004)
> >>
> >> I get:
> >>
> >> Error: transform: couldn't project polygon
> >> Warning: Error occurred while executing PL/pgSQL function transform
> >> Warning: line 2 at return
> >>
> >> Any ideas why? I turned the postgresql log level to debug5 to see if
> >> I
> >>
> >> could get more detailed errors, but it's exactly the same error. I'm
> >> running postgresql 7.3.2, postgis 0.7.5 and proj 4.4.7
> >>
> >> Thanks,
> >>
> >> Benjamin Wragg
> >
> >       Paul Ramsey
> >       Refractions Research
> >       Email: pramsey at refractions.net
> >       Phone: (250) 885-0632
> >
> >
> > _______________________________________________
> > postgis-users mailing list postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>       Paul Ramsey
>       Refractions Research
>       Email: pramsey at refractions.net
>       Phone: (250) 885-0632
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

-- 
______________________________________
Vincent Schut
Sarvision B.V.
Wageningen, The Netherlands
www.sarvision.com



More information about the mapserver-users mailing list