在JSON-LD中使用schema.org/polygon时,正确的值表示形式是什么? [英] What is the proper value representation of a schema.org/polygon when used in JSON-LD?

查看:89
本文介绍了在JSON-LD中使用schema.org/polygon时,正确的值表示形式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将尝试用于RESTful API的数据表示形式是 JSON-LD ,而我打算使用的词汇表则来自 schema.org . >

在词汇表 schema.org/GeoShape 中,它表示多边形应采用文本格式,但它并没有确切说出哪种文本格式.还没有说明应使用 WKT多边形格式./p>

WKT多边形格式 (知名文本)

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

但是,由于我将使用JSON-LD表示数据,因此与GeoJson Polygons或本机JSON数组一起使用类似的内容也是合理的.

GeoJson多边形格式

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

本地JSON二维数组

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

考虑到这一点,当在 schema.org/polygon 中使用时,正确的值表示形式是什么JSON-LD?

解决方案

我强烈建议使用建议的文本格式,因为这是大多数消费者所期望的.如果您更喜欢结构化的表示形式,则可以考虑改用GeoJSON-LD: http://geojson.org/vocab

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?

解决方案

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

这篇关于在JSON-LD中使用schema.org/polygon时,正确的值表示形式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆