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

Some geometries are not read from BGT .gml, resulting in NULL geometries. #703

Closed
jipclaassens opened this issue Apr 4, 2024 · 13 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@jipclaassens
Copy link
Member

No description provided.

@jipclaassens jipclaassens added the bug Something isn't working label Apr 4, 2024
@eoudejans
Copy link
Collaborator

See difference between QGIS and GeoDMS readin:
image

@eoudejans
Copy link
Collaborator

Curved geometries are translated to linear geometries using the function geo->getLinearGeometry() see in gdal_vect.cpp line 534:

		gdalVectImpl::FeaturePtr feat = m_hDS->TestCapability(ODsCRandomLayerRead) ? GetNextFeatureInterleaved(layer, m_hDS) : layer->GetNextFeature();
		OGRGeometry* geo = feat ? feat ->GetGeometryRef() : 0;
		if (geo) {
			if (dynamic_cast<OGRLineString*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo)); 
			else if (dynamic_cast<OGRCircularString*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRCompoundCurve*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRPolygon*>(geo))
				AddPolygon<PolygonType>(dataElemRef, static_cast<OGRPolygon*>(geo));
			else if (dynamic_cast<OGRMultiPolygon*>(geo))
				AddMultiPolygon<PolygonType>(dataElemRef, static_cast<OGRMultiPolygon*>(geo));
			else if (dynamic_cast<OGRCurvePolygon*>(geo))
				AddPolygon<PolygonType>(dataElemRef, static_cast<OGRPolygon*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRMultiPoint*>(geo))
				AddMultiPoint<PolygonType>(dataElemRef, static_cast<OGRMultiPoint*>(geo));
			else if (dynamic_cast<OGRMultiLineString*>(geo))
				AddMultiLineString<PolygonType>(dataElemRef, static_cast<OGRMultiLineString*>(geo));
		}

@jipclaassens jipclaassens changed the title CurvePolygon from .gml not correctly read CurvePolygon from BGT .gml not correctly read Apr 19, 2024
@jipclaassens
Copy link
Member Author

Curved geometries are translated to linear geometries using the function geo->getLinearGeometry() see in gdal_vect.cpp line 534:

		gdalVectImpl::FeaturePtr feat = m_hDS->TestCapability(ODsCRandomLayerRead) ? GetNextFeatureInterleaved(layer, m_hDS) : layer->GetNextFeature();
		OGRGeometry* geo = feat ? feat ->GetGeometryRef() : 0;
		if (geo) {
			if (dynamic_cast<OGRLineString*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo)); 
			else if (dynamic_cast<OGRCircularString*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRCompoundCurve*>(geo))
				AddLineString<PolygonType>(dataElemRef, static_cast<OGRLineString*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRPolygon*>(geo))
				AddPolygon<PolygonType>(dataElemRef, static_cast<OGRPolygon*>(geo));
			else if (dynamic_cast<OGRMultiPolygon*>(geo))
				AddMultiPolygon<PolygonType>(dataElemRef, static_cast<OGRMultiPolygon*>(geo));
			else if (dynamic_cast<OGRCurvePolygon*>(geo))
				AddPolygon<PolygonType>(dataElemRef, static_cast<OGRPolygon*>(geo->getLinearGeometry()));
			else if (dynamic_cast<OGRMultiPoint*>(geo))
				AddMultiPoint<PolygonType>(dataElemRef, static_cast<OGRMultiPoint*>(geo));
			else if (dynamic_cast<OGRMultiLineString*>(geo))
				AddMultiLineString<PolygonType>(dataElemRef, static_cast<OGRMultiLineString*>(geo));
		}

Is this evidence that curve polygons are not the issue, or is this indeed a path to solution?
BGT-updates are blocked by this issues
https://github.com/ObjectVision/BGT-Tools

@eoudejans eoudejans changed the title CurvePolygon from BGT .gml not correctly read Some geometries are not read from BGT .gml, resulting in NULL geometries. Apr 22, 2024
@eoudejans
Copy link
Collaborator

Curve polygon hypothesis is likely not the culprit. Closer inspection of the differences shows that building geometries of multi-polygon type with no connection between multiple parts result in null reads at geodms side. Several examples:

VU MC:
image

Two geometries to the North of VU MC that also don't read correctly:
image

@eoudejans
Copy link
Collaborator

Geometry type of geometries that do not read in properly is of type wkbMultiSurface:

image

@eoudejans
Copy link
Collaborator

Added support for surface and multisurface, internally translated to polygon and multipolygon, see:
image

eoudejans added a commit that referenced this issue Apr 22, 2024
eoudejans added a commit that referenced this issue Apr 22, 2024
@eoudejans
Copy link
Collaborator

@eoudejans
Copy link
Collaborator

OGRCurvePolygon is a subtype of Surface:
https://gdal.org/doxygen/classOGRCurvePolygon.html

@eoudejans
Copy link
Collaborator

OGRMultiPolygon is a subtype of MultiSurface:
https://gdal.org/doxygen/classOGRMultiPolygon.html

@eoudejans
Copy link
Collaborator

eoudejans commented Apr 23, 2024

Binary GPKG BLOB of MultiSurface
image
:

4750000300000000ec1d19f55202fd40
7c98976ef402fd40bee5bfa1097f1d41
01838556377f1d41010c000000070000
00010a00000001000000010900000004
0000000108000000030000006f1283c0
c002fd400ad7a3f0117f1d41e9263108
de02fd40f6285c8f187f1d41a245b6f3
e502fd40dbf97eea217f1d4101020000
0002000000a245b6f3e502fd40dbf97e
ea217f1d41508d976e8802fd40273108
ac2f7f1d41010800000003000000508d
976e8802fd40273108ac2f7f1d41ec51
b81e6b02fd40b4c876be287f1d410681
95436302fd401b2fdda41f7f1d410102
00000002000000068195436302fd401b
2fdda41f7f1d416f1283c0c002fd400a
d7a3f0117f1d41010a00000001000000
01090000000200000001020000000200
000000000000ae02fd403d0ad723357f
1d412db29defad02fd40448b6c67357f
1d410108000000030000002db29defad
02fd40448b6c67357f1d4139b4c8769c
02fd40894160e5347f1d4100000000ae
02fd403d0ad723357f1d41010a000000
01000000010900000002000000010200
000002000000ec51b81e6502fd407d3f
35de2a7f1d411904560e6502fd4083c0
ca212b7f1d4101080000000300000019
04560e6502fd4083c0ca212b7f1d4125
0681955302fd400e2db29d2a7f1d41ec
51b81e6502fd407d3f35de2a7f1d4101
0a000000010000000109000000020000
000102000000020000007d3f355ef402
fd40022b87962a7f1d41508d976ef402
fd4008ac1cda2a7f1d41010800000003
000000508d976ef402fd4008ac1cda2a
7f1d41b6f3fdd4e202fd401f85ebd12a
7f1d417d3f355ef402fd40022b87962a
7f1d41010a0000000100000001090000
0002000000010200000002000000c520
b0726402fd404a0c022b167f1d410c02
2b876402fd40560e2db2167f1d410108
000000030000000c022b876402fd4056
0e2db2167f1d415c8fc2f55202fd40b0
726891167f1d41c520b0726402fd404a
0c022b167f1d41010a00000001000000
01090000000200000001020000000200
0000d34d6210f402fd400e2db29d167f
1d41448b6ce7f302fd4014ae47e1167f
1d41010800000003000000448b6ce7f3
02fd4014ae47e1167f1d419cc420b0e2
02fd40d122dbf9157f1d41d34d6210f4
02fd400e2db29d167f1d41010a000000
01000000010900000002000000010200
00000200000091ed7c3fad02fd401d5a
64bb0b7f1d411d5a643bad02fd4023db
f9fe0b7f1d410108000000030000001d
5a643bad02fd4023dbf9fe0b7f1d4156
0e2db29b02fd40f853e3a50b7f1d4191
ed7c3fad02fd401d5a64bb0b7f1d41

@eoudejans
Copy link
Collaborator

Binary BLOB of Polygon
image
:

4750000300000000d7a3703dc403fd40
c520b0721404fd408b6ce7fb227d1d41
2fdd24063b7d1d410106000000010000
00010300000001000000070000000ad7
a3701304fd408b6ce7fb3a7d1d41c520
b072c403fd402fdd24063b7d1d41c520
b072c403fd4021b072e83a7d1d41d7a3
703dc403fd402fdd2406237d1d41d7a3
703d1404fd408b6ce7fb227d1d41c520
b0721404fd408b6ce7fb3a7d1d410ad7
a3701304fd408b6ce7fb3a7d1d41

@eoudejans
Copy link
Collaborator

GPKG BLOB header definition:
image

https://www.geopackage.org/spec/

@jipclaassens
Copy link
Member Author

Indeed it seems to be working now!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants