What is the proper value representation of a schem

2019-04-12 07:57发布

问题:

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