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

GML format always returns 3d geometries #15617

Open
msch-alpgis opened this issue Mar 6, 2024 · 6 comments · May be fixed by #15675
Open

GML format always returns 3d geometries #15617

msch-alpgis opened this issue Mar 6, 2024 · 6 comments · May be fixed by #15675
Labels

Comments

@msch-alpgis
Copy link

When i parse a WFS response with a GML2 format, the features geometries have always three dimensions, even if the WFS response had only 2.

Stackblitz Demo

Same happens for WFS 2.0.0 with GML 3.2. I would expect to get geometries with XY layout not XYZ with fake Z dimension.

@msch-alpgis msch-alpgis added the bug label Mar 6, 2024
@jacklinna
Copy link

what is your WFS server?put its parameters on;

@msch-alpgis
Copy link
Author

In my example the response was from the MapServer. But I can produce the same behaviour with the GeoServer. It doesn't seem to have a relation with the WFS server or the WFS version. After parsing a response with the ol format WFS I always get geometries with a faked Z dimension with value 0.

@mprins
Copy link
Contributor

mprins commented Mar 12, 2024

I don't know the reasoning, but the GML2 parser always produces a z value for a coordinate see:

for (let i = 0, ii = coordsGroups.length; i < ii; i++) {
const coords = coordsGroups[i].split(/,+/);
const x = parseFloat(coords[0]);
const y = parseFloat(coords[1]);
const z = coords.length === 3 ? parseFloat(coords[2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z);
} else {
flatCoordinates.push(y, x, z);
}

@ahocevar
Copy link
Member

See #6620 for an explanation. I don't know if what's written there is true though, so if anyone has an idea for a fix, a pull request would be welcome.

@jacklinna
Copy link

I don't know the reasoning, but the GML2 parser always produces a z value for a coordinate see:

for (let i = 0, ii = coordsGroups.length; i < ii; i++) {
const coords = coordsGroups[i].split(/,+/);
const x = parseFloat(coords[0]);
const y = parseFloat(coords[1]);
const z = coords.length === 3 ? parseFloat(coords[2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z);
} else {
flatCoordinates.push(y, x, z);
}

I think the format of (x,y) is diffrent of (x,y,0);the first is 2d,another is 3d;z=0 does not mean 2d;so fix it just add push(x,y) case;

@ahocevar
Copy link
Member

@jacklinna I think that makes sense. Would you be able to create a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants