diff --git a/internal/geoparquet/geoparquet.go b/internal/geoparquet/geoparquet.go index 7d16342..3761b63 100644 --- a/internal/geoparquet/geoparquet.go +++ b/internal/geoparquet/geoparquet.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "1.0.0-beta.1" + Version = "1.0.0" MetadataKey = "geo" EncodingWKB = "WKB" EncodingWKT = "WKT" diff --git a/internal/geoparquet/geoparquet_test.go b/internal/geoparquet/geoparquet_test.go index 5c613c4..2469a42 100644 --- a/internal/geoparquet/geoparquet_test.go +++ b/internal/geoparquet/geoparquet_test.go @@ -87,6 +87,32 @@ func TestGetMetadataV100Beta1(t *testing.T) { assert.Equal(t, "WGS 84 (CRS84)", col.CRS.Name) } +func TestGetMetadataV1(t *testing.T) { + fixturePath := "../testdata/cases/example-v1.0.0.parquet" + info, statErr := os.Stat(fixturePath) + require.NoError(t, statErr) + + input, openErr := os.Open(fixturePath) + require.NoError(t, openErr) + + file, fileErr := parquet.OpenFile(input, info.Size()) + require.NoError(t, fileErr) + + metadata, geoErr := geoparquet.GetMetadata(file) + require.NoError(t, geoErr) + + assert.Equal(t, "geometry", metadata.PrimaryColumn) + assert.Equal(t, "1.0.0", metadata.Version) + require.Len(t, metadata.Columns, 1) + + col := metadata.Columns[metadata.PrimaryColumn] + assert.Equal(t, "WKB", col.Encoding) + geomTypes := col.GetGeometryTypes() + assert.Len(t, geomTypes, 2) + assert.Contains(t, geomTypes, "Polygon") + assert.Contains(t, geomTypes, "MultiPolygon") +} + func TestRowReaderV040(t *testing.T) { fixturePath := "../testdata/cases/example-v0.4.0.parquet" info, statErr := os.Stat(fixturePath) diff --git a/internal/testdata/cases/example-v1.0.0.parquet b/internal/testdata/cases/example-v1.0.0.parquet new file mode 100644 index 0000000..1959005 Binary files /dev/null and b/internal/testdata/cases/example-v1.0.0.parquet differ diff --git a/internal/testdata/schema/geoparquet.org/releases/v1.0.0/schema.json b/internal/testdata/schema/geoparquet.org/releases/v1.0.0/schema.json new file mode 100644 index 0000000..b416090 --- /dev/null +++ b/internal/testdata/schema/geoparquet.org/releases/v1.0.0/schema.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GeoParquet", + "description": "Parquet metadata included in the geo field.", + "type": "object", + "required": ["version", "primary_column", "columns"], + "properties": { + "version": { + "type": "string", + "const": "1.0.0" + }, + "primary_column": { + "type": "string", + "minLength": 1 + }, + "columns": { + "type": "object", + "minProperties": 1, + "patternProperties": { + ".+": { + "type": "object", + "required": ["encoding", "geometry_types"], + "properties": { + "encoding": { + "type": "string", + "const": "WKB" + }, + "geometry_types": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "pattern": "^(GeometryCollection|(Multi)?(Point|LineString|Polygon))( Z)?$" + } + }, + "crs": { + "oneOf": [ + { + "$ref": "https://proj.org/schemas/v0.5/projjson.schema.json" + }, + { + "type": "null" + } + ] + }, + "edges": { + "type": "string", + "enum": ["planar", "spherical"] + }, + "orientation": { + "type": "string", + "const": "counterclockwise" + }, + "bbox": { + "type": "array", + "items": { + "type": "number" + }, + "oneOf": [ + { + "description": "2D bbox consisting of (xmin, ymin, xmax, ymax)", + "minItems": 4, + "maxItems": 4 + }, + { + "description": "3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)", + "minItems": 6, + "maxItems": 6 + } + ] + }, + "epoch": { + "type": "number" + } + } + } + }, + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/internal/validator/testdata/all-pass/input.json b/internal/validator/testdata/all-pass/input.json index 555dc20..bd46555 100644 --- a/internal/validator/testdata/all-pass/input.json +++ b/internal/validator/testdata/all-pass/input.json @@ -1,6 +1,6 @@ { "metadata": { - "version": "1.0.0-beta.1", + "version": "1.0.0", "primary_column": "geometry", "columns": { "geometry": { diff --git a/internal/validator/validator_test.go b/internal/validator/validator_test.go index 1d59839..8b33886 100644 --- a/internal/validator/validator_test.go +++ b/internal/validator/validator_test.go @@ -112,7 +112,7 @@ func (s *Suite) TearDownSuite() { jsonschema.Loaders["https"] = s.originalHttpsLoader } -func (s *Suite) XTestValidCases() { +func (s *Suite) TestValidCases() { cases := []string{ "example-v1.0.0-beta.1.parquet", }