First thank you for willing to contribute to this project!
- Fork this repository
- Create a new package for your map
- Commit your changes
- Push to your fork
- Submit a pull request
- Install the CLI tool:
npm run install
- Run the command to create a new map:
npm run add
- Answer the questions to configure your map
- Complete the generated files with the data of your map
- Create a new folder
/packages/[new-map]/
and a new file/packages/[new-map]/[new-map].svg
in kebab-case. For example:/packages/new-zealand/new-zealand.svg
- Use tab indentation
- Use only
<svg>
and<path>
tags (no doctype, external stylesheet, comment...). Other tags will be ignored - On the
<svg>
tag:- Set the
xmlns="http://www.w3.org/2000/svg"
namespace declaration - Adjust the
viewBox
attribute to remove any empty space on each side of the map (top, bottom, left, right) - Set an appropriate
aria-label
attributeMap of [New Map]
. For example:Map of New Zealand
- Do NOT use any other attribute than
xmlns
,viewBox
andaria-label
- Set the
- On the
<path>
tags:- Set semantic
id
attributes (short or full names) in kebab-case. For example:ny
for New York ortaipei-city
for Taipei City - Set English
name
attributes - Do NOT use any other attribute than
id
,name
andd
- Set semantic
Here is a simplified example of new-zealand.svg
:
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 703 989"
aria-label="Map of New Zealand"
>
<path
id="auk"
name="Auckland"
d="..."
/>
...
<path
id="wtc"
name="West Coast"
d="..."
/>
</svg>
- Create a new
/packages/[new-map]/package.json
file to describe the npm package to publish:
{
"name": "@svg-maps/[new-map]",
"version": "1.0.0",
"description": "Map of [New Map]",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/VictorCazanave/svg-maps/tree/master/packages/[new-map]"
},
"keywords": [
"svg",
"map",
"[new-map]"
],
"author": "[Your Name] <[your email]>",
"publishConfig": {
"access": "public"
},
"license": "[License of the map]"
}
- Install the CLI tool:
npm run install
- Generate the JS file:
npm run generate [new-map.svg] index.js
- The
/packages/[new-map]/index.js
file should be generated. Otherwise it means the SVG file is not valid
-
Add a
/packages/[new-map]/LICENSE.md
file with the license of the map (Creative Commons Markdown) -
Create a new
/packages/[new-map]/README.md
file to:- indicate the license of the map with a badge
- list all the locations (states, counties...) alphabetically sorted and using the same names as in the SVG file
- indicate the credits (source, license of the original map...)
- describe your modifications
-
Add the new map in the main
README.md
file:- using alphabetical order
- linking to the package folder
/packages/[new-map]
- Create a map in your repository
- Publish the map to npm
- Fork this repository
- Add a link to your map in the documentation
- Push to your fork
- Submit a pull request
You're free to create the map as you want, but using the CLI tool is recommended.
Update the README
to add a link to the npm package of your map with an external tag: [YourMap (external)](https://www.npmjs.com/package/your-map)
)
- Find a simple map with compatible SVG code
- Pay attention to the license
- Give credits and information about the original map
If you see any incorrect or incomplete data, please open an issue.