Skip to content

Commit

Permalink
Merge #215
Browse files Browse the repository at this point in the history
215: Update to postgis 0.6 r=frewsxcv a=lnicola



Co-authored-by: Laurentiu Nicola <lnicola@dend.ro>
  • Loading branch information
bors[bot] and lnicola committed May 13, 2018
2 parents ae43570 + af203e6 commit f2fd7bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion geo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ num-traits = "0.2"
serde = { version = "1.0", optional = true, features = ["derive"] }
spade = "1.3.0"
failure = "0.1.1"
postgis = { version = "0.5", optional = true }
postgis = { version = "0.6", optional = true }
proj = { version = "0.5", optional = true }
geo-types = { version = "0.1.0", features = ["spade"] }

Expand Down
20 changes: 5 additions & 15 deletions geo/src/algorithm/to_postgis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,22 @@ impl ToPostgis<ewkb::Polygon> for Polygon<f64> {
}
}
macro_rules! to_postgis_impl {
($from:ident, $to:path, $name:ident, srid) => {
impl ToPostgis<$to> for $from<f64> {
fn to_postgis_with_srid(&self, srid: Option<i32>) -> $to {
let $name = self.0.iter()
.map(|x| x.to_postgis_with_srid(srid))
.collect();
$to { $name, srid }
}
}
};
($from:ident, $to:path, $name:ident) => {
impl ToPostgis<$to> for $from<f64> {
fn to_postgis_with_srid(&self, srid: Option<i32>) -> $to {
let $name = self.0.iter()
.map(|x| x.to_postgis_with_srid(srid))
.collect();
$to { $name }
$to { $name, srid }
}
}
};
}
to_postgis_impl!(GeometryCollection, ewkb::GeometryCollection, geometries);
to_postgis_impl!(MultiPolygon, ewkb::MultiPolygon, polygons, srid);
to_postgis_impl!(MultiLineString, ewkb::MultiLineString, lines, srid);
to_postgis_impl!(MultiPoint, ewkb::MultiPoint, points, srid);
to_postgis_impl!(LineString, ewkb::LineString, points, srid);
to_postgis_impl!(MultiPolygon, ewkb::MultiPolygon, polygons);
to_postgis_impl!(MultiLineString, ewkb::MultiLineString, lines);
to_postgis_impl!(MultiPoint, ewkb::MultiPoint, points);
to_postgis_impl!(LineString, ewkb::LineString, points);
impl ToPostgis<ewkb::Geometry> for Geometry<f64> {
fn to_postgis_with_srid(&self, srid: Option<i32>) -> ewkb::Geometry {
match *self {
Expand Down
1 change: 0 additions & 1 deletion geo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extern crate spade;
extern crate postgis;
#[cfg(feature = "use-proj")]
extern crate proj;
#[macro_use]
extern crate failure;

pub use traits::ToGeo;
Expand Down

0 comments on commit f2fd7bf

Please sign in to comment.