Skip to content

Commit

Permalink
Add missing fixture, and don't crash if it is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Nov 25, 2024
1 parent caa9120 commit c7649e3
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,13 @@ bool pnpoly_mp(drawvec const &geom, long long x, long long y) {
clipbbox parse_clip_poly(std::string arg) {
json_pull *jp = json_begin_string(arg.c_str());
json_object *j = json_read_tree(jp);
if (j == NULL) {
fprintf(stderr, "Expected JSON object, not %s\n", arg.c_str());
exit(EXIT_ARGS);
}
if (j->type != JSON_HASH) {
fprintf(stderr, "Expected JSON geometry object, not %s\n", arg.c_str());
exit(EXIT_ARGS);
}

std::pair<int, drawvec> parsed_geometry = parse_geometry(j, jp, j, 0, 0, 0, 1LL << 32, false);
Expand Down
135 changes: 135 additions & 0 deletions tests/pbf/region.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"coordinates": [
[
[
[
13.577060272719763,
53.17369971291083
],
[
10.704205888641951,
52.74867374387799
],
[
8.234559137417222,
50.4321686022941
],
[
4.20248280888643,
49.91569934015271
],
[
3.3960675431802656,
47.351710786357756
],
[
4.958497120486356,
45.82785468647634
],
[
7.680148642243836,
45.54618382040567
],
[
10.704205888641951,
47.82759699398349
],
[
13.728263135039242,
48.332677316517476
],
[
16.903523243756865,
47.24917200504791
],
[
19.272368086768267,
48.26561972235635
],
[
19.52437285730184,
50.97481113632679
],
[
16.701919427330296,
52.53459175523133
],
[
13.577060272719763,
53.17369971291083
]
],
[
[
14.78668317127898,
51.66775442536286
],
[
12.46823928237373,
51.6051918576735
],
[
11.208215429708275,
50.78400718973347
],
[
11.359418292027812,
49.980563422399655
],
[
12.417838328266726,
49.39363856874314
],
[
14.181871721999357,
49.32798696801095
],
[
16.046707023944435,
50.62440671313237
],
[
14.78668317127898,
51.66775442536286
]
]
],
[
[
[
21.055284848897287,
46.16048194834923
],
[
18.988845730525668,
45.81027671022295
],
[
18.53523714356635,
45.13878150945956
],
[
18.585638097672586,
43.989754759795915
],
[
19.896062904445103,
43.18663878167516
],
[
22.31530870156351,
44.134624205316555
],
[
22.31530870156351,
45.280813880909534
],
[
21.055284848897287,
46.16048194834923
]
]
]
],
"type": "MultiPolygon"
}

0 comments on commit c7649e3

Please sign in to comment.