Struct proj::ProjBuilder [−][src]
pub struct ProjBuilder { /* fields omitted */ }
Expand description
A PROJ
Context instance, used to create a transformation object.
Create a transformation object by calling proj
or proj_known_crs
.
Implementations
This is supported on crate feature network
only.
network
only.Enable or disable network access for resource file download.
Safety
This method contains unsafe code.
Add a resource file search path, maintaining existing entries.
Safety
This method contains unsafe code.
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.
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.
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, Coord}; 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((4760096.421921f64, 3744293.729449f64)) .unwrap(); assert_relative_eq!(result.x(), 1450880.29, epsilon = 1.0e-2); assert_relative_eq!(result.y(), 1141263.01, epsilon = 1.0e-2);
Safety
This method contains unsafe code.
Trait Implementations
Return Information about the current PROJ context Read more
Check whether network access for resource file download is currently enabled or disabled. Read more
Auto Trait Implementations
impl RefUnwindSafe for ProjBuilder
impl !Send for ProjBuilder
impl !Sync for ProjBuilder
impl Unpin for ProjBuilder
impl UnwindSafe for ProjBuilder