NetTopologySuite / NetTopologySuite.IO.SpatiaLite

SpatialLite IO module for NTS.
BSD 3-Clause "New" or "Revised" License
7 stars 9 forks source link

Geopackage Point problem #11

Open Boerme84 opened 1 month ago

Boerme84 commented 1 month ago

When creating a single point, an 32 byte empty envelope is also created in the GeoPackage header:

var GeometryFactory = NetTopologySuite.NtsGeometryServices.Instance.CreateGeometryFactory(25832);
var coord = new Coordinate(10, 20);
var pnt = GeometryFactory.CreatePoint(coord);
var writer = new GeoPackageGeoWriter
{
    HandleOrdinates = Ordinates.XY   
};

byte[] bytes = writer.Write(pnt);

The problem here is that flags (value is 3) is set to include a 32 byte envelope, with all zeros (see GeopackageHeader definition below)

//definition from geopackage.org
GeoPackageBinaryHeader {
  byte[2] magic = 0x4750; 
  byte version;           
  byte flags;             
  int32 srs_id;           
  double[] envelope;      
}

So how do you set the values min/max values for the envelope ?

Also it would be nice to exclude the envelope entirely to save space, but this is only possible when ordinates is set to Ordinate.None. But Ordinate.None is enterpreted as Ordinates.XY, so it seems that this is not possible.

QGIS will only read the point layer correctly if min/max envelope values are set for the points, or if envelope is excluded.

System Configuration

FObermaier commented 3 weeks ago

@Boerme84 could you check if the current fix addresses your issue correctly? TIA