 # Geometry :

Subject: [ggl] point conversion geographic <-> cartesian
From: Krzysztof Czainski (1czajnik)
Date: 2010-11-05 10:42:54

2010/11/5 Barend Gehrels <barend.gehrels_at_[hidden]>

> hi Kris,
> Welcome to the list.

Using projections, you can transform points from geo to cartesian,
> (forward), and back (inverse).
>
> Besides projections, you can also transform the geo-points using
> translation/scaling (this is actually the most simple projection, plate

>
> Regards, Barend
>

projections. Among other things, I found this:
http://geometrylibrary.geodan.nl/art09.html

Here is a sample I am trying to compile (You can see compile error messages
s in comments, I cut out some template bloat from them):

#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/extensions/gis/geographic/core/cs.hpp>
#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
#include <boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
#include <boost/geometry/extensions/gis/projections/projection.hpp>
#include <boost/geometry/extensions/gis/projections/factory.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/transform.hpp>

#include <iostream>

namespace bg = boost::geometry;

// ( longitude, latitude )
typedef bg::point< double, 2, bg::cs::geographic<bg::degree> > Geo;
typedef bg::point_xy< double > Xy;

int main()
{
// error: no matching function for call to
merc_ellipsoid::merc_ellipsoid(const char )
bg::projection::merc_ellipsoid<Geo,Xy> prj2( "+ellps=WGS84 +lon_0=11.6E"
);
// error: no matching function for call to
eqdc_ellipsoid::eqdc_ellipsoid(const char )
bg::projection::eqdc_ellipsoid<Geo,Xy> prj( "+lat_ts=20 +lat_0=20
+lon_0=50" );
Geo a( 50, 20 ), b( 51,21 ), c( 50,21);
Xy aa, bb, cc;
prj.forward( a, aa );
prj.forward( b, bb );
prj.forward( c, cc );
cout << aa.x() << ',' << aa.y() << endl;
cout << bb.x() << ',' << bb.y() << endl;
cout << cc.x() << ',' << cc.y() << endl;
}

I can't find any description of how the parameters should be passed to these
projections, so I need some help here.

Cheers
Kris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20101105/2ba6f7c0/attachment.html

Geometry list run by mateusz at loskot.net