Skip to content

Commit 3e48d2a

Browse files
authored
fix bug, should be recursive (#19)
* diff output * fix recursive * fix
1 parent 9ea5e71 commit 3e48d2a

File tree

7 files changed

+16
-39
lines changed

7 files changed

+16
-39
lines changed

benchmarks/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ benchmark_all:
5454
normalize:
5555
python3 -m pybind11_geobuf normalize_json $(JSON_PATH) --output_path linted_input.json
5656
python3 -m pybind11_geobuf normalize_json $(JSON_PATH)__js.pbf.json --output_path linted_js.json
57-
# python3 -m pybind11_geobuf normalize_json $(JSON_PATH)__py.pbf.json --output_path linted_py.json
58-
python3 -m pybind11_geobuf normalize_json $(JSON_PATH)__cpp.pbf.json --output_path linted_cpp.json && python3 fix.py linted_cpp.json
57+
python3 -m pybind11_geobuf normalize_json $(JSON_PATH)__py.pbf.json --output_path linted_py.json
58+
python3 -m pybind11_geobuf normalize_json $(JSON_PATH)__cpp.pbf.json --output_path linted_cpp.json
59+
60+
diff:
61+
diff linted_input.json linted_js.json
62+
diff linted_input.json linted_py.json
63+
diff linted_input.json linted_cpp.json
5964

6065
check:
6166
vim -p linted_input.json linted_js.json linted_py.json linted_cpp.json

benchmarks/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
make benchmark_all --no-print-directory
2+
make normalize
3+
make diff

benchmarks/diffjson.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

benchmarks/fix.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/about/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ To upgrade `pybind11-geobuf` to the latest version, use pip:
1010
pip install -U pybind11-geobuf
1111
```
1212

13+
## Version 0.1.2 (2023-04-10)
14+
15+
* Fix round geojson-non-geometry, should be recursive
16+
1317
## Version 0.1.1 (2023-04-09)
1418

1519
* benchmark (speed: cpp > js > python)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def build_extension(self, ext):
127127
# logic and declaration, and simpler if you include description/version in a file.
128128
setup(
129129
name="pybind11_geobuf",
130-
version="0.1.1",
130+
version="0.1.2",
131131
author="tzx",
132132
author_email="dvorak4tzx@gmail.com",
133133
url="https://geobuf-cpp.readthedocs.io",

src/geobuf/rapidjson_helpers.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ inline void round_geojson_non_geometry(RapidjsonValue &json, double scale)
112112
} else if (type == "FeatureCollection") {
113113
round_rapidjson(json, scale, INT_MAX, {"features"});
114114
for (auto &f : json["features"].GetArray()) {
115-
round_rapidjson(f, scale);
115+
round_rapidjson(f, scale, INT_MAX);
116116
}
117117
} else if (type == "Point" || type == "MultiPoint" ||
118118
type == "LineString" || type == "MultiLineString" ||
@@ -121,7 +121,7 @@ inline void round_geojson_non_geometry(RapidjsonValue &json, double scale)
121121
} else if (type == "GeometryCollection") {
122122
round_rapidjson(json, scale, INT_MAX, {"geometries"});
123123
for (auto &g : json["geometries"].GetArray()) {
124-
round_rapidjson(g, scale);
124+
round_rapidjson(g, scale, INT_MAX);
125125
}
126126
}
127127
}

0 commit comments

Comments
 (0)