Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compact ShieldJSON format #1015

Open
ZeLonewolf opened this issue Dec 22, 2023 · 0 comments
Open

Compact ShieldJSON format #1015

ZeLonewolf opened this issue Dec 22, 2023 · 0 comments
Labels
enhancement New feature or request shield-generator Issues specific to the shield library

Comments

@ZeLonewolf
Copy link
Owner

Proposed is to revamp the format of the ShieldJSON to remove the excessive duplication that currently exists. According to the metrics in #1007, the JSON shield definition file is over 1 megabyte in size. While this is mitigated by HTTP-level compression, it seems prudent to restructure the JSON to be less verbose.

The main reason this file is so large is that each network and bannered variant must be assigned a complete shield JSON definition. I propose that we invert this logic such that we define a shield definition and then list all of the networks that are assigned to that particular shield artwork.

The JSON could be restructured like this:

erm_shields drawio

In this format, you would have (for example) one definition for a blue MUTCD county shield pentagon which includes a long list of all the networks that it should be applied to.

Additionally, as also shown, it should be possible to specify the banners as an option of a base shield artwork rather than as a whole separate shield definition. Then you can specify pairs of network list / banner list combinations that can be applied as options.

One negative of doing is this way is it makes the shield JSON harder to organize, because you have to group together shields of the same style, even if they're not logically grouped. So a shield in Japan and a shield in Ohio could share a definition if they happened to have the same shape and color and so forth. Additionally, it would require a full rewrite of the current shield definitions. However, given that the format is more compact, this may make it possible to just keep the source in JSON directly rather than the current scripted builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shield-generator Issues specific to the shield library
Projects
None yet
Development

No branches or pull requests

2 participants