A framework for automatic conversion of geospatial data (implemented using Shapefiles as an example) and converting it into multidimensional Spatial data as RDF. The resulting Geographic knowledge graphs can represent spatial relationships fusioning topology and metric to improve reasoning ability.
The process runs in three steps (see the following sections):
- Automatic extracting geometric features and calculating topological relationships
- Adaptive Weight Calculation Based on Distance and Topological Relationships
- Constructing Knowledge Graph (
RDF)
This is the implementation accompanying the paper MDSR-KG: A Geographical Knowledge Graph Framework For Representing and Quantifying Spatial Relationships published in ISPRS International Journal of Geo-Information.
The environment framework we use is anaconda.
The dependencies should be installed. The requirements.txt file is:
GDAL==3.5.0
geopandas==0.10.2
opencv-python==4.6.0
openpyxl==3.1.3
Pillow==9.3.0
shapely==2.0.7
torch==1.13.1
torchaudio==0.13.1
torchvision==0.14.1
numpy==1.21.6
psycopg2==2.9.9
python==3.7.12
tqdm==4.62.3
How to run:
python main.py -f <path_to_shapefiles>
-r
-o <path_to_output_file>
For example:
python main.py -f ./data/shapefiles -r -o geo_objects.jl
will produce the files: geo_objects.geom.jl (geometry), geo_objects.objects.jl (objects) and geo_objects.rel.jl (relations).
The relations include the Spatial Weight.
Constructing geographic knowledge graph following the GeosSPARQL standard. The jl files are toke as input to generate RDF data.
How to run:
python generate_graph.py -g <path_to_geometry_file>
-b <path_to_objects_file>
-r <path_to_relations_file>
-o <path_to_output_file>
For example:
python GenerateGraph.py -g geo_objects.geom.jl -b geo_objects.objects.jl -r geo_objects.rel.jl -o spatial.graph.ttl
will produce the file spatial.graph.ttl
If you would like to cite this work in a paper or a presentation, the following is recommended (BibTeX entry):
如果您在研究中使用了本工具,请引用:
@article{
title={MDSR-KG: A Geographical Knowledge Graph Framework For Representing and Quantifying Spatial Relationships},
author={Ying Chen, Jixian Zhang, Juan Ge and Zhanji Peng},
journal={ISPRS International Journal of Geo-Information},
year={2026}
}