Skip to content

Commit

Permalink
Merge pull request #71 from planetlabs/one-point-oh
Browse files Browse the repository at this point in the history
Update version
  • Loading branch information
tschaub authored Sep 13, 2023
2 parents 422650c + d85c2e3 commit 5349b0d
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/geoparquet/geoparquet.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

const (
Version = "1.0.0-beta.1"
Version = "1.0.0"
MetadataKey = "geo"
EncodingWKB = "WKB"
EncodingWKT = "WKT"
Expand Down
26 changes: 26 additions & 0 deletions internal/geoparquet/geoparquet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file added internal/testdata/cases/example-v1.0.0.parquet
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
}
}
}
2 changes: 1 addition & 1 deletion internal/validator/testdata/all-pass/input.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"metadata": {
"version": "1.0.0-beta.1",
"version": "1.0.0",
"primary_column": "geometry",
"columns": {
"geometry": {
Expand Down
2 changes: 1 addition & 1 deletion internal/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down

0 comments on commit 5349b0d

Please sign in to comment.