Skip to content

Commit

Permalink
Merge pull request #725 from mapbox/geobuf-multilinestring
Browse files Browse the repository at this point in the history
Fix reading of MultiLineStrings in Geobuf input
  • Loading branch information
e-n-f committed Mar 2, 2019
2 parents 907ddeb + 1bc475b commit 945d804
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 1.33.0

* MultiLineStrings were previously ignored in Geobuf input

## 1.32.12

* Accept .mvt as well as .pbf in directories of tiles
Expand Down
2 changes: 2 additions & 0 deletions geobuf.cpp
Expand Up @@ -254,6 +254,8 @@ std::vector<drawvec_type> readGeometry(protozero::pbf_reader &pbf, size_t dim, d
dv.dv = readLine(coords, dim, e, false);
} else if (type == POLYGON) {
dv.dv = readMultiLine(coords, lengths, dim, e, true);
} else if (type == MULTILINESTRING) {
dv.dv = readMultiLine(coords, lengths, dim, e, false);
} else if (type == MULTIPOLYGON) {
dv.dv = readMultiPolygon(coords, lengths, dim, e);
} else {
Expand Down
35 changes: 35 additions & 0 deletions tests/multilinestring/in.json
@@ -0,0 +1,35 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiLineString",
"coordinates": [ [
[
33.046,
70.728
],
[
-1.0546,
18.9790
],
[
1.7578,
-16.2990
]
], [
[
-17.2265,
60.5869
],
[
-34.1015,
17.644
]
] ]
}
}
]
}
42 changes: 42 additions & 0 deletions tests/multilinestring/out/-z1.json
@@ -0,0 +1,42 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-34.101500,-16.299000,33.046000,70.728000",
"center": "-34.101500,42.525564,1",
"description": "tests/multilinestring/out/-z1.json.check.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 1, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
"maxzoom": "1",
"minzoom": "0",
"name": "tests/multilinestring/out/-z1.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 32.958984, 70.728979 ], [ -1.054688, 18.979026 ], [ 1.669922, -16.214675 ] ], [ [ -17.226562, 60.586967 ], [ -34.101562, 17.644022 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.131836, 3.513421 ], [ 1.713867, -16.256867 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 3.515625, 29.075375 ], [ 0.000000, 21.371244 ], [ -1.054688, 18.979026 ], [ 0.000000, 5.703448 ], [ 0.703125, -3.513421 ] ], [ [ -17.226562, 60.586967 ], [ -34.101562, 17.644022 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.131836, 3.513421 ], [ 0.439453, 0.000000 ], [ 1.713867, -16.256867 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 33.002930, 70.728979 ], [ 0.000000, 21.371244 ], [ -1.054688, 18.979026 ], [ 0.000000, 5.703448 ], [ 0.439453, 0.000000 ], [ 0.703125, -3.513421 ] ] } }
] }
] }
] }
2 changes: 1 addition & 1 deletion version.hpp
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define VERSION "v1.32.12"
#define VERSION "v1.33.0"

#endif

0 comments on commit 945d804

Please sign in to comment.