Boost logo

Geometry :

Subject: Re: [geometry] Support for geographic coordinate system
From: Barend Gehrels (barend_at_[hidden])
Date: 2014-11-07 04:47:34


Hi Adam, Mark,

Adam Wulkiewicz wrote On 7-11-2014 0:49:
> Hi Mark,
>
> Mark Millman wrote:
>> While it's fair to be concerned about interdependence between
>> projects there is the well supported Geospatial Data Abstraction
>> Library (GDAL) and specifically the OGRSpatialReference class --
>> http://www.gdal.org/classOGRSpatialReference.html
>>
>> These are well established projects widely used within the Open
>> Source Geospatial developer community, written in C++ (and some C).
>
> Thanks for the link! Definietly we should some day support various
> SRSs and make them available out of the box for the user. Though I
> think it's not necessary to support various SRSs on a strategy level.
> Strategies are rather low level functionality. When they're used we
> already know the coordinate system and a reference model (cartesian
> plane/space, sphere, spheroid/ellipsoid or maybe some other in the
> future). The only thing we need is the parameters. AFAIU SRSs,
> projections, EPSG codes, etc. should be somewhere on a higher level.

About interdependence: good point. But there is already interdependence.
The whole Boost.Geometry Projection extension is automatically converted
from Proj4 to templated point concept based.

http://trac.osgeo.org/proj/

So here more information about Boost.Geometry projections as it seems to
be not so well known.

With Proj4, it also got the may parameters and their
string-initialization support.

http://trac.osgeo.org/proj/wiki/GenParms

In Boost.Geometry you can therefore initialize projections like this:

     bg::projections::parameters params =
bg::projections::detail::pj_init_plus(parameters);

See for example the examples extensions/example/gis/projections

or the projections.cpp unit test where this is done extensively. I copy
a few lines here:

     test_forward<P>("aea", 4.897000, 52.371000, 334609.583974, 5218502.503686, "+proj=aea +ellps=WGS84 +units=m +lat_1=55 +lat_2=65");

     test_forward<P>("aeqd", 4.897000, 52.371000, 384923.723428, 5809986.497118, "+proj=aeqd +ellps=WGS84 +units=m");

     test_forward<P>("airy", 4.897000, 52.371000, 328249.003313, 4987937.101447, "+proj=airy +ellps=WGS84 +units=m");

Of course not all of there parameters are relevant to the Earth model,
many are specific for projections. But some are such as tes, des, te,
de, tf, tb, ...

So this is is why I asked to harmonize the Earth model between distance
(vincenty, andoyer) which have a simpler model, and the projections,
where it is done. We don't have to take this over for 100% but we have
to have one Concept.

About EPSG codes, also here is support within Boost.Geometry 's
projections, you can initalize with:
typedef bg::projections::epsg_traits<28992, P1, P2> epsg_traits; (where
P1,P2 are point types).
bg::projections::parameters par =
bg::projections::detail::pj_init_plus(epsg_traits::par());

See the examples or the unit test projection_epg.cpp

Boost.Geometry projections are huge and well tested. With the unit
tests, projecting forward and backward, some errors in projection code
were found and this is reported back to Proj4 and to Gerald Evenden, so
it is fixed in the sources too.

Regards, Barend


Geometry list run by mateusz at loskot.net