GeoJSON header 中的元数据
MetaData in header of GeoJSON
如果我在 GeoJSON 文件(或数据包)的顶部添加一些 meta-data,它会破坏大多数读者(并违反规范)吗?
我看了:https://gis.stackexchange.com/questions/96158/metadata-and-geojson
但我不清楚这是否回答了我的问题。
例如,除了 "name"、"properties" 之外,能否向 CRS 添加更多属性 object 以获得一些扩展 meta-data,而不是将其放在每个功能?
我不知道它是否违反规范,但我做了类似的事情并且没有破坏 reader。
例如,我有一个包含 10 个特征的 GeoJSON 文件,我想给它添加一个时间戳。我用 Javascript (Node.js):
完成了这个
var json_in = require('/path/to/file/input.json');
var timei = ("2016-10-31 12Z");
var jsonfile = require('jsonfile');
var file = '/path/to/file/output.json';
jsonfile.writeFile(file, json_in, function (err) {
console.error(err)
})
然后我在 http://geojson.io 上绘制了特征并确认一切看起来都正确。
仅供参考您可以在此处获取 jsonfile 包(使 I/O 更加流畅):
https://github.com/jprichardson/node-jsonfile
geojson 规范第 6.1 节状态 (https://www.rfc-editor.org/rfc/rfc7946):
6.1. Foreign Members
Members not described in this specification ("foreign members") MAY be
used in a GeoJSON document. Note that support for foreign members can
vary across implementations, and no normative processing model for
foreign members is defined. Accordingly, implementations that rely
too heavily on the use of foreign members might experience reduced
interoperability with other implementations.
For example, in the (abridged) Feature object shown below
{
"type": "Feature",
"id": "f1",
"geometry": {...},
"properties": {...},
"title": "Example Feature" }
the name/value pair of "title": "Example Feature" is a foreign member.
When the value of a foreign member is an object, all the descendant
members of that object are themselves foreign members.
GeoJSON semantics do not apply to foreign members and their descendants, regardless of their names and values. For example, in
the (abridged) Feature object below
{
"type": "Feature",
"id": "f2",
"geometry": {...},
"properties": {...},
"centerline": {
"type": "LineString",
"coordinates": [
[-170, 10],
[170, 11]
]
} }
the "centerline" member is not a GeoJSON Geometry object.
如果我在 GeoJSON 文件(或数据包)的顶部添加一些 meta-data,它会破坏大多数读者(并违反规范)吗?
我看了:https://gis.stackexchange.com/questions/96158/metadata-and-geojson
但我不清楚这是否回答了我的问题。
例如,除了 "name"、"properties" 之外,能否向 CRS 添加更多属性 object 以获得一些扩展 meta-data,而不是将其放在每个功能?
我不知道它是否违反规范,但我做了类似的事情并且没有破坏 reader。
例如,我有一个包含 10 个特征的 GeoJSON 文件,我想给它添加一个时间戳。我用 Javascript (Node.js):
完成了这个var json_in = require('/path/to/file/input.json');
var timei = ("2016-10-31 12Z");
var jsonfile = require('jsonfile');
var file = '/path/to/file/output.json';
jsonfile.writeFile(file, json_in, function (err) {
console.error(err)
})
然后我在 http://geojson.io 上绘制了特征并确认一切看起来都正确。
仅供参考您可以在此处获取 jsonfile 包(使 I/O 更加流畅): https://github.com/jprichardson/node-jsonfile
geojson 规范第 6.1 节状态 (https://www.rfc-editor.org/rfc/rfc7946):
6.1. Foreign Members
Members not described in this specification ("foreign members") MAY be used in a GeoJSON document. Note that support for foreign members can vary across implementations, and no normative processing model for foreign members is defined. Accordingly, implementations that rely too heavily on the use of foreign members might experience reduced interoperability with other implementations.
For example, in the (abridged) Feature object shown below
{ "type": "Feature", "id": "f1", "geometry": {...}, "properties": {...}, "title": "Example Feature" }
the name/value pair of "title": "Example Feature" is a foreign member. When the value of a foreign member is an object, all the descendant members of that object are themselves foreign members. GeoJSON semantics do not apply to foreign members and their descendants, regardless of their names and values. For example, in the (abridged) Feature object below
{ "type": "Feature", "id": "f2", "geometry": {...}, "properties": {...}, "centerline": { "type": "LineString", "coordinates": [ [-170, 10], [170, 11] ] } }
the "centerline" member is not a GeoJSON Geometry object.