What is the proper value representation of a schema.org/polygon when used in JSON-LD?

﹥>﹥吖頭↗ 提交于 2019-12-21 19:46:43

问题


The data representation I will try to use for a RESTful API is JSON-LD and the vocabulary I intend to use are those from schema.org.

In the vocabulary schema.org/GeoShape, it says that polygons are expected to be on text format but it doesn't exactly say what kind of text format. It wasn't also stated that it should use the WKT Polygon format.

WKT Polygon Format (Well-known Text)

POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))

However, since I will be representing data using JSON-LD, it may also be reasonable to use something similar with GeoJson Polygons or the native JSON Array.

GeoJson Polygon Format

{
"type": "Polygon",
"coordinates": [
        [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
    ]
}

Native JSON 2D Array

[
[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]
]

With this in mind, what is the proper value representation of a schema.org/polygon when used in JSON-LD?


回答1:


I would strongly suggest to use the suggested text format as that's what most consumers will expect. If you prefer a more structured representation, you could consider using GeoJSON-LD instead: http://geojson.org/vocab



来源:https://stackoverflow.com/questions/25235505/what-is-the-proper-value-representation-of-a-schema-org-polygon-when-used-in-jso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!