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

Preparation for PR reprojection 'a la volee' #2422

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ftoromanoff
Copy link
Contributor

No description provided.

@ftoromanoff ftoromanoff force-pushed the prepAlaVolee branch 9 times, most recently from eefe617 to add66c8 Compare October 4, 2024 07:34
@ftoromanoff ftoromanoff marked this pull request as ready for review October 4, 2024 07:40
Copy link
Contributor

@Desplandis Desplandis left a comment

Choose a reason for hiding this comment

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

I have a few comments for this PR (mainly on proj4 patching). Could you rename the commit "supp onPointsCreated" to "delete onPointsCreated callack"?

@@ -61,7 +64,7 @@ function toUnit(crs) {
case 'EPSG:4326' : return UNIT.DEGREE;
case 'EPSG:4978' : return UNIT.METER;
default: {
const p = proj4.defs(formatToEPSG(crs));
const p = proj4.defs(crs.startsWith('TMS') ? formatToEPSG(crs) : crs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that there is no part of the code which depends on the assumption that a crs starts either by EPSG: or TMS:? Maybe this conversion is not needed anymore with #2412.

Comment on lines +54 to +55
} else if (projunit === 'foot') {
return UNIT.FOOT;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm all for splitting support of foot unit and support of non-EPSG/TMS crs in two different commits.

Comment on lines -285 to -288
if (this.onPointsCreated) {
this.onPointsCreated(layer, pts);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not documented, nor used (except for one unit test). Shall we mark this as breaking change?

Comment on lines +109 to +124
if (proj4.defs('unknown').type === 'COMPD_CS') {
console.warn('CopcSource: compound coordinate system is not yet supported.');
metadata.wkt = metadata.wkt.slice(metadata.wkt.search('PROJCS'), metadata.wkt.search(',VERT_CS'));
proj4.defs('unknown', metadata.wkt);
}

const projCS = proj4.defs('unknown');
if (projCS.AUTHORITY) {
const authority = Object.keys(projCS.AUTHORITY)[0];
this.crs = `${authority}:${projCS.AUTHORITY[authority]}`;
if (!proj4.defs(this.crs)) {
proj4.defs(this.crs, proj4.defs('unknown'));
}
} else {
this.crs = projCS.name || 'EPSG:4326';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems we are patching a missing feature of proj4.js, I'm for proposing a PR directly upstream instead of patching it in iTowns...

Comment on lines +43 to +52
if (metadata.srs) {
if (metadata.srs.authority && metadata.srs.horizontal) {
this.crs = `${metadata.srs.authority}:${metadata.srs.horizontal}`;
if (!proj4.defs(this.crs)) {
proj4.defs(this.crs, metadata.srs.wkt);
}
} else if (metadata.srs.wkt) {
proj4.defs('unknown', metadata.srs.wkt);
this.crs = proj4.defs('unknown').name;
proj4.defs(this.crs, proj4.defs('unknown'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, the wkt parser breaks the type invariant that what type returned by proj4.defs(crs) (i.e. the ProjectionDefinition type) shall return a defined title property. We could use this property to uniquely define a projection.

I suggest that we could contribute to proj4 such fix (using srs.authority) to define the title property.

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