Skip to content

fix: update featuresGeojsonChange event to match new geojsonChange behavior#479

Merged
jessicamcinchak merged 2 commits intomainfrom
jess/deprecate-featuresAreaChange-areaUnit
Aug 26, 2024
Merged

fix: update featuresGeojsonChange event to match new geojsonChange behavior#479
jessicamcinchak merged 2 commits intomainfrom
jess/deprecate-featuresAreaChange-areaUnit

Conversation

@jessicamcinchak
Copy link
Copy Markdown
Member

Follows on from #466

Changes:

  • Similar to drawMode - the clickFeatures functionality dispatches geojson & area events which should stay consistent with recent changes we've made to event dispatching - so we're deprecating featuresAreaChange event and instead setting "area" directly on the featuresGeojsonChange event data "properties"
  • Deprecates areaUnit prop and simply sets both "area.squareMetres" and "area.hectares" anywhere we calculate the area (these field names & new number type are more consistent with ODP Schema too)

@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 24, 2024

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit 2dd8b0b
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/66cc5cf0b2d28a00088843cf
😎 Deploy Preview https://deploy-preview-479--oslmap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment thread src/components/my-map/index.ts Outdated
Comment on lines +556 to +560
sketch.set(
"area.squareMetres",
calculateArea(sketchGeom, "m2"),
);
sketch.set("area.hectares", calculateArea(sketchGeom, "ha"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: There's a setProperties() that allows multiple values to be set at once. No better or worse, just sharing!

Comment on lines +30 to +34
switch (unit) {
case "m2":
return squareMetres;
case "ha":
return hectares;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Co-authored-by: Dafydd Llŷr Pearson <DafyddLlyr@gmail.com>
@jessicamcinchak jessicamcinchak merged commit 24d64e8 into main Aug 26, 2024
@jessicamcinchak jessicamcinchak deleted the jess/deprecate-featuresAreaChange-areaUnit branch August 26, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants