Rust crate for performing coordinate transforms

Overview

Synopsis

A Rust crate use for performing coordinate transformations. The crate relies on nalgebra vectors to perform the coordinate transformations.

Build Status


Code Example

let ellipsoid = geo_ellipsoid::geo_ellipsoid::new(geo_ellipsoid::WGS84_SEMI_MAJOR_AXIS_METERS, 
                                                    geo_ellipsoid::WGS84_FLATTENING);
let lla_vec: Vector3<f64> = Vector3::new(3.0, 4.0, 5.0);
let ecef_vec = lla2ecef(&lla_vec, &ellipsoid);
assert_approx_eq!(ecef_vec.x, 4127585.379918784);
assert_approx_eq!(ecef_vec.y, 4779006.1975849345);
assert_approx_eq!(ecef_vec.z, 894117.5572814466);

Features

  • Simple, one line function calls to convert from one coordinate system to another
  • Common geodetic models provided for geodetic coordinate transformations
  • Uses nalgebra (widely used linear algebra crate)

Suggestions for use

  • Use Rayon! Rayon allows for easy parallelization - which coordinate transformations are an ideal candidate for. Take a look at examples/benchmarking for an example.

Roadmap / Ideas

  • Asserts/Option return for invalid input data

Examples

There are very early work in progress examples being built. These contain basic examples, benchmarking, and other types of examples to help aid in use of the crate. To run an example from the /examples directory:

cargo run --release --example <FILE_NAME_HERE>

License

Copyright (c) 2017 David Kramer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Rust bindings for GEOS

geos Rust bindings for GEOS C API. The supported geos version is = 3.5 Disclaimer GEOS can be a tad strict on the validity on the input geometry and

Rust bindings for the latest stable release of PROJ

PROJ Coordinate transformation via bindings to the PROJ v7.2.1 API. Two coordinate transformation operations are currently provided: projection (and i

Spatial Data Structures for Rust
Spatial Data Structures for Rust

spade Documentation Using spade Examples Project state Performance License Spade (SPAtial DatastructurEs, obviously!) implements a few nifty data stru

Rust implementation of the Martinez-Rueda Polygon Clipping Algorithm

Boolean operations on geo shapes This is an implementation of the Martinez-Rueda Polygon Clipping Algorithm in rust to integrate smoothly into the alr

Fast 2D Delaunay triangulation in Rust. A port of Delaunator.

delaunator-rs A very fast static 2D Delaunay triangulation library for Rust. A port of Delaunator. Documentation Example use delaunator::{Point, trian

port of MapBox's earcut triangulation code to Rust language
port of MapBox's earcut triangulation code to Rust language

Earcutr This is a port of the MapBox company's Earcut computer code, which triangulates polygons. Please see https://github.com/mapbox/earcut for more

Rust bindings for GDAL

gdal [] GDAL bindings for Rust. So far, you can: open a raster dataset for reading/writing get size and number of bands get/set projection and geo-tra

Rust read/write support for GPS Exchange Format (GPX)

gpx gpx is a library for reading and writing GPX (GPS Exchange Format) files. It uses the primitives provided by geo-types to allow for storage of GPS

Reading GeoTIFFs in Rust, nothing else!

A TIFF Library for Rust I needed this library to import elevation models for a routing library. As elevation models usually come in GeoTIFF format, bu

Comments
  • UTM to LL subtract overflow

    UTM to LL subtract overflow

    this line in geo.rs let lambda0 = (((z - 1) * 6 - 180 + 3) as f64).to_radians(); fails for all UTM zones < 31

    it should be let lambda0 = (((z as i32 - 1) * 6 - 180 + 3) as f64).to_radians(); or zone could be i32

    opened by ktmattson-alion 1
  • Generic over f64/f32?

    Generic over f64/f32?

    Hi there,

    Thanks for making this crate! Would you be open to supporting f32's as well as just f64?

    ie: https://docs.rs/coord_transforms/1.3.0/coord_transforms/d2/fn.cartesian2polar.html is hardcoded for f64.

    Right now I'm doing a bunch of unnecessary casts because my engine uses f32's atm. I'm still learning rust, but if your knowledgeable about a good method for doing so (maybe something like rust's Into trait?) I would be happy to put together a PR, if your open to merging/discussing it.

    Thanks!

    opened by bjadamson 2
Releases(1.4.0)
Owner
Dave
Dave
An fast, offline reverse geocoder (>1,000 HTTP requests per second) in Rust.

Rust Reverse Geocoder A fast reverse geocoder in Rust. Inspired by Python reverse-geocoder. Links Crate 2.0.0 Docs 1.0.1 Docs Description rrgeo takes

Grant Miner 91 Dec 29, 2022
Geospatial primitives and algorithms for Rust

geo Geospatial Primitives, Algorithms, and Utilities The geo crate provides geospatial primitive types such as Point, LineString, and Polygon, and pro

GeoRust 989 Dec 29, 2022
Rust bindings for GDAL

gdal [] GDAL bindings for Rust. So far, you can: open a raster dataset for reading/writing get size and number of bands get/set projection and geo-tra

GeoRust 211 Jan 4, 2023
Rust bindings for the latest stable release of PROJ

PROJ Coordinate transformation via bindings to the PROJ v7.2.1 API. Two coordinate transformation operations are currently provided: projection (and i

GeoRust 96 Dec 21, 2022
Geohash for Rust

Rust-Geohash Rust-Geohash is a Rust library for Geohash algorithm. Ported from node-geohash module. Documentation Docs Check the API doc at docs.rs Li

GeoRust 74 Sep 8, 2022
Rust read/write support for well-known text (WKT)

wkt Rust read/write support for well-known text (WKT). License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apac

GeoRust 40 Dec 11, 2022
Google Encoded Polyline encoding & decoding in Rust.

polyline Google Encoded Polyline encoding & decoding in Rust. A Note on Coordinate Order This crate uses Coordinate and LineString types from the geo-

GeoRust 14 Dec 11, 2022
Geocoding library for Rust.

geocoding Rust utilities to enrich addresses, cities, countries, and landmarks with geographic coordinates through third-party geocoding web services.

GeoRust 55 Dec 12, 2022
Rust read/write support for GPS Exchange Format (GPX)

gpx gpx is a library for reading and writing GPX (GPS Exchange Format) files. It uses the primitives provided by geo-types to allow for storage of GPS

GeoRust 63 Dec 5, 2022
Geospatial primitives and algorithms for Rust

geo Geospatial Primitives, Algorithms, and Utilities The geo crate provides geospatial primitive types such as Point, LineString, and Polygon, and pro

GeoRust 990 Jan 1, 2023