Catch the edge case where a space is returned both as an Erfa and a Chaostreff by SMW
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
s3lph 2022-10-09 23:01:04 +02:00
parent 1e74b33477
commit aa842979e9
Signed by: s3lph
GPG key ID: 8AC98A811E5BEFF5

View file

@ -560,15 +560,6 @@ def create_svg(ns, bbox):
ts.append((xt*scalex - origin[0], origin[1] - yt*scaley))
shapes_countries.append((name, ts))
chaostreffs = {}
with open(ns.cache_directory.chaostreff_info, 'r') as f:
ctdata = json.load(f)
for city, location in ctdata.items():
if location is None:
continue
xt, yt = transformer.transform(*location)
chaostreffs[city] = (xt*scalex - origin[0], origin[1] - yt*scaley)
erfas = {}
with open(ns.cache_directory.erfa_info, 'r') as f:
ctdata = json.load(f)
@ -578,6 +569,21 @@ def create_svg(ns, bbox):
xt, yt = transformer.transform(*location)
erfas[city] = (xt*scalex - origin[0], origin[1] - yt*scaley)
chaostreffs = {}
with open(ns.cache_directory.chaostreff_info, 'r') as f:
ctdata = json.load(f)
for city, location in ctdata.items():
if location is None:
continue
if city in erfas:
# There is an edge case where when a space changed states between Erfa and Chaostreff, the
# Semantic MediaWiki engine returns this space as both an Erfa and a Chaostreff, resulting
# in glitches in the rendering. As a workaround, here we simply assume that it's an Erfa.
continue
xt, yt = transformer.transform(*location)
chaostreffs[city] = (xt*scalex - origin[0], origin[1] - yt*scaley)
rectbox = [0, 0, svg_box[0], svg_box[1]]
for name, shape in shapes_states + shapes_countries:
for lon, lat in shape: