This is a working repository for prepping and aligning polygons in geojson spatial index files.
- Drag and drop the completed geojson file into geojson.io.
- For each outlined polygon, check that there is a corresponding vertex point relative to those of the bordering polygons. Below is an example: the orange polygon is missing a vertex at the point where it meets with the two bordering blue polygons.
- For each of these missing verticies, use the edit tool to add a new vertex. Click the edit tool, click on the polygon you'd like to edit, click the small orange dot at the midpoint of the polygon's edge, and then drag it to align with the bordering polygons' verticies.
- When you are finished prepping the geojson file, save it following the convention
prepped_[atlas]_[city]_vol[volume number]_[year of the atlas].geojson - Upload the file to the spatial-indexes repository.
- If you have not done so already, you will need to install python and Visual Studio Code. You can download the python installer from this page and the Visual Studio Code installer from this page.
- Crete a new folder on your computer named spatial-index-alignment.
- Download alignment-script.py and move it to your new folder.
- Open your spatial-index-alignment folder in Visual Studio Code. 1
- Open the Terminal below the script (View > Terminal) and set up a virtual environment: 2
python -m venv .index-alignment-venv - Open a new Terminal (Terminal > New Terminal) and use
pip installto install the following packages: 3
pip install geopandaspip install scipy
- Download the spatial index .geojson file you want to align and move it to your spatial-index-alignment folder.
- Open alignment-script.py in VS Code and replace input_file_name_here.geojson with the name of your spatial index file.
- Replace output_file_name_here.geojson to name the file that will be created. Follow the convention
aligned_[atlas]_[city]_vol[volume number]_[year of the atlas].geojson - Run the script and upload the resulting file to the spatial-indexes repository.
Footnotes
-
If you haven't already, you may want to install the VS Code python extension. Upon opening the script for the first time, a popup may appear asking if you would like to install the extension. Alternatively, you can install it from the Extensions Sidebar Tab (Shift+Command+X). This is not required to run the script. ↩
-
If you get "command not found" errors using the
pythonandpipcommands, try usingpython3andpip3instead. This will depend on your operating system, python installation version, etc. More info can be found here. ↩ -
This script requires four total packages to run properly: geopandas, shapely, numpy, and scipy. You won't need to individually install shapely and numpy as they are dependencies of geopandas and are included in your geopandas installation. ↩