1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
/*! Implementation of the Elasticsearch `geo_point` type. Geo points are an Elasticsearch specific geospatial type with an `x` (`lon`) and `y` (`lat`) component. `GeoPoint` is a good choice for storing and analysing geospatial points where geojson compatibility isn't needed. # Examples For defining your own geo point mapping, see [mapping details](mapping/trait.GeoPointMapping.html#derive-mapping). Map with a default `geo_point`: ``` # use elastic_types::geo::point::prelude::*; struct MyType { pub field: GeoPoint<DefaultGeoPointMapping> } ``` Map with a custom `geo_point`: ``` # extern crate serde; # #[macro_use] # extern crate elastic_types; # use std::marker::PhantomData; # use elastic_types::prelude::*; # fn main() { # use elastic_types::prelude::*; # use elastic_types::geo::point::prelude::*; # #[derive(Default)] # struct MyGeoPointMapping; # impl GeoPointMapping for MyGeoPointMapping { type Format = GeoPointString; } struct MyType { pub field: GeoPoint<MyGeoPointMapping> } # } ``` Map a custom type as a `geo_point` field: ``` # extern crate serde; # #[macro_use] # extern crate elastic_types; # #[macro_use] # extern crate serde_derive; # fn main() { # use elastic_types::prelude::*; #[derive(Serialize)] struct MyGeoPointField(f32, f32); impl GeoPointFieldType<DefaultGeoPointMapping<GeoPointObject>> for MyGeoPointField {} # } ``` # Links - [Elasticsearch Doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html) */ use georust::{Coordinate as C, Geometry as G, Point as P}; type Coordinate = C<f64>; type Point = P<f64>; type Geometry = G<f64>; pub mod mapping; mod impls; mod format; mod formats; pub use self::impls::*; pub use self::format::*; pub use self::formats::*; pub mod prelude { /*! Includes all types for the `geo_point` type. This is a convenience module to make it easy to build mappings for multiple types without too many `use` statements. */ pub use super::DefaultGeoPointFormat; pub use super::format::*; pub use super::impls::*; pub use super::formats::*; pub use super::mapping::*; }