Skip to content
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

Improve documentation for rewind #2858

Open
ethanchristensen01 opened this issue Mar 17, 2025 · 1 comment
Open

Improve documentation for rewind #2858

ethanchristensen01 opened this issue Mar 17, 2025 · 1 comment

Comments

@ethanchristensen01
Copy link

The documentation for turf.rewind left me confused after reading it. I could not understand what it was supposed to do.

The description section links to the Shoelace formula on Wikipedia, which itself has no mentions of rewinding or winding. Part of the description should include a short explanation of what winding is and how rewind changes it.

The example section shows the function being called and displays the resulting rectangle, but that rectangle is no different visually than the original rectangle. It would be beneficial to display the JSON or coordinates of both items somehow.

@ethanchristensen01
Copy link
Author

I looked into how the documentation gets generated and how the example gets added to the map. Examples are defined in a jsdoc comment in the source file, and an array of items are assigned to var addToMap after a //addToMap comment. Could we add something similar to inspect the JSON, such as inspectJson? var inspectJson could accept an object mapping a name/access path to a value.

var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]);

var rewind = turf.rewind(polygon);

//addToMap
var addToMap = [rewind];

//inspectJson
var inspectJson = {
  "polygon.geometry": polygon.geometry,
  "rewind.geometry": rewind.geometry 
};

However we decide to represent it, it would be handled in turf-www/scripts/generate-api-mdx.ts.

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

No branches or pull requests

1 participant