Skip to content

IgorQuintao/FarmGML-ADE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FarmGML ADE 🚜

Application Domain Extension

License: CC BY 4.0 OGC Standard Version Validation


FarmGML is an Application Domain Extension (ADE) of CityGML 3.0, designed to represent rural enterprises, agricultural activities, and agro-environmental data consistent with digital twin semantics.

It allows the integration of agricultural and environmental information into structures compatible with 3D models, spatial databases, WebGIS platforms (CesiumJS), and agroclimatic analytics systems.

It extends CityGML classes (such as LandUse, Vegetation, and Building) to model:

  • Rural properties and agricultural enterprises
  • Crop areas, production cycles, and harvest lots
  • Risk and sustainability indicators
  • Integration with geospatial and remote-sensing data

FarmGML enables integration between 3D city models, agricultural information systems, QGIS, 3DCityDB, and CesiumJS for digital twins of rural areas.


Table of Contents


About the Project

The FarmGML ADE extends CityGML 3.0 to represent agricultural holdings (farms), crop areas, rural enterprises (livestock, aquaculture), agricultural operations, risk assessments (ZARC NM), and sustainability metrics.

This project follows the Model-Driven UML-to-XSD methodology and complies with the OGC CityGML 3.0 ADE design rules.

Modeled Features

FarmGML is divided into modules, including:

  • Core (farm-core.xsd): Defines the main RuralProperty feature (based on luse:LandUse) and basic data types (Person, Household, Farm Profile).
  • Enterprise (farm-enterprise.xsd): Models different enterprises such as LivestockEnterprise, AquacultureEnterprise, and ForestryEnterprise.
  • Production (farm-production.xsd): Defines AnnualCropArea, PerennialCropArea (based on veg:PlantCover), and HarvestedLot.
  • Operations (farm-operations.xsd): Models events over time (e.g., planting, harvesting) using AgriculturalOperation (based on dyn:AbstractDynamizer).
  • Risk & Sustainability (farm-risk.xsd, farm-sustainability.xsd): Adds generic attributes for Risk (ZARC) and sustainability metrics (carbon footprint, etc.) via the core:genericAttribute hook.
  • Temporal (farm-temporal.xsd): Enables TimeSlices for features (based on vers:AbstractVersion).

🧩 Version Information

Field Value
ADE Name FarmGML
Version 1.3
Target Standard OGC CityGML 3.0
Namespace URI https://igorquintao.github.io/FarmGML-ADE/schemas/1.3
Schema Location https://raw.githubusercontent.com/IgorQuintao/FarmGML-ADE/main/schemas/1.3/FarmGML.xsd
Prefix farm
Last Updated 2025-10-31
License Creative Commons Attribution 4.0 International (CC BY 4.0)

πŸ—‚οΈ Repository Structure

FarmGML-ADE/
β”‚
β”œβ”€β”€ xsd/                  # FarmGML and modules (100% online)
β”‚   β”œβ”€β”€ FarmGML_ADE_v1-3.xsd
β”‚   β”‚
β”‚   └── modules/
β”‚       β”œβ”€β”€ farm-core.xsd
β”‚       β”œβ”€β”€ farm-hooks.xsd
β”‚       β”œβ”€β”€ farm-enterprise.xsd
β”‚       β”œβ”€β”€ farm-production.xsd
β”‚       β”œβ”€β”€ farm-operations.xsd
β”‚       β”œβ”€β”€ farm-risk.xsd
β”‚       β”œβ”€β”€ farm-sustainability.xsd
β”‚       β”œβ”€β”€ farm-temporal.xsd
β”‚       └── farm-join.xsd
β”‚
β”œβ”€β”€ test_data/                  # Load the GML Test Data in QGIS
β”‚   β”œβ”€β”€ example_ruralproperty.gml
β”‚   β”œβ”€β”€ example_cropcycle.gml
β”‚   β”œβ”€β”€ example_enterprise.gml
β”‚   β”œβ”€β”€ examplo_macro_lod0_ruralproperty.gml
β”‚   β”œβ”€β”€ examplo_meso_lod1_ruralproperty.gml
β”‚   β”œβ”€β”€ v1_example_ruralproperty.gml
β”‚   └── v2_example_ruralproperty.gml
β”‚       
β”œβ”€β”€ model/                  # UML/XMI source (conceptual model)
β”‚   └── 1.3/
β”‚       β”œβ”€β”€ FarmGML_v1.3.xmi
β”‚       └── diagrams/
β”‚
β”œβ”€β”€ schemas/                # Generated schemas and examples (distribution 100% offline)
β”‚   └── 1.3/
β”‚       β”œβ”€β”€ FarmGML.xsd
β”‚       β”œβ”€β”€ farm-core.xsd
β”‚       β”œβ”€β”€ farm-hooks.xsd
β”‚       β”œβ”€β”€ farm-enterprise.xsd
β”‚       β”œβ”€β”€ farm-production.xsd
β”‚       β”œβ”€β”€ farm-operations.xsd
β”‚       β”œβ”€β”€ farm-risk.xsd
β”‚       β”œβ”€β”€ farm-sustainability.xsd
β”‚       β”œβ”€β”€ farm-temporal.xsd
β”‚       β”œβ”€β”€ farm-join.xsd
β”‚       β”‚
β”‚       β”œβ”€β”€ codelists/
β”‚       β”‚   β”œβ”€β”€ BuildingType.xml
β”‚       β”‚   β”œβ”€β”€ CropGrowthStage.xml
β”‚       β”‚   β”œβ”€β”€ EducationLevel.xml
β”‚       β”‚   β”œβ”€β”€ FeedingPractice.xml
β”‚       β”‚   β”œβ”€β”€ ForestryProductType.xml
β”‚       β”‚   β”œβ”€β”€ InputType.xml
β”‚       β”‚   β”œβ”€β”€ LandTenureType.xml
β”‚       β”‚   β”œβ”€β”€ MainLocationType.xml
β”‚       β”‚   β”œβ”€β”€ OperationType.xml
β”‚       β”‚   β”œβ”€β”€ RelationshipToHead.xml
β”‚       β”‚   β”œβ”€β”€ SeedVarietyType.xml
β”‚       β”‚   β”œβ”€β”€ Sex.xml
β”‚       β”‚   └── StorageType.xml 
β”‚       β”‚
β”‚       β”œβ”€β”€ examples/
β”‚       β”‚   β”œβ”€β”€ example_ruralproperty.gml
β”‚       β”‚   β”œβ”€β”€ example_simp-ruralproperty.gml
β”‚       β”‚   β”œβ”€β”€ example_cropcycle.gml
β”‚       β”‚   └── example_enterprise.gml
β”‚       β”œβ”€β”€ metadata/
β”‚       β”‚   └── farmgml-metadata.yaml
β”‚       β”‚
β”‚       └── ogc/
β”‚           β”œβ”€β”€ citygml/
β”‚           β”‚   β”œβ”€β”€ 3.0/
β”‚           β”‚   β”‚   β”œβ”€β”€ core.xsd        
β”‚           β”‚   β”‚   β”œβ”€β”€ landUse.xsd
β”‚           β”‚   β”‚   β”œβ”€β”€ building.xsd
β”‚           β”‚   β”‚   β”œβ”€β”€ vegetation.xsd
β”‚           β”‚   β”‚   β”œβ”€β”€ generics.xsd
β”‚           β”‚   β”‚   β”œβ”€β”€ dynamizer.xsd
β”‚           β”‚   β”‚   └── versioning.xsd
β”‚           β”‚   └── xAL/
β”‚           β”‚       β”œβ”€β”€ xAL-types.xsd
β”‚           β”‚       └── xAL.xsd
β”‚           β”‚
β”‚           └── gml/
β”‚               └── 3.2.1/
β”‚                   β”œβ”€β”€ gml.xsd
β”‚                   └── xlinks.xsd
β”‚
β”œβ”€β”€ tools/                   # Automation and validation tools
β”‚   β”œβ”€β”€ shapechange-config/
β”‚   β”‚   └── farmgml_1.3_config.xml
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ generate-xsd-from-uml.bat
β”‚   β”‚   └── validate-xsd.sh
β”‚   └── validation/
β”‚       β”œβ”€β”€ validate_farmgml.py
β”‚       β”œβ”€β”€ validate_report.html  
β”‚       β”‚
β”‚       └── schematron/
β”‚           └── farmgml_rules.sch
β”‚
β”œβ”€β”€ docs/                   # Documentation and policies
β”‚   β”œβ”€β”€ specification/
β”‚   β”‚   β”œβ”€β”€ FarmGML_Conceptual_Model.pdf
β”‚   β”‚   β”œβ”€β”€ FarmGML_Encoding_Specification.pdf
β”‚   β”‚   └── FarmGML_UseCases.pdf
β”‚   β”‚
β”‚   β”œβ”€β”€ schema-reference/
β”‚   β”‚   └── 1.3/
β”‚   β”‚       └── farmgml_rules.sch
β”‚   β”‚
β”‚   └── policies/
β”‚       └── namespace-policy.md
β”‚
β”œβ”€β”€ .ogc/                   # OGC submission metadata
β”‚   β”œβ”€β”€ submission-manifest.yaml
β”‚   β”œβ”€β”€ contact.json
β”‚   └── ogc-registration.yaml
β”‚
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ LICENSE.txt
└── README.md

🧠 Schema Modules

Module Description
farm-core.xsd Defines the FarmGML core model (RuralProperty, LandUnit, FarmProfile, etc.)
farm-enterprise.xsd Models rural enterprises, their legal and structural attributes
farm-production.xsd Defines productive areas (AnnualCropArea, PerennialCropArea, Pasture, etc.)
farm-operations.xsd Describes agricultural operations and temporal dynamizers
farm-risk.xsd Structures for insurance, risk indexes, and ZARC indicators
farm-sustainability.xsd Environmental and sustainability indicators
farm-temporal.xsd Temporal modeling based on core:AbstractTimeSliceType
farm-hooks.xsd ADE integration hooks for CityGML generic linkage

First Validation and Conformance

Validation was performed using xmlschema 2.5.1 and Python 3.11 via the script tools/validation/validate_farmgml.py below:

import xmlschema
from pathlib import Path

XSD_PATH = Path("schemas/1.3/FarmGML.xsd")
EXAMPLES_DIR = Path("schemas/1.3/examples")

schema = xmlschema.XMLSchema(XSD_PATH)

print(f"βœ… Loaded schema: {XSD_PATH}")
print("πŸ” Validating examples...\n")

for gml in EXAMPLES_DIR.glob("*.gml"):
    try:
        schema.validate(gml)
        print(f"{gml} : OK βœ…")
    except xmlschema.XMLSchemaException as e:
        print(f"{gml} : Error ❌ -> {e.reason}")

βœ… Validation Results

tools/validation/validate_report.html

GML File Status
example_cropcycle.gml βœ… OK
example_enterprise.gml βœ… OK
example_ruralproperty.gml βœ… OK
example_simp-ruralproperty.gml βœ… OK

Conclusion:

All GML example files were successfully validated. The FarmGML.xsd schema is fully compliant with OGC CityGML 3.0 ADE and GML 3.2.1 standards.


βš™οΈ Model-Driven Architecture (MDA) Workflow

FarmGML adopts a Model-Driven Architecture approach.
All schemas and documentation are generated from the UML conceptual model.

Workflow summary:

  1. Model conceptual features in UML.
  2. Export UML β†’ XMI (model/1.3/FarmGML_v1.3.xmi).
  3. Configure ShapeChange using tools/shapechange-config/farmgml_1.3_config.xml.
  4. Run ShapeChange to generate XSD modules under schemas/1.3/.
  5. Validate using the included validate-xsd.sh script.
  6. Test instances (example_ruralproperty.gml) with 3DCityDB, CesiumJS, and QGIS.

Validation and Use Cases

To validate the FarmGML ADE:

  1. 3DCityDB

    • Import the CityGML 3.0 core schema and FarmGML ADE modules.
    • Load schemas/1.3/examples/example_ruralproperty.gml using the Importer/Exporter.
    • Confirm ADE tables are created (e.g., farm_ruralproperty, farm_croparea).
    • Visualize using the 3DCityDB Web Map Client or CesiumJS.
  2. CesiumJS

    • Convert the database instance to 3D Tiles using 3DCityDB Exporter.
    • Publish tiles on a CesiumJS viewer.
    • Use the attributes from FarmGML (e.g., crop type, sustainability index) for pop-ups or layer styling.
  3. QGIS

    • Load the GML directly via Layer β†’ Add Layer β†’ Add Vector Layer…
    • Ensure the CityGML 3.0 + ADE plugin is active.
    • Inspect feature attributes and geometry consistency.

Validation success criteria:

  • All features are parsed without schema errors.
  • The ADE-specific attributes (farm:) are recognized in each environment.

πŸ“š References

β€’	3DCityDB ADE Manager
β€’	CesiumJS (https://cesium.com/platform/cesiumjs)
β€’	Van den Brink, L., Stoter, J., Zlatanova, S. (2013) – UML-Based Approach to Developing a CityGML Application Domain Extension. Transactions in GIS, 17(6): 920–942.
β€’	OGC (2021) – CityGML 3.0 Conceptual Model Standard (OGC 20-010).
β€’	ISO 19136 – Geography Markup Language (GML).
β€’	ShapeChange Tool – UML-to-GML encoder implementing ISO encoding rules.

πŸ‘€ Contact

Name Eng. Igor QuintΓ£o
Organization UNIVERSIDADE FEDERAL DE VIÇOSA - UFV
------- -------
Email [email protected]
------- -------
Version FarmGML ADE v1.3
------- -------
Date 2025-10-25
------- -------

Β© 2025 FarmGML ADE Project β€” Licensed under CC BY 4.0

Developed using Model-Driven Architecture principles (UML β†’ ShapeChange β†’ XSD)


πŸ›οΈ Namespace Ownership

The official namespace URI for this ADE is:

https://igorquintao.github.io/FarmGML-ADE/schemas/1.3

It is maintained by Eng. Igor QuintΓ£o under GitHub Pages hosting.
This URI resolves to the authoritative location of the FarmGML ADE schemas and documentation.

About

FarmGML (ADE) Application Domain Extension for CityGML 3.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published