= RDF 2 GeoJSON
This repository defines a conversion process for RDF data to GeoJSON and implements a version of it in Python.
See the convert.convert()
function which does all the work.
Whatever RDF you give it, the conversion function will return either:
geojson.FeatureCollection
Python object, orA valid result can be serialized to GeoJSON like this:
from rdflib import Graph from rdf2geojson import convert from geojson import dumps
The criteria for creating a valid FeatureCollection
output are:
== GeoSPARQL -> GeoJSON specification below
GeoSPARQL knows about the following main object classes:
FeatureCollection
Feature
GeometryCollection
Geometry
MultiPolygon
Polygon
MultiLineString
LineString
MultiPoint
Point
The following rules are used to translate these classes to parts of GeoJSON:
FeatureCollection
-> GeoJSON FeatureCollection
FeatureCollection
is present in the RDF, one will be created in the GeoJSONFeature
-> GeoJSON FeatureGeometryCollection
currently has no mappingGeometry
-> the geometry of a Feature and such objects are ignored
stand-alone Geometries are not handled
multiple geometries are not handled - only the first is usedFeature
instances, other than Geometry
instances, are added as GeoJSON key/valu pair properties== License, Use & Contributing
This code is made available for use using the https://opensource.org/license/BSD-3-clause[BSD 3-Clause] license. See the LICENSE
file for the deed.
This content is all copyrighted as follows:
© KurrawongAI, 2024
This code will always use this license, so contributors may contribute knowing this code will always be freely available for use.
== Tests
Tests can be run using the Taskfile like this:
== Development Roadmap
See the https://github.com/Kurrawong/rdf-to-geojson/issues[Issue Tracker] for this project, as well as TODO:
items within the codebase.
== Contact
Nicholas J. Car + https://kurrawong.ai[KurrawongAI] + nick@kurrawong.net