GeoJSON
0.3.0 release
Welcome to the Open Fibre Data Standard 0.3.0 release.
We want to hear your feedback on the standard and its documentation. For general feedback, questions and suggestions, you can comment on an existing discussion or start a new one. For bug reports or feedback on specific elements of the data model and documentation, you can comment on the issues in the issue tracker or you can create a new issue.
To comment on or create discussions and issues, you need to sign up for a free GitHub account. If you prefer to provide feedback privately, you can email info@opentelecomdata.net.
This page describes how to publish data in GeoJSON format.
If your data is small enough to fit into memory or if you are publishing data via an API, you should use the small files and API responses option. If your data is too large to fit into memory, you should use the streaming option.
Some GIS tools require all features in a GeoJSON feature collection to have the same .geometry.type
or to have a consistent schema of .properties
. Therefore, in order to reduce barriers for users of such tools, the recommended approach is to publish separate feature collections for nodes and spans. If you prefer, you may publish a single feature collection containing both nodes and spans. In which case, the properties.featureType
field can be used to determine whether each feature is a node or a span.
Small files and API responses option
You should publish separate GeoJSON feature collections for nodes and spans, according to the GeoJSON transformation specification.
The following example shows a GeoJSON feature collection containing nodes:
The following example shows a GeoJSON feature collection containing spans:
Each feature collection may contain features from one or more networks. The network each feature relates to is identified by its .properties.network.id
.
The following example shows a GeoJSON feature collection containing features from two networks:
For data published via a paginated API, you should add a top-level links
object to the feature collection to provide URLs for the next and previous pages of results:
Title |
Description |
Type |
Format |
Required |
---|---|---|---|---|
next |
string |
iri |
||
Next |
A URL to the next sequential package. |
|||
prev |
string |
iri |
||
Previous |
A URL to the previous sequential package. |
The following example shows a GeoJSON feature collection containing two features with URLS for the next and previous pages of results.
Streaming option
The streaming option describes how to publish multiple networks in GeoJSON format with support for streaming. You should only use this option if your data is too large to load into memory.
You should publish separate Newline-delimited GeoJSON files for nodes and spans, in which each line is a GeoJSON feature structured according to the GeoJSON transformation specification.
The following example shows a newline-delimited GeoJSON file containing two nodes:
{"type":"Feature","properties":{"id":"1","name":"Accra POP","network":{"id":"fd7b30d6-f514-4cd0-a5ac-29a774f53a43","name":"Ghana Fibre Network"}, "featureType": "node"}}
{"type":"Feature","properties":{"id":"2","name":"Kumasi POP","network":{"id":"fd7b30d6-f514-4cd0-a5ac-29a774f53a43","name":"Ghana Fibre Network"}, "featureType": "node"}}
GeoJSON transformation specification
This section describes the rules for transforming an OFDS network from JSON format to GeoJSON format.
The transformation specification describes the recommended approach of producing separate feature collections for nodes and spans. If you prefer to publish a single GeoJSON feature collection containing both nodes and spans, you may combine the the resulting feature collections into a single feature collection.
Create an empty JSON object for the nodes feature collection and set its
.type
to ‘FeatureCollection’.Create an empty JSON object for the spans feature collection and set its
.type
to ‘FeatureCollection’.For each contract in
contracts
, dereference the phase references in.relatedPhases
.For each node in
nodes
:Convert the node to a GeoJSON feature:
Create an empty JSON object for the feature.
Set the feature’s:
.type
to ‘Feature’..geometry
to the node’s.location
, if it exists. Otherwise, set.geometry
toNull
..properties
to the properties of the node, excluding.location
..properties.featureType
to ‘node’.Dereference the organisation references in
.properties.physicalInfrastructureProvider
and.networkProviders
.Dereference the phase reference in the feature’s
.phase
property.Set
.properties.network
to the properties of the network, excluding.nodes
,.spans
,.phases
and.organisations
.
Add the feature to the nodes feature collection.
For each span in
spans
:Convert the span to a GeoJSON Feature:
Create an empty JSON object for the feature.
Set the feature’s:
.type
to ‘Feature’..geometry
to the span’s.route
, if it exists. Otherwise, set.geometry
toNull
..properties
to the properties of the span, excluding.route
..properties.featureType
to ‘span’.Dereference the organisation references in
.properties.physicalInfrastructureProvider
and.networkProviders
.Dereference the phase reference in
.properties.phase
.Dereference the node ids in
properties.start
andproperties.end
.Set
.properties.network
to the properties of the network, excluding.nodes
,.spans
,.phases
and.organisations
.
Add the feature to the spans feature collection.
Common operations
Dereference an organisation reference
Get the Organisation
object in organisations
whose .id
is equal to the .id
of the OrganizationReference
.
Dereference a phase reference
Get the Phase
object in phases
whose .id
is equal to the id
of the PhaseReference
.
Dereference a node ID
Get the Node
object in nodes
whose .id
is equal to the ID.
Reference implementation
A reference implementation of the transformation is available in Python on Github. We strongly encourage any re-implementations to read its commented code, to ensure correctness.