[postgis-users] custom SRID: like 4326 but in radians

Mike Toews mwtoews at gmail.com
Tue Jan 28 14:02:23 PST 2014


A workaround that is compatible with GIS software that expect degrees
is to store geometries in a conventional SRID=4326, but provide a view
of geometries with radians. It just requires a simple scale transform,
e.g. from degrees to radians:

SELECT ST_Scale('POLYGON ((42 -11, 32 -19, 44 -21, 42 -11))',
pi()/180.0, pi()/180.0)

Views can customized to be updatable too, so edits to geometries done
in radians can be put back into degrees for storage with 4326.

Proj.4 natively does trigonometry in radians, but PostGIS'
ST_Transform appears to hard-code the conversion to degrees:
http://trac.osgeo.org/postgis/browser/trunk/liblwgeom/lwgeom_transform.c

Unless there is a way to modify pj_is_latlong, which would bypass the
degree-radian conversions.

-Mike

On 29 January 2014 10:13,  <stacie at dcindigos.com> wrote:
> Hi,
>  I'm having some issues creating a custom SRID where the units of the
> spatial reference system are stored as radians in PostGIS.
> We store our data in radians but is otherwise like EPSG:4326.  In order to
> do transformation of the data I have been experimenting with creating a
> custom SRID. I have tried a multitude of strings.
> I have downloaded the code for proj4 to see how it is using the params and I
> thought that this would work:
>
> "+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,56295779.51308231 +no_defs
> "
>
> "GEOGCS["WGS 84Rad",DATUM["WGS_1984Rad",SPHEROID["WGS
> 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["rb","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["radian",1.0000000000000,AUTHORITY["EPSG","9101"]],AUTHORITY["rb","8307"]]"
>
> but no joy.
>
> any insight would be greatly appreciated, especially if you have actually
> implemented the same thing successfully.
>
> Thank you,
> Stacie
>
>
>
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list