GithubHelp home page GithubHelp logo

mthh / flat-projection-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from turbo87/flat-projection-rs

0.0 3.0 0.0 26 KB

Fast geodesic distance approximations via flat surface projection

License: MIT License

Rust 100.00%

flat-projection-rs's Introduction

flat-projection

Build Status

Fast geodesic distance approximations via flat surface projection

The FlatProjection struct can by used to project geographical coordinates from WGS84 into a cartesian coordinate system. In the projected form approximated distance and bearing calculations can be performed much faster than on a sphere. The precision of these calculations is very precise for distances up to about 500 km.

Usage

extern crate flat_projection;

use flat_projection::FlatProjection;

fn main() {
    let (lon1, lat1) = (6.186389, 50.823194);
    let (lon2, lat2) = (6.953333, 51.301389);

    let proj = FlatProjection::new(51.05);

    let p1 = proj.project(lon1, lat1);
    let p2 = proj.project(lon2, lat2);

    let distance = p1.distance(&p2);
    // -> 75.648 km
}

Benchmark

$ cargo bench

flat                    time:   [329.01 ps 331.10 ps 333.29 ps]
haversine               time:   [12.244 ns 12.338 ns 12.437 ns]
vincenty                time:   [262.92 ns 266.14 ns 270.01 ns]

According to these results the flat surface approximation is about 37x faster than the Haversine formula.

Related

License

This project is released under the MIT license.

flat-projection-rs's People

Contributors

dependabot-support avatar mthh avatar turbo87 avatar

Watchers

 avatar  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.