https://github.com/chrberger/wgs84tocartesian
A simple header-only, single-file library to handle WGS84 coordinate to Cartesian coordinate transformations for C++.
https://github.com/chrberger/wgs84tocartesian
cartesian coordinate-transformation coordinates cpp11 cpp14 cpp17 header-only platform-independent single-file wgs84
Last synced: 7 months ago
JSON representation
A simple header-only, single-file library to handle WGS84 coordinate to Cartesian coordinate transformations for C++.
- Host: GitHub
- URL: https://github.com/chrberger/wgs84tocartesian
- Owner: chrberger
- License: mit
- Created: 2018-03-09T22:27:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T18:52:38.000Z (over 4 years ago)
- Last Synced: 2025-03-17T00:34:50.936Z (7 months ago)
- Topics: cartesian, coordinate-transformation, coordinates, cpp11, cpp14, cpp17, header-only, platform-independent, single-file, wgs84
- Language: C++
- Homepage:
- Size: 268 KB
- Stars: 83
- Watchers: 4
- Forks: 17
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## WGS84toCartesian - a simple header-only, single-file library to convert WGS84 positions (latitude/longitude) to/from Cartesian positions using Mercator projection for C++
[](https://travis-ci.org/chrberger/WGS84toCartesian) [](https://ci.appveyor.com/project/chrberger/WGS84toCartesian) [](https://opensource.org/licenses/MIT)
WGS84toCartesian is a small and efficient library written in modern C++ library to convert WGS84 latitude/longitude positions to/from Cartesian positions using Mercator projection.
WGS84toCartesian is available as single-file, header-only library - just drop [WGS84toCartesian.hpp](https://raw.githubusercontent.com/chrberger/WGS84toCartesian/master/WGS84toCartesian.hpp) into your project, `#include "WGS84toCartesian.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer).
This library is partially based on the work from Gerald I. Evenden on proj 4.3 released under public domain terms. See thirdparty/proj-4.3 for further details.
## Table of Contents
* [Features](#features)
* [Dependencies](#dependencies)
* [Contributing](#contributing)
* [License](#license)## Features
* Written in highly portable and high quality C++11
* **Available as header-only, single-file distribution - just drop [WGS84toCartesian.hpp](https://raw.githubusercontent.com/chrberger/WGS84toCartesian/master/WGS84toCartesian.hpp) into your project, `#include "WGS84toCartesian.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer)**
* The positions are passed to and returned from the functions as [`std::array`](http://en.cppreference.com/w/cpp/container/array) so that this library integrates well with other math libraries (e.g., Eigen).
* Convert a given WGS84 position to a Cartesian position using a given WGS84 reference position with Mercator projection: `std::array cartesianPosition = wgs84::toCartesian({52.247041, 10.575830} /* reference position */, {52.248091, 10.57417} /* position to be converted */));`
* Convert a given WGS84 position to a Cartesian position using a given WGS84 reference position with Mercator projection: [Another example](https://github.com/chrberger/WGS84toCartesian/blob/master/test/Test-WGS84toCartesian.cpp#L40-L49)
* Approximate a given Cartesian position with a WGS84 position using a given WGS84 reference position with Mercator projection: `std::array approximatedWGS84Position = wgs84::fromCartesian({52.247041, 10.575830} /* reference position */, {-154.48, 441.75} /* position to be converted */);`
* Approximate a given Cartesian position with a WGS84 position using a given WGS84 reference position with Mercator projection: [Another example](https://github.com/chrberger/WGS84toCartesian/blob/master/test/Test-WGS84toCartesian.cpp#L82-L91)## Dependencies
No dependencies! All you need is a C++11-compliant compiler (we are testing with GCC 6.3.0 and MSVC 19.0.24215.1) as the project ships the following dependencies as part of the source distribution:* [Unit Test Framework Catch2](https://github.com/catchorg/Catch2/releases/tag/v2.1.1) - [](http://www.boost.org/LICENSE_1_0.txt) - [Source](https://github.com/chrberger/stringtoolbox/blob/master/test/catch.hpp)
## Installation
### Installation as single-file, header-only library
WGS84toCartesian is provided as header-only, single-file library as well - just drop [WGS84toCartesian.hpp](https://raw.githubusercontent.com/chrberger/WGS84toCartesian/master/WGS84toCartesian.hpp) into your project, `#include "WGS84toCartesian.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer)## Projects using WGS84toCartesian
If your project is using WGS84toCartesian, just let us know :-)## Contributing
We are happy to receive your PRs to accelerate libcluon's development; before contributing, please take a look at the [Contribution Documents](CONTRIBUTING.md).## License
* This project is released under the terms of the MIT License - [](https://opensource.org/licenses/MIT)