Skip to content

Fix printing circles#49

Merged
gberaudo merged 7 commits into
geoblocks:mainfrom
maltaesousa:fix-circles
Feb 9, 2026
Merged

Fix printing circles#49
gberaudo merged 7 commits into
geoblocks:mainfrom
maltaesousa:fix-circles

Conversation

@maltaesousa

Copy link
Copy Markdown
Contributor

This PR fixes an issue where a Circle was converted to a FeatureCollection and not printed at all.

You can reproduce the bug here:

These modifications allow to keep the original style of the circle and just convert the geometry

@maltaesousa

Copy link
Copy Markdown
Contributor Author

ping @gberaudo or @ger-benjamin :) Sorry I can't ask for reviews

Comment thread src/VectorEncoder.ts Outdated
Co-authored-by: Stéphane Brunner <stephane.brunner@camptocamp.com>
@maltaesousa

Copy link
Copy Markdown
Contributor Author

hello, any updates? :)

@ger-benjamin ger-benjamin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I don't really have time for that currently :-/
It looks fine to me, but is it fine to NOT do anymore (was line 171):

feature = this.featureCircleAsPolygon(feature as Feature<Circle>);

And after that, still doing ?:

const origGeojsonFeature = this.geojsonFormat.writeFeatureObject(feature);

Also featureCircleAsPolygon is now unused, I think e can remove it (but it's protected, that means, that's a breaking change to remove it)

@maltaesousa

Copy link
Copy Markdown
Contributor Author

@ger-benjamin Fixed what you've mentioned and added a test for what was happening on geogirafe. Let me know if anything is missing or unclear

Comment thread package.json Outdated
Comment thread src/VectorEncoder.ts

const featureGeometry = feature.getGeometry();
if (featureGeometry.getType() === "Circle") {
feature.setGeometry(fromCircle(featureGeometry as Circle, Constants.CIRCLE_TO_POLYGON_SIDES));

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.

It would be surprising for a user to have its features modified after calling this library. That is why it is necessary to clone the feature.

Comment thread CHANGES.md Outdated
@gberaudo

gberaudo commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

@maltaesousa , thanks for your contribution. I will do the changes and merge.

@gberaudo gberaudo merged commit 8ed928a into geoblocks:main Feb 9, 2026
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.

4 participants