[][src]Struct proj::ProjBuilder

pub struct ProjBuilder { /* fields omitted */ }

A PROJ Context instance, used to create a transformation object.

Create a transformation object by calling proj or proj_known_crs.

Implementations

impl ProjBuilder[src]

pub fn enable_network(&self, enable: bool) -> Result<u8, ProjError>[src]

Enable or disable network access for resource file download.

Safety

This method contains unsafe code.

pub fn set_search_paths<P: AsRef<Path>>(
    &self,
    newpath: P
) -> Result<(), ProjError>
[src]

Add a resource file search path, maintaining existing entries.

Safety

This method contains unsafe code.

pub fn grid_cache_enable(&self, enable: bool)[src]

Enable or disable the local cache of grid chunks

To avoid repeated network access, a local cache of downloaded chunks of grids is implemented as SQLite3 database, cache.db, stored in the PROJ user writable directory. This local caching is enabled by default. The default maximum size of the cache is 300 MB, which is more than half of the total size of grids available, at time of writing.

Safety

This method contains unsafe code.

pub fn set_url_endpoint(&self, endpoint: &str) -> Result<(), ProjError>[src]

Set the URL endpoint to query for remote grids

Safety

This method contains unsafe code.

impl ProjBuilder[src]

pub fn new() -> Self[src]

Create a new ProjBuilder, allowing grid downloads and other customisation.

pub fn proj(self, definition: &str) -> Option<Proj>[src]

Try to create a coordinate transformation object

Note: for projection operations, definition specifies the output projection; input coordinates are assumed to be geodetic in radians, unless an inverse projection is intended.

For conversion operations, definition defines input, output, and any intermediate steps that are required. See the convert example for more details.

Safety

This method contains unsafe code.

pub fn proj_known_crs(
    self,
    from: &str,
    to: &str,
    area: Option<Area>
) -> Option<Proj>
[src]

Try to create a transformation object that is a pipeline between two known coordinate reference systems. from and to can be:

  • an "AUTHORITY:CODE", like "EPSG:25832".
  • a PROJ string, like "+proj=longlat +datum=WGS84". When using that syntax, the unit is expected to be degrees.
  • the name of a CRS as found in the PROJ database, e.g "WGS84", "NAD27", etc.
  • more generally, any string accepted by new()

If you wish to alter the particular area of use, you may do so using area_set_bbox()

A Note on Coordinate Order

The required input and output coordinate order is normalised to Longitude, Latitude / Easting, Northing.

This overrides the expected order of the specified input and / or output CRS if necessary. See the PROJ API

For example: per its definition, EPSG:4326 has an axis order of Latitude, Longitude. Without normalisation, crate users would have to remember to reverse the coordinates of Point or Coordinate structs in order for a conversion operation to return correct results.

 extern crate proj;
 use proj::Proj;

 extern crate geo_types;
 use geo_types::Point;

 let from = "EPSG:2230";
 let to = "EPSG:26946";
 let nad_ft_to_m = Proj::new_known_crs(&from, &to, None).unwrap();
 let result = nad_ft_to_m
     .convert(Point::new(4760096.421921f64, 3744293.729449f64))
     .unwrap();
 assert_approx_eq!(result.x(), 1450880.29f64, 1.0e-2);
 assert_approx_eq!(result.y(), 1141263.01f64, 1.0e-2);

Safety

This method contains unsafe code.

Trait Implementations

impl Default for ProjBuilder[src]

impl Drop for ProjBuilder[src]

impl Info for ProjBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.