Skip to content

Latest commit

 

History

History
99 lines (64 loc) · 3.48 KB

CONTRIBUTING.md

File metadata and controls

99 lines (64 loc) · 3.48 KB

Contributing

Thank you for your courage!

This document outlines the general process for adding protectorates to the map.

Adding a protectorate to the map

The first step is to get the shape data for the protectorate.

1. Obtain a shapefile or geojson

There are two primary sources for shapefiles that I’ve found:

  1. Country data from DIVA-GIS
  2. Congressional districts from The United States Project
  3. Historical county data from Atlas of Historical County Boundaries

Those only cover specific administrative regions, however.

Convert a shapefile to geojson

A lot of data is provided as shapefiles instead of geojson. There’s a tool called gdal that can be used to convert shapefiles to geojson. It can be installed on Mac OS using Homebrew:

$ brew install gdal

The shape files can then be converted with the following command, replacing the file names as appropriate:

ogr2ogr -f GeoJSON -t_srs crs:84 output.geojson input.shp

To pull boundaries of historical counties, use the -where option with the date in YYYYMMDD format:

ogr2ogr -f GeoJSON -t_srs crs:84 -where '"START_N" <= 18450101 AND "END_N" >= 18450101' texas1845.geojson TX_Historical_Counties.shp

2. Remove unnecessary features and simplify

There’s an excellent tool called mapshaper that can be used for this step.

To filter out various features, the filter command can be used:

filter 'NAME_1 == "New York" && NAME_2 == "New York"'

It takes any JavaScript expression to evaluate each geojson feature.

If the protectorate is made up of multiple features that are defined in the geojson (such as multiple counties or states), use the dissolve command once all of the features are filtered to combine them into one shape for the map.

3. Simplify

Mapshaper an also simplify the geojson, which results in drastically smaller files. Every shape can be put down to at least 50% simplification, but for larger areas or shapes that are less complicated, it can go as low as 5%. It’s more of an art than a science.

4. Create the protectorate file

A separate file is created for each Knight. Each one should be a FeatureCollection that generally consists of one Feature (a handful of Knights have multiple, but most should not).

{
	"type": "FeatureCollection",
	"features": [{
		"type": "Feature",
		"properties": {
			"name": "[Protectorate]",
			"description": "Protectorate of [Knight], [Title] of [Protectorate]",
			"title": "[Title]",
			"proof": "[noagendashow.net link to segment]"
		},
		"geometry": {

		}
	}]
}
Loading

Pull out the Geometry object from the simplified file and insert it into the protectorate file. Then, run the normalize script:

$ npm run normalize

5. Generate the full peerage map

The full peerage map is generated by combining all the Features from the individual files, rounding the coordinate values to save space, and sorting them from largest to smallest. The sort is so you are able to click on each protectorate on the final map.

Before running the build script, copy the .env.example file to .env and follow the instructions there to get a GitHub token with gist permission.

Use the build command to generate it:

$ npm run build

Make sure to run the command and commit the peerage.geojson file when adding a new protectorate or it won’t show on the map.