pub struct GeoLocation {
pub latitude: OcpiString<10>,
pub longitude: OcpiString<11>,
pub extensions: Extensions,
}v2_3_0 only.Expand description
The geo location of a Charge Point. The geodetic system is WGS 84.
Five decimal places is seen as a minimum for GPS coordinates of the Charge Point as this gives approximately 1 meter precision. More is always better.
The spec types both fields as strings with a regex, not as numbers, so this crate keeps them
as strings: re-serialising must not turn "50.770774" into 50.770774. Use
GeoLocation::latitude_decimal to compute with them.
Spec: 2.3.0 §mod_locations_geolocation_class
Fields§
§latitude: OcpiString<10>Latitude in decimal degrees; regex -?[0-9]{1,2}\.[0-9]{5,7}.
longitude: OcpiString<11>Longitude in decimal degrees; regex -?[0-9]{1,3}\.[0-9]{5,7}.
extensions: ExtensionsUndocumented JSON fields, preserved verbatim.
Implementations§
Source§impl GeoLocation
impl GeoLocation
Sourcepub fn new(
latitude: impl Into<String>,
longitude: impl Into<String>,
) -> Result<Self, InvalidString>
pub fn new( latitude: impl Into<String>, longitude: impl Into<String>, ) -> Result<Self, InvalidString>
Creates a geo location from two coordinate strings.
§Errors
Returns crate::types::InvalidString if either value is too long or not printable.
Sourcepub fn latitude_decimal(&self) -> Option<Number>
pub fn latitude_decimal(&self) -> Option<Number>
The latitude as an exact decimal, if it parses.
Sourcepub fn longitude_decimal(&self) -> Option<Number>
pub fn longitude_decimal(&self) -> Option<Number>
The longitude as an exact decimal, if it parses.
Trait Implementations§
Source§impl Clone for GeoLocation
impl Clone for GeoLocation
Source§fn clone(&self) -> GeoLocation
fn clone(&self) -> GeoLocation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GeoLocation
impl Debug for GeoLocation
Source§impl<'de> Deserialize<'de> for GeoLocation
impl<'de> Deserialize<'de> for GeoLocation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for GeoLocation
impl JsonSchema for GeoLocation
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more