Expand description
§use-geography
Facade crate for RustUse geography primitives.
use-geography reexports focused child crates for descriptive Earth-oriented
vocabulary. It is not a GIS engine, mapping framework, geocoder, routing engine,
map renderer, spatial database, projection engine, or address parser.
§Scope
- thin facade over focused geography child crates
- descriptive geographic coordinates, places, regions, boundaries, projections, spatial references, elevation, address components, and map scale
- composition-friendly exports for downstream crates
§Non-goals
- geodesic calculations
- projection math
- coordinate transformation
- geocoding or reverse geocoding
- address parsing or postal-service validation
- routing or route planning
- map rendering or tile behavior
- network access or data fetching
§Example
use use_geography::{
boundary, elevation, geo_coordinate, geographic_region, map_scale, place, projection,
spatial_reference, Address, AddressCountryCode, AddressLine,
};
let latitude = geo_coordinate::Latitude::new(37.7749)?;
let longitude = geo_coordinate::Longitude::new(-122.4194)?;
let pair = geo_coordinate::CoordinatePair::new(latitude, longitude);
let coordinate = geo_coordinate::GeoCoordinate::from(pair);
let place_name = place::PlaceName::new("San Francisco")?;
let region_name = geographic_region::GeographicRegionName::new("Northern California")?;
let boundary_kind = boundary::BoundaryKind::Political;
let projection_kind = projection::ProjectionKind::WebMercator;
let epsg = spatial_reference::EpsgCode::new(4326)?;
let elevation = elevation::Elevation::new(16.0)?;
let scale = map_scale::MapScale::new(map_scale::ScaleRatio::new(25_000)?);
let address = Address::new().with_line(AddressLine::new("1 Rue de Rivoli")?);
let address = Address {
country_code: Some(AddressCountryCode::new("fr")?),
..address
};
assert_eq!(coordinate.latitude(), latitude);
assert_eq!(coordinate.longitude(), longitude);
assert_eq!(place_name.as_str(), "San Francisco");
assert_eq!(region_name.as_str(), "Northern California");
assert_eq!(boundary_kind.to_string(), "political");
assert_eq!(projection_kind.to_string(), "web-mercator");
assert_eq!(epsg.to_string(), "EPSG:4326");
assert_eq!(elevation.meters(), 16.0);
assert_eq!(scale.to_string(), "1:25000");
assert!(address.has_country());Re-exports§
pub use use_boundary as boundary;pub use use_elevation as elevation;pub use use_geo_coordinate as geo_coordinate;pub use use_geographic_region as geographic_region;pub use use_map_scale as map_scale;pub use use_place as place;pub use use_projection as projection;pub use use_spatial_reference as spatial_reference;
Structs§
- Address
- Address
Country Code - Address
Line - Address
Line1 - Address
Line2 - Administrative
Area - Country
Subdivision - Locality
- Postal
Code - Street
Address - Street
Name - Street
Number - Unit
Designator - Unit
Number
Enums§
- Address
Component Kind - Address
Country Code Error - Address
Error - Address
Format Hint - Address
Kind - Address
Line1 Error - Address
Line2 Error - Address
Line Error - Address
Precision - Address
Usage Kind - Address
Validation Level - Administrative
Area Error - Country
Subdivision Error - Locality
Error - Postal
Code Error - Street
Name Error - Street
Number Error - Unit
Designator Error - Unit
Number Error