Ticket #4486 (closed defect: invalid)

Opened 4 months ago

Last modified 4 months ago

ORG reads incorrectly same content GML files

Reported by: duypl Owned by: tamas
Priority: normal Milestone:
Component: CSharpBindings Version: 1.9.0
Severity: normal Keywords:
Cc:

Description

Hi,

I'm using OGR .NET binding version 1.9 to read and convert GIS files to GML. I download the OGR .NET from this link  http://www.gisinternals.com/sdk/PackageList.aspx?file=release-1600-gdal-1-9-mapserver-6-0.zip

Recently, when using OGR to read two same GML files, I found a funny issue: the content of two GML files is the same except one file has new line and white space while other doesn't. Then the OGR reads them with totally different geometry type !. Below is the code I use to read GML file, the geoType variable will result two different value for two GML file although their content is the same

- For the file without any new line and white space: geoType = wkbGeometryType.wkbMultiPoint

- For the file with new line and white space: geoType = wkbGeometryType.wkbPoint

Is it a bug ?

using (var ds = Ogr.Open("data.gml", 0))
{
	using (var layer = ds.GetLayerByIndex(0))
	{
		Feature f = null;
		do
		{
			f = layer.GetNextFeature();
			if (f == null)
			{
				break;
			}

			using (f)
			using (var geometry = f.GetGeometryRef())
			{
				var geoType = geometry.GetGeometryType();
			}
		} while (f != null);
	}
}

Regards, Duy

Attachments

with-white-space.gml Download (1.0 KB) - added by duypl 4 months ago.
GML file with new line and white space
no-white-space.gml Download (0.9 KB) - added by duypl 4 months ago.
GML file with no new line and white space

Change History

Changed 4 months ago by duypl

GML file with new line and white space

Changed 4 months ago by jratike80

Is the first attached file "no-white-space.gml" perhaps wrong? It contains a LineString? instead of point.

Changed 4 months ago by rouault

  • status changed from new to closed
  • resolution set to invalid

I don't see any problems when reading those files. They are really different, not only by indendation, but also by content. The first one (no-white-space.gml) has indeed a LineString?. And the second one (with-white-space.gml) a Point.

Changed 4 months ago by duypl

GML file with no new line and white space

Changed 4 months ago by duypl

  • status changed from closed to reopened
  • resolution invalid deleted

I'm sorry. I uploaded to wrong file.

The new no-white-space.gml has been udpated again :)

Changed 4 months ago by jratike80

Ogrinfo gives similar report from both files with geometrytype Point. Result from these two commands are identical

ogr2ogr -f GML 1.gml no-white-space.gml 
ogr2ogr -f GML 2.gml with-white-space.gml 

Things does not seem to be very bad in general. I cannot say why your code gives different results. Obviously ogrinfo and ogr2ogr does not have the same problem. Tested with GDAL 1.9.0 binaries from gisinternals on Windows XP.

Changed 4 months ago by rouault

I still don't see any issue. Works for me too.

Hum, just curious, don't you have any rogue .gfs near to your .gml files ? Or a .xsd ?

Changed 4 months ago by duypl

  • status changed from reopened to closed
  • resolution set to invalid

@rouault : yes, there are .xsd file near them. I double check again and found this is pretty confused but obviously this is not a bug of OGR. I have to exam them carefully to find the root cause

Sorry for this :)

Note: See TracTickets for help on using tickets.