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

Convert layers to YAML #947

Merged
merged 10 commits into from
Sep 16, 2014
Merged

Convert layers to YAML #947

merged 10 commits into from
Sep 16, 2014

Commits on Sep 9, 2014

  1. Add a script that takes a yaml file and converts it to a JSON file

    Requires PyYAML. If this dependency is an issue on a particular
    platform, pretty much any language allows you to do this.
    
    A ruby example is
    
        ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' < project.yml > project.json
    pnorman committed Sep 9, 2014
    Configuration menu
    Copy the full SHA
    1be5578 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2014

  1. Convert the MML file from JSON to YAML

    This one-time conversion was done with the json2yaml node module,
    and then substantially reformatted by hand, using mappings and alias
    to avoid repeating projection and extents information for each layer,
    and to get consistent ordering of the properties of each layer. The
    latter does not matter semantically, but makes editing with a text
    editor cleaner.
    
    By using the scripts/yaml2mml.py script, the YAML can be converted
    back into JSON, which is still what TileMill uses.
    
    A JSON-aware diff of the original project.mml and the new generated
    one shows that the only differences are the new "_parts" property,
    used for aliases and ignored by TileMill, and layer extents.
    
    The script can be invoked with
    
        scripts/yaml2mml.py < project.yaml > project.mml
    
    The project.mml file remains checked in to git, as TileMill requires
    it and this allows someone to clone the repo, and immediately have
    it work. Merge conflicts in project.mml are trivial to solve, as
    the entire file is just regenerated by running the script again.
    
    This does mean that the .MML file should not be edited directly,
    but this is fine, as editing the JSON by hand is extremely difficult
    anyways! The HOT OSM style has a similar workflow, making use of cartocc.
    pnorman committed Sep 10, 2014
    Configuration menu
    Copy the full SHA
    9918536 View commit details
    Browse the repository at this point in the history
  2. Use alias to avoid duplicating SQL connection information

    By using aliases, we can avoid having to specify the same information
    repeatedly, saving lines, avoiding mistakes, and making it easier to
    use a differently named database.
    
    The last is evident in that the landcover extents changed slightly
    in this, because they were different than all the other layers.
    pnorman committed Sep 10, 2014
    Configuration menu
    Copy the full SHA
    45dbf13 View commit details
    Browse the repository at this point in the history
  3. Conver SQL from in-line escaped scalars to block scalars

    Block scalars allow you to use newlines, and are far more readable
    
    This commit also catches some extents that were missed previously.
    pnorman committed Sep 10, 2014
    Configuration menu
    Copy the full SHA
    ba95ac9 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2014

  1. Clean up SQL in the YAML file

    A lot of the SQL was badly formatted, with random tabs, caps, and
    lines of 5000 characters. This commit cleans up about half of them
    but is not complete.
    pnorman committed Sep 13, 2014
    Configuration menu
    Copy the full SHA
    95a56f0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d31bd93 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2014

  1. Configuration menu
    Copy the full SHA
    72d5baa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    08d3fb8 View commit details
    Browse the repository at this point in the history
  3. Whitespace fixes

    pnorman committed Sep 14, 2014
    Configuration menu
    Copy the full SHA
    dcbdae6 View commit details
    Browse the repository at this point in the history
  4. More caps fixes

    pnorman committed Sep 14, 2014
    Configuration menu
    Copy the full SHA
    56cd8e0 View commit details
    Browse the repository at this point in the history