Skip to content

danlite/World-Country-Maps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Requirements

  • Ruby
  • nokogiri gem
  • osx-plist gem
  • ImageMagick with SVG delegate library

Usage

Running generate.rb will generate all image files in three steps:

  1. Create individual SVG files of each country map
  2. Create PNG versions (optionally with a 2x resolution version) of each country map
  3. Trims each PNG to the size of the country and outputs the pixel offset and dimensions to a property list file

The script takes a little while to complete, so you may wish to modify the process using these command-line flags:

  • --no-generate-svg skips step 1
  • --no-generate-png skips step 2
  • --no-trim skips step 3
  • --generate-2x generates an extra set of PNG files with an "@2x" suffix

Sample Output

The script will generate the following files for a given country, in this case, Canada (ca).

  • countries/svg/ca.svg
  • countries/png/ca.png

With the --generate-2x flag, this file is also generated:

  • countries/png/ca@2x.png

The script also outputs a summary of the processed data:

  • countries/countries.txt - a list of all country codes which had map images produced

  • countries/countries_geometry.plist - a dictionary of country geometry info using the country code as keys

    The geometry info is represented as a dictionary, the keys being the resolution (1 or 2) of the map, and the values being a string representation of a CGRect.

      <key>ca</key>
      <dict>
      	<key>1</key>
      	<string>{{+102,+35},{211,100}}</string>
      	<key>2</key>
      	<string>{{+204,+70},{421,200}}</string>
      </dict>
    

About

Generates maps of all countries in the world with their pixel coordinates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages