Opened 12 years ago
Closed 12 years ago
#4486 closed defect (invalid)
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 (2)
Change History (8)
by , 12 years ago
Attachment: | with-white-space.gml added |
---|
comment:1 by , 12 years ago
Is the first attached file "no-white-space.gml" perhaps wrong? It contains a LineString instead of point.
comment:2 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
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.
comment:3 by , 12 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I'm sorry. I uploaded to wrong file.
The new no-white-space.gml has been udpated again :)
comment:4 by , 12 years ago
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.
comment:5 by , 12 years ago
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 ?
comment:6 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
@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 :)
GML file with new line and white space