[Proj] +axis switch to control axis orientation

Frank Warmerdam warmerdam at pobox.com
Mon Mar 1 13:49:51 EST 2010

Zoltan Szecsei wrote:
> Hi All,
> _I have not used cs2cs _and am fairly new to this list, however, as 
> acceptance/rejection of ideas like Frank's below seems to happen a lot 
> faster on this list, than I think I will have time to "get into cs2cs" 
> at the moment, I'd like to add my 2c even though my thoughts may already 
> be covered by other functionality.
> I would like to suggest that the +axis option also covers the input 
> value layout (source coordinate). Perhaps this could be done by only 
> allowing 3 or 6 character options for this parameter. If 6 chars, the 
> 1st 3 apply to the source coordinates. [... but then do we also allow 2 
> & 4 char values, to cater for when when no Z exists?]
> I have often received coordinate lists in [true] LatLong order, and also 
> YX (geodetic layout) when actually XY was needed.
> By allowing +axis to define a non-standard coordinate layout, proj could 
> save us the time it takes to write a quick filter for the input file layout.
> [Like I said - I have not fiddled with much of this stuff, _but I am 
> assuming_ one can pipe files through cs2cs - hence defining input 
> coordinate order would be useful]


The cs2cs program actually takes two coordinate system definitions, one for
the source, and one for the destination.  I think your point was allowing
a way to represent the input and output axis order, right?  With this new
capability you could do the following to switch from long/lat to lat/long

   cs2cs +proj=latlong +datum=WGS84 +to +proj=latlong +axis=neu +datum=WGS84

So I think the ability to attach an axis order to each used coordinate system
definition is sufficient for your needs.

I should however mention that the proj and cs2cs programs already support
the -r and -s commandline switches to switch the x/y order of coordinates
on input and output.  This is done in the program itself rather than down in
pj_transform().  So if we considered cs2cs and proj to be the only important
interfaces to the proj.4 library there would be no real need for +axis.
We could just use those switches.

However, in my humble opinion, the use of proj.4 as a library rather than
as command line utilities is far more important.  So the +axis switch is
an attempt to provide axis control within the library without the
application having to know anything about it.  It is also necessary if
we want to embed axis orientation with the coordinate system definition
in initialization files like the epsg init file.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Proj mailing list