You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experimenting an issue converting from geos::Geometry to geojson::Geometry type. It looks like the readme has not been updated since this commit 1614a49 makes use of the std TryFrom trait.
I have this sample code:
let pt = "POINT(1.0 1.0)";
let pt = geos::Geometry::new_from_wkt(pt).unwrap();
let geom: geojson::Geometry = pt.try_into().unwrap();
and the compiler shows this error:
error[E0277]: the trait bound `Value: From<geos::Geometry<'_>>` is not satisfied
--> src/main.rs:79:38
|
79 | let geom: geojson::Geometry = pt.try_into().unwrap();
| ^^^^^^^^ the trait `From<geos::Geometry<'_>>` is not implemented for `Value`
|
= note: required because of the requirements on the impl of `Into<Value>` for `geos::Geometry<'_>`
= note: required because of the requirements on the impl of `From<geos::Geometry<'_>>` for `geojson::Geometry`
= note: required because of the requirements on the impl of `Into<geojson::Geometry>` for `geos::Geometry<'_>`
= note: required because of the requirements on the impl of `TryFrom<geos::Geometry<'_>>` for `geojson::Geometry`
= note: required because of the requirements on the impl of `TryInto<geojson::Geometry>` for `geos::Geometry<'_>`
I have the geos library with json feature enabled.
Thanks for the bug report! This is likely because of mismatched versions between dependencies. Can you cargo-tree to ensure all your geo-types and geojson dependency versions match?
@frewsxcv Thank you! Running cargo tree saw a mismatch between geojson (0.20.1) and the geojson crate used in geos (0.19.0). changing the version in Cargo.toml file worked perfectly
First of all, thanks for this library.
I am experimenting an issue converting from geos::Geometry to geojson::Geometry type. It looks like the readme has not been updated since this commit 1614a49 makes use of the std TryFrom trait.
I have this sample code:
and the compiler shows this error:
I have the geos library with json feature enabled.
Curiously, the code compiles by first doing a conversion to geo_types and then to geojson
I found here
geos/src/enums.rs
Line 5 in 0a4862d
It looks like the geojson::Geometry type has not implemented the TryFrom crate within to_geojson.rs file.
Let me know your opinion
The text was updated successfully, but these errors were encountered: