Repository navigation
Tools that don't depend on the coordinate system work in their layer's own projected system (#2032 C2e-1) #2611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
93ed103
e8568c7
d730bc9
94d422d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,7 +65,7 @@ pub static TOOLS: &[ToolSpec] = &[ | |
| id: "featureEnvelopeToPolygon", | ||
| name: "Feature Envelope To Polygon", | ||
| toolbox: "Data Management › Features", | ||
| summary: "Writes one axis-aligned bounding rectangle per feature in stored longitude/latitude coordinates. Zero-area envelopes are skipped.", | ||
| summary: "Writes one axis-aligned bounding rectangle per feature in the layer's own coordinates when it is held in a projected system other than Web Mercator, else in longitude/latitude. Zero-area envelopes are skipped.", | ||
| params: &[ | ||
| P { name: "input", label: "Input Features", kind: K::Layer, required: true, default: "", help: "" }, | ||
| P { name: "output", label: "Output Name", kind: K::Text, required: false, default: "", help: "" }, | ||
|
|
@@ -6715,6 +6715,9 @@ fn export_features(inp: &dyn Inputs, p: &Json) -> Result<ToolResult, String> { | |
| rs.retain(|r| rustgis_data::query::eval(&e, ds, *r)); | ||
| } | ||
| let mut out = copy_schema(ds, out_name(p, format!("{}_Export", ds.name)), ds.geometry_type); | ||
| // Its features as they are: in the input's system, which exports use by default, with what it | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment is slightly inaccurate: the output's features are held in the system the run worked in ( Confidence: high; wording only. |
||
| // lost on reading. | ||
| (out.crs, out.crs_incomplete, out.zm_dropped) = (ds.crs, ds.crs_incomplete, ds.zm_dropped); | ||
| for r in rs { | ||
| if let Some(f) = ds.features.get(r) { | ||
| out.push(f.geometry.clone(), f.attrs.clone()); | ||
|
|
@@ -8165,7 +8168,8 @@ fn split_line_at_vertices(inp: &dyn Inputs, p: &Json) -> Result<ToolResult, Stri | |
| geometry::split(inp, p) | ||
| } | ||
|
|
||
| /// Encloses each feature independently in longitude/latitude axes. | ||
| /// Encloses each feature independently in its layer's own axes (longitude/latitude for a layer | ||
| /// not in a projected system). | ||
| fn feature_envelope_to_polygon(inp: &dyn Inputs, p: &Json) -> Result<ToolResult, String> { | ||
| geometry::convert(inp, p, geometry::Conversion::FeatureEnvelopeToPolygon) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,7 +330,9 @@ impl TryFrom<SavedCrs> for Crs { | |
| Ok(match s { | ||
| SavedCrs::LonLat => Crs::LonLat, | ||
| SavedCrs::WebMercator => Crs::WebMercator, | ||
| SavedCrs::Epsg(e) => Crs::Epsg(e), | ||
| // A code another variant stands for (4326, 3857 and its aliases), as a file written | ||
| // by hand or by another program may give it, is that variant, as `from_epsg` gives it. | ||
| SavedCrs::Epsg(e) => Crs::from_epsg(u32::from(e)).unwrap_or(Crs::Epsg(e)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AGENTS.md: this changes how a project is read, but no fixture was added.
Suggested fix: add a small fixture under Confidence: medium. I did not check whether the schema fixture tests exercise every
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6e7414b. New fixture |
||
| SavedCrs::Proj { proj4, label, wkt } => Crs::custom(CustomCrs { proj4, label, wkt, ..CustomCrs::default() })?, | ||
| }) | ||
| } | ||
|
|
@@ -2462,6 +2464,15 @@ impl Transformer { | |
| mod tests { | ||
| use super::*; | ||
|
|
||
| /// A saved code another variant stands for reads as that variant, so Web Mercator saved as | ||
| /// `{"Epsg": 3857}` isn't taken for a projected system of its own. | ||
| #[test] | ||
| fn a_saved_code_another_variant_stands_for_reads_as_it() { | ||
| for (code, crs) in [(3857, Crs::WebMercator), (3785, Crs::WebMercator), (4326, Crs::LonLat), (32632, Crs::Epsg(32632))] { | ||
| assert_eq!(Crs::try_from(SavedCrs::Epsg(code)), Ok(crs), "EPSG:{code}"); | ||
| } | ||
| } | ||
|
|
||
| /// An ESRI code reads as the system the picker offers for it (`ESRI:102033`, as a `.prj` and | ||
| /// the coordinate system boxes name it); one the catalog lacks is refused with its name. | ||
| #[test] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quality, low:
reads_geometry_ofhard-codes the tool id and parameter name ("joinField"/"joinTable") inside a genericToolSpecmethod. Behaviour is correct today, but the next tool with an attribute-only input would need another special case here and inengine/src/cmd/gp.rs. A per-parameter flag on the parameter spec would keep that knowledge in the tool table.Confidence: high that it works; this is a maintainability point only.