| csv_to_json.py | ||
| json_to_csv.py | ||
| plots.csv | ||
| points.csv | ||
| README.md | ||
| sample.json | ||
| ylap.png | ||
| yourland_data.json | ||
YourLand Import/Export Helper - README.md
Version: 1.0
Datum: 2025-09-20
🇩🇪 Deutsch
Beschreibung
YourLand Import/Export Helper besteht aus zwei Python-Skripten, die den Workflow zwischen LibreOffice Calc, Microsoft Excel oder anderen Tabellenkalkulationsprogrammen und dem YourLand Area Planner ermöglichen.
Alles zum YourLand Area Planner finden Sie hier: https://gitea.your-land.de/Boot/yl_area_planner
Das erste Skript (csv_to_json.py) konvertiert Koordinaten von Plots und Punkten aus CSV-Dateien, exportiert aus Calc, in eine JSON-Datei, die in den YourLand Area Planner importiert werden kann. Das zweite Skript (json_to_csv.py) konvertiert exportierte JSON-Daten aus dem YourLand Area Planner zurück in CSV-Dateien. Dies ist besonders nützlich für die Verwaltung großer Datenmengen in Spielen wie Luanti (früher Mintest) oder Minecraft.
Die Skripte wurden mit Unterstützung von Grok, dem KI-Assistenten von xAI, entwickelt. Grok hat die Skripte erstellt, den Prozess beschrieben und auf Fehler überprüft, um eine effiziente und benutzerfreundliche Lösung zu bieten.
Funktionen
- CSV zu JSON Konvertierung (
csv_to_json.py): Liest CSV-Dateien für Plots und Punkte und erzeugt eine JSON-Datei im Format des YourLand Area Planners. - JSON zu CSV Konvertierung (
json_to_csv.py): Konvertiert JSON-Dateien aus dem YourLand Area Planner in zwei CSV-Dateien (für Plots und Punkte), die in Calc importiert werden können. - Fehlerbehandlung: Ignoriert fehlende Dateien, verwendet Standardfarben, behandelt ungültige JSON-Dateien.
- Kompatibilität: Unterstützt den gesamten Workflow: Calc → CSV → JSON → YourLand Area Planner → JSON → CSV → Calc.
- Einfache Erweiterbarkeit: Skripte können für zusätzliche Felder oder Anpassungen modifiziert werden.
Installation
- Voraussetzungen: Installieren Sie Python 3.x (z. B. 3.12). Keine zusätzlichen Bibliotheken erforderlich (nutzt Standardmodule
csvundjson). - Skripte herunterladen: Kopieren Sie den Code für
csv_to_json.pyundjson_to_csv.pyaus dieser README in separate Dateien. - LibreOffice Calc: Installieren Sie Calc (kostenlos via libreoffice.org), falls nicht vorhanden.
- YourLand Area Planner: Stellen Sie sicher, dass Sie die
index.html-Datei des YourLand Area Planners haben.
Verwendung
1. Daten in Calc vorbereiten
- Erstellen Sie zwei Tabellenblätter:
- Plots: Spalten:
Name,X1,Z1,X2,Z2,Farbe(optional). - Punkte: Spalten:
Name,X,Z,Farbe(optional).
- Plots: Spalten:
- Beispiel für Plots:
Name X1 Z1 X2 Z2 Farbe Plot1 0 0 10 10 #0064c8 Plot2 20 20 30 30 #00ff00 - Beispiel für Punkte:
Name X Z Farbe Punkt1 5 5 #ff0000 Punkt2 15 15 #ff0000
2. CSV exportieren
- Wählen Sie den Datenbereich (inkl. Überschriften).
- Gehen Sie zu Datei > Speichern unter, wählen Sie „Text CSV (.csv)“.
- Trennzeichen: Komma (
,); Felder in Anführungszeichen. - Speichern als
plots.csvundpoints.csv.
3. CSV zu JSON konvertieren
- Öffnen Sie ein Terminal im Ordner mit
csv_to_json.py,plots.csvundpoints.csv. - Führen Sie aus:
python csv_to_json.py. - Ergebnis:
yourland_data.json.
4. In YourLand Area Planner importieren
- Öffnen Sie
index.htmlim Browser. - Klicken Sie auf das Dateiauswahlfeld und wählen Sie
yourland_data.json. - Die Daten werden automatisch geladen, Tabelle und Canvas aktualisiert.
5. JSON zurück zu CSV konvertieren
- Nach Bearbeitung/Export im YourLand Area Planner (Button „Exportieren“ erzeugt z. B.
yourland_data.json). - Öffnen Sie ein Terminal im Ordner mit
json_to_csv.pyund der JSON-Datei. - Führen Sie aus:
python json_to_csv.py. - Ergebnis:
plots_export.csvundpoints_export.csv.
6. CSV in Calc importieren
- Öffnen Sie Calc.
- Gehen Sie zu Datei > Öffnen, wählen Sie
plots_export.csvoderpoints_export.csv. - Stellen Sie sicher, dass das Trennzeichen auf Komma (
,) gesetzt ist. - Bearbeiten Sie die Daten in Calc und wiederholen Sie den Zyklus bei Bedarf.
Community-Beitrag
Wir bitten ausdrücklich um Hinweise und Verbesserungen aus der Community! Wenn Sie Vorschläge haben oder die Skripte erweitern möchten, teilen Sie diese bitte mit. Senden Sie uns auch Screenshots Ihrer vollständigen Karten nach dem Import, um die Power der Tools zu veranschaulichen – wir können diese in zukünftige Versionen einbauen.
Lizenz
MIT License
Copyright (c) 2025 Boot
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
🇬🇧 English
Description
YourLand Import/Export Helper consists of two Python scripts that enable a workflow between Calc and the YourLand Area Planner. The first script (csv_to_json.py) converts coordinates of plots and points from CSV files (exported from Calc) into a JSON file that can be imported into the YourLand Area Planner. The second script (json_to_csv.py) converts JSON data exported from the YourLand Area Planner back into CSV files for further editing in Calc. This is particularly useful for managing large datasets in games like Luanti (former Minetest) or Minecraft.
The scripts were developed with the support of Grok, the AI assistant from xAI. Grok created the scripts, described the process, and checked for errors to provide an efficient and user-friendly solution.
Features
- CSV to JSON Conversion (
csv_to_json.py): Reads CSV files for plots and points and generates a JSON file in the format of the YourLand Area Planner. - JSON to CSV Conversion (
json_to_csv.py): Converts JSON files from the YourLand Area Planner into two CSV files (for plots and points) that can be imported into Calc. - Error Handling: Ignores missing files, uses default colors, handles invalid JSON files.
- Compatibility: Supports the full workflow: Calc → CSV → JSON → YourLand Area Planner → JSON → CSV → Calc.
- Simple Extensibility: Scripts can be modified for additional fields or customizations.
Installation
- Prerequisites: Install Python 3.x (e.g., 3.12). No additional libraries required (uses standard modules
csvandjson). - Download Scripts: Copy the code for
csv_to_json.pyandjson_to_csv.pyfrom this README into separate files. - LibreOffice Calc: Install Calc (free via libreoffice.org) if not available.
- YourLand Area Planner: Ensure you have the
index.htmlfile of the YourLand Area Planner.
Usage
1. Prepare Data in Calc
- Create two spreadsheets:
- Plots: Columns:
Name,X1,Z1,X2,Z2,Color(optional). - Points: Columns:
Name,X,Z,Color(optional).
- Plots: Columns:
- Example for Plots:
Name X1 Z1 X2 Z2 Color Plot1 0 0 10 10 #0064c8 Plot2 20 20 30 30 #00ff00 - Example for Points:
Name X Z Color Point1 5 5 #ff0000 Point2 15 15 #ff0000
2. Export as CSV
- Select the data range (incl. headers).
- Go to File > Save As, select "Text CSV (.csv)".
- Delimiter: Comma (
,); Fields in quotes. - Save as
plots.csvandpoints.csv.
3. Convert CSV to JSON
- Open a terminal in the folder with
csv_to_json.py,plots.csv, andpoints.csv. - Execute:
python csv_to_json.py. - Result:
yourland_data.json.
4. Import into YourLand Area Planner
- Open
index.htmlin the browser. - Click the file selection field and choose
yourland_data.json. - The data is automatically loaded, updating the table and canvas.
5. Convert JSON back to CSV
- After editing/exporting in YourLand Area Planner (the "Export" button generates, e.g.,
yourland_data.json). - Open a terminal in the folder with
json_to_csv.pyand the JSON file. - Execute:
python json_to_csv.py. - Result:
plots_export.csvandpoints_export.csv.
6. Import CSV into Calc
- Open Calc.
- Go to File > Open, select
plots_export.csvorpoints_export.csv. - Ensure the delimiter is set to comma (
,). - Edit the data in Calc and repeat the cycle as needed.
Community Contribution
We explicitly ask for hints and improvements from the community! If you have suggestions or want to extend the scripts, please share them. Also send us screenshots of your complete maps after import to illustrate the power of the tools – we can incorporate them into future versions.
License
MIT License
Copyright (c) 2025 Boot
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.