Example #1
0
        public GpkgTileSchema(GpkgContent content)
        {
            Debug.Assert(content.DataType == "tiles", "Not a 'tiles' GeoPackageContent");
            _name = content.TableName;

            var tms = GpkgTileMatrixSet.Read(content);

            Format = "image/png";
            Extent = new Extent(content.Extent.MinX, content.Extent.MinY,
                                content.Extent.MaxX, content.Extent.MaxY);
            Srs          = "EPSG:" + content.SRID;
            _resolutions = tms.ToResolutions();
        }
Example #2
0
            public static GpkgTileMatrixSet Read(GpkgContent content)
            {
                GpkgTileMatrixSet tms;

                using (var cn = new SQLiteConnection(content.ConnectionString).OpenAndReturn())
                {
                    // Read the tile matrix set
                    var cmd = new SQLiteCommand(SelectTileMatrixSet, cn);
                    cmd.Parameters.AddWithValue(null, content.TableName);
                    var rdr = cmd.ExecuteReader();
                    rdr.Read();
                    tms = new GpkgTileMatrixSet(rdr);

                    // Read the tile matrices for the tile matrix set
                    cmd = new SQLiteCommand(SelectTileMatrix, cn);
                    cmd.Parameters.AddWithValue(null, content.TableName);
                    rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        tms.TileMatrices.Add(new GpkgTileMatrix(rdr));
                    }
                }
                return(tms);
            }