Code to transform your GeoJSON files into XML format.
-
Download and install Miniconda 🐍
If you don’t already have Miniconda, grab it here and follow the installation instructions. It’s painless, we promise. -
Create and activate your environment 🧪
Open your terminal or command prompt and type the following magical incantations:conda create -n GeoJSON2XML python=3.9.19 conda activate GeoJSON2XML
-
Install GeoJSON2XML 📦
Install the package directly from the source of truth (a.k.a. GitHub):pip install -e git+https://github.com/Valentinamatos/GeoJSON2XML.git#egg=GeoJSON2XML
⚠️ Warning:
You might need to install Git from the following 🔗 link to be able to run thepip install
git link command.⚠️ Warning:
After installing the package, restart your IDE and activate the environment again usingconda activate GeoJSON2XML
to ensure all the dependencies are properly loaded.
-
Prepare Your GeoJSON Files:
Place all the GeoJSON files you want to convert into a single folder. This ensures consistent label ordering across all files. -
Run the Jupyter Notebook:
Open theGeoJSON2XML.ipynb
notebook in your Jupyter environment. Run the following cells:- Import the required module:
from base import *
- Set the path to your folder containing GeoJSON files:
folder_path = r'path to GeoJSON files'
- Set the microns_per_pixel value
microns_per_pixel = "0.460100" #example
- Run the conversion:
GeoJSON2XML(folder_path, microns_per_pixel)
This will process all GeoJSON files in the specified folder and generate corresponding XML files.
- Import the required module:
-
Check the Output:
The XML files will be saved in the same folder as the input GeoJSON files, with the.xml
extension.
- Consistent Layer Order:
To ensure that the generated XML files maintain the same order of layers, all GeoJSON files that are to be converted must be placed in the same folder. This guarantees consistent label ordering across all files.
Happy converting! 🎉