Git Product home page Git Product logo

position-lib's Introduction

Header only coordinate representation, conversion and formatting utilities

Usage example

In the example below, we store coordinates in Decimal Degrees format, convert them to DDM and to DMS, then use a string formatter to convert coordinates as strings.

position_dd dd(47.51863818403278, -122.29686387310251);
position_ddm ddm = dd;
position_dms dms = dd;

position_display_string dd_fmt = format(dd, position_dd_format);
assert(dd_fmt.lat == "47.518638");
assert(dd_fmt.lon == "-122.296864");

position_display_string ddm_fmt = format(ddm, position_ddm_format);
assert(ddm_fmt.lat == "47°31.118'N");
assert(ddm_fmt.lon == "122°17.812'W");

position_display_string dms_fmt = format(dms, position_dms_format);
assert(dms_fmt.lat == "47°31'7.10\"N");
assert(dms_fmt.lon == "122°17'48.71\"W");

Tests

Tests are stored in ./tests/position_tests.cpp and are run automatically via a github action, on Ubuntu and Windows using the MSVC and GCC compilers.

Integration with CMake

As this is a header only library, you can simple download the header and use it:

file(DOWNLOAD https://raw.githubusercontent.com/iontodirel/position-lib/main/position.hpp ${CMAKE_SOURCE_DIR}/external/position.hpp )

Include the header:

#include "external/position.hpp"

position-lib's People

Contributors

iontodirel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.