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

CADENZA-36891: Extend API for geometry intersection #37

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

AndreasWBartels
Copy link
Member

No description provided.

CHANGELOG.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
sandbox.cjs Outdated Show resolved Hide resolved
sandbox.html Outdated Show resolved Hide resolved
@@ -244,7 +251,8 @@
layers: layers ? JSON.parse(layers) : undefined,
useMapSrs: useMapSrs === 'on',
fullGeometries: fullGeometries === 'on',
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined,
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined
Copy link
Member

Choose a reason for hiding this comment

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

  • Why not just "unit"? Imo the "length" doesn't add anything here.
  • The unit cannot be missing, because it's a that has a default value, right?

Copy link
Member Author

@AndreasWBartels AndreasWBartels Aug 27, 2024

Choose a reason for hiding this comment

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

lenghtUnit is just a little more precise for the current context, theoretically it could be also a degree unit

yes, 'm' (meters) is the default for the current context.

Copy link
Member

Choose a reason for hiding this comment

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

I meant that

lengthUnit: lengthUnit ? lengthUnit : 'm'

can be simplified to

lengthUnit

because the lengthUnit cannot be undefined.

src/cadenza.js Outdated Show resolved Hide resolved
{ useMapSrs, buffer, signal} = {},
) {
this.#log('CadenzaClient#areaIntersection', ...arguments);
const params = createParams({});
Copy link
Member

Choose a reason for hiding this comment

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

Proposal: Rather make the "params" argument optional instead of passing a dummy value.

@type URLSearchParams | undefined

src/docs.md Outdated Show resolved Hide resolved
src/docs.md Outdated
lengthUnit: 'm'
}

const response = await cadenzaClient.fetchAreaIntersection('embeddingTargetId', 'layerPrintName', geometry, {
Copy link
Member

Choose a reason for hiding this comment

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

Most of the examples in here use <placeholders>. I'd keep it consistent (and also fix the OI example).

src/docs.md Outdated
bufferSize: bufferSize
});

const featureCollection = await response;
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't make sense to await the response twice (also in the OI example).

Copy link
Member

Choose a reason for hiding this comment

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

Why not "just" assign the result to that variable straight-away?

const featureCollection = await ...

sandbox.cjs Outdated Show resolved Hide resolved
@@ -244,7 +251,8 @@
layers: layers ? JSON.parse(layers) : undefined,
useMapSrs: useMapSrs === 'on',
fullGeometries: fullGeometries === 'on',
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined,
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined
Copy link
Member

Choose a reason for hiding this comment

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

I meant that

lengthUnit: lengthUnit ? lengthUnit : 'm'

can be simplified to

lengthUnit

because the lengthUnit cannot be undefined.

<textarea name="geometry" id="geometry" rows="5" required></textarea>
<small>
<p>
The geometry must result in an area in combination with the buffer specification.
Copy link
Member

Choose a reason for hiding this comment

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

So far we try to assert things if possible before hitting the server.

src/docs.md Outdated
bufferSize: bufferSize
});

const featureCollection = await response;
Copy link
Member

Choose a reason for hiding this comment

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

Why not "just" assign the result to that variable straight-away?

const featureCollection = await ...

Copy link
Contributor

@JensLuebke JensLuebke left a comment

Choose a reason for hiding this comment

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

approved

@JensLuebke JensLuebke merged commit 8d8f767 into main Sep 17, 2024
1 check passed
@JensLuebke JensLuebke deleted the slb/ab/intersection branch September 17, 2024 11:23
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.

3 participants