Skip to main content

geospatial_types/
place.rs

1//! Place and geocoding result records.
2
3use crate::coordinate::GeographicCoordinate;
4use serde::{Deserialize, Serialize};
5
6/// Structural precision a geocoder reached for one resolved location.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8#[serde(rename_all = "snake_case")]
9pub enum GeocodeQuality {
10    /// Rooftop or feature point.
11    Point,
12    /// Street address matched to the building level.
13    StreetAddress,
14    /// Street intersection.
15    Intersection,
16    /// Street level without house number.
17    Street,
18    /// Postal code area.
19    PostalCode,
20    /// Settlement level (village, town, city).
21    City,
22    /// County or administrative district.
23    County,
24    /// First-level administrative division.
25    State,
26    /// Sovereign country level.
27    Country,
28}
29
30/// One resolved location returned by forward or reverse geocoding.
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub struct PlaceResult {
33    /// Display string the provider produced for this place.
34    pub structured_address_text: String,
35    /// Resolved position.
36    pub coordinate: GeographicCoordinate,
37    /// Structural precision reached for this resolution.
38    pub geocode_quality: GeocodeQuality,
39}