Skip to content

Commit

Permalink
netCDF: add support for writing CF-1.8 simple geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
wchen329 authored and rouault committed Jul 2, 2019
1 parent 0ee2ee2 commit 3d3ef77
Show file tree
Hide file tree
Showing 30 changed files with 2,748 additions and 341 deletions.
77 changes: 77 additions & 0 deletions autotest/gdrivers/data/netcdf-sg/write-tests/Yahara_alb.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "path",
"features": [
{ "type": "Feature", "properties": { "NAMES": "path1" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.1, 0.2, 0.3 ], [99.0, -99.0, 0.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "path2" }, "geometry": { "type": "LineString", "coordinates": [ [ 100.0, 101.0, 102.0 ], [ 25.0, 27.0, 29.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "path3" }, "geometry": { "type": "LineString", "coordinates": [ [ 7.0, -11.0, -7.0 ], [ -11.0, 7, 11.0 ], [ -6.0, 1945.0, 1918.0] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "segv",
"features": [
{ "type": "Feature", "properties": { "NAMES": "seg1" }, "geometry": { "type": "LineString", "coordinates": [ [ 1.5, -1.5 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "seg2" }, "geometry": { "type": "LineString", "coordinates": [ [ 30.5, 30.5 ], [ 5.0, 5.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "seg3" }, "geometry": { "type": "LineString", "coordinates": [ [ 9.0, -9.0 ], [ 10.0, -10.0 ], [ -1.0, 1.0 ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "streams",
"features": [
{ "type": "Feature", "properties": { "NAMES": "fresh_river" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 1.0, -5.0, 10.0] ], [ [ 2.0, -4.0, 9.0 ], [ 3.0, -3.0, 8.0 ], [ 4.0, -2.0, 7.0 ], [ 5.0 , -1.0, 8.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "not_fresh_river" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 0.0, 1.0, 1.0], [ 1.0, 0.0, 2.0 ] ], [ [ 2.0, 0.0, 1.0 ], [ -2.0, 0.0, 1.0 ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "streams",
"features": [
{ "type": "Feature", "properties": { "NAMES": "fresh_river" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 1.0, -5.0 ] ], [ [ 2.0, -4.0 ], [ 3.0, -3.0 ], [ 4.0, -2.0 ], [ 5.0 , -1.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "not_so_fresh_river" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2.0, 5.0 ], [ -3.0, 4.0 ], [ -4.0, 3.0 ], [ -5.0, 2.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "not_fresh_river" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 0.0, 1.0 ], [ 1.0, 0.0 ] ], [ [ 2.0, 0.0 ], [ -2.0, 0.0 ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "drilling_sites",
"features": [
{ "type": "Feature", "properties": { "NAMES": "site1" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 0.0, -1.0, -5.0 ], [ 2.0, -2.0, 2.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "site2" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 7.0, -2.0, 1.0 ], [ 4.0, 3.0, 2.0 ], [ 8.0, -8.0, 3.0 ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "peak_list",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Peaks1" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 1.0, -1.0 ], [ 2.0, -2.0 ], [ 4.0, -4.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Peaks2" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 5.0, -5.0 ], [ 6.0, -6.0 ], [ 8.0, -8.0 ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Peaks3" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 9.0, -9.0 ], [ 10.0, -10.0 ], [ -2.0, 2.0 ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "mpoly_shape",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Triangle" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, 1.0 ], [ 1.0, 1.0, 2.0 ], [ 0.0, 0.0, 3.0 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "DoubleTriangle" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 3.0, 0.0, 0.0 ], [ 4.0, 0.0, 1.0 ], [ 4.0, 1.0, 2.0 ], [ 3.0, 0.0, 3.0 ] ] ], [ [ [ 3.0, 0.0, -1.0 ], [ 4.0, 1.0, -2.0 ], [ 3.0, 1.0, -3.0 ], [ 3.0, 0.0, -4.0 ] ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "shapes",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Trianglies" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, 1.0 ], [ 1.0, 1.0, 1.0 ], [ 0.0, 0.0, 0.0 ] ] ], [ [ [ 0.0, 0.0, 0.0 ], [ -1.0, 0.0, -1.0 ], [ -1.0, -1.0, -1.0 ], [ 0.0, 0.0, 0.0 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Prismy_and_Triangly" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 3.0, 0.0, 0.0], [ 4.0, 0.0, 0.0 ], [ 4.0, 1.0, 1.0 ], [ 3.0, 1.0, 1.0 ], [ 3.0, 0.0, 0.0 ] ], [ [3.5, 0.25, 0.0], [3.75, 0.25, 0.0], [3.75, 0.5, 0.1], [3.5, 0.5, 0.1], [3.5, 0.25, 0.0] ] ], [ [ [ 4.0, 4.0, 100.0 ], [ 4.0, 5.0, 101.0 ], [ 5.0, 4.0, 101.0 ], [ 4.0, 4.0, 100.0 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Single_Triangly" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -2.0, 0.0, -5.0 ], [ -2.0, 1.0, -6.0 ], [ -1.0, 1.0, -6.0 ], [ -2.0, 0.0, -5.0 ] ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "mpoly_shape",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Triangle" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 1.0, 1.0 ], [ 0.0, 0.0 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "DoubleTriangle" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 3.0, 0.0 ], [ 4.0, 0.0 ], [ 4.0, 1.0 ], [ 3.0, 0.0 ] ] ], [ [ [ 3.0, 0.0 ], [ 4.0, 1.0 ], [ 3.0, 1.0 ], [ 3.0, 0.0 ] ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "shapes",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Triangles" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 1.0, 1.0 ], [ 0.0, 0.0 ] ] ], [ [ [ 0.0, 0.0 ], [ -1.0, 0.0 ], [ -1.0, -1.0 ], [ 0.0, 0.0 ] ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Square_in_Square_and_Triangle" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 3.0, 0.0 ], [ 4.0, 0.0 ], [ 4.0, 1.0 ], [ 3.0, 1.0 ], [ 3.0, 0.0 ] ], [ [3.5, 0.25], [3.75, 0.25], [3.75, 0.5], [3.5, 0.5], [3.5, 0.25] ] ], [ [ [ 4.0, 4.0 ], [ 4.0, 5.0 ], [ 5.0, 4.0 ], [ 4.0, 4.0 ] ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "FeatureCollection",
"name": "point_collection",
"features": [
{ "type": "Feature", "properties": { "NAMES": "FishingSpot1" }, "geometry": { "type": "Point", "coordinates": [ 0.5, -0.5, -1.5 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot2" }, "geometry": { "type": "Point", "coordinates": [ 1.0, -1.0, -0.5 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot3" }, "geometry": { "type": "Point", "coordinates": [ 1.5, -1.5, 0.5 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot4" }, "geometry": { "type": "Point", "coordinates": [ 2.0, -2.0, 1.5 ] } }
]
}
10 changes: 10 additions & 0 deletions autotest/gdrivers/data/netcdf-sg/write-tests/point_write_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "FeatureCollection",
"name": "point_collection",
"features": [
{ "type": "Feature", "properties": { "NAMES": "FishingSpot1" }, "geometry": { "type": "Point", "coordinates": [ 0.5, -0.5 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot2" }, "geometry": { "type": "Point", "coordinates": [ 1.0, -1.0 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot3" }, "geometry": { "type": "Point", "coordinates": [ 1.5, -1.5 ] } },
{ "type": "Feature", "properties": { "NAMES": "FishingSpot4" }, "geometry": { "type": "Point", "coordinates": [ 2.0, -2.0 ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "noir_write",
"features": [
{ "type": "Feature", "properties": { "ID": 0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, 2.0 ], [ 1.0, 1.0, 0.0 ], [ 0.0, 0.0, 2.0 ] ] ] } },
{ "type": "Feature", "properties": { "ID": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 0.0, -1.0 ], [ 4.0, 0.0, -2.0 ], [ 4.0, 1.0, 0.0 ], [ 3.0, 1.0, -2.0 ], [ 3.0, 0.0, -1.0 ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "shapes",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Trianglything" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, -1.0 ], [ 1.0, 1.0, -2.0 ], [ 0.0, 0.0, -3.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Prismthing" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 0.0, 0.0 ], [ 4.0, 0.0, 0.0 ], [ 4.0, 1.0, 1.0 ], [ 3.0, 1.0, 1.0 ], [ 3.0, 0.0, 0.0] ], [ [3.5, 0.25, 1.0], [3.75, 0.25, 1.0], [3.75, 0.5, 1.0], [3.5, 0.5, 1.0], [3.5, 0.25, 1.0] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Trianglyflipped" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0, 0.0 ], [ -1.0, 0.0, 1.0 ], [ -1.0, -1.0, 2.0 ], [ 0.0, 0.0, 3.0 ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"name": "noir_write",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Triangle" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 1.0, 1.0 ], [ 0.0, 0.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Square" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 0.0 ], [ 4.0, 0.0 ], [ 4.0, 1.0 ], [ 3.0, 1.0 ], [ 3.0, 0.0 ] ] ] } }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "FeatureCollection",
"name": "shapes",
"features": [
{ "type": "Feature", "properties": { "NAMES": "Triangle" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 1.0, 1.0 ], [ 0.0, 0.0 ] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Square_in_Square" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 0.0 ], [ 4.0, 0.0 ], [ 4.0, 1.0 ], [ 3.0, 1.0 ], [ 3.0, 0.0 ] ], [ [3.5, 0.25], [3.75, 0.25], [3.75, 0.5], [3.5, 0.5], [3.5, 0.25] ] ] } },
{ "type": "Feature", "properties": { "NAMES": "Triangle_Flipped" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.0, 0.0 ], [ -1.0, 0.0 ], [ -1.0, -1.0 ], [ 0.0, 0.0 ] ] ] } }
]
}
Loading

0 comments on commit 3d3ef77

Please sign in to comment.