geoJSON格式需要更深入地嵌套

问题描述

我有一种导出的geoJSON格式,其中包含很长的多边形坐标系列。附加前几行,它以相同的方式继续:

{
  "Type": 8,"Features": [
    {
      "Type": 7,"Id": null,"Geometry": {
        "Type": 4,"Coordinates": [
          {
            "Type": 2,"Coordinates": [
              {
                "Altitude": null,"Latitude": 85.683948266763423,"Longitude": 100.62897140939768
              },{
                "Altitude": null,"Latitude": 86.183185093020128,"Longitude": 100.62897140939695
              },"Longitude": 102.58500571589823
              },"Latitude": 97.662303996119974,"Longitude": 102.58500571589828
              },"Latitude": 97.662303996119988,"Longitude": 97.853903401585853
              },"Longitude": 97.853903401585839
              },"Longitude": 100.62897140939768
              }
            ],"BoundingBoxes": null,"CRS": null
          }
        ],"CRS": null
      },"Properties": {
        "Name": "Shop","Area": 572.15969696515185
      },"CRS": null
    },{
      "Type": 7,"Latitude": 91.298364266763443,"Longitude": 86.631773715898134
              },{

我尝试在线查看geoJSON格式的各种解释,但是没有找到有关"Type"为什么是数字且不匹配实际类型(例如"polygon")的信息。 / p>

此外,在GeoJSON Viewer & Validator上进行测试时,我尝试调试并将某些初始行转换为:

{
  "type": "Multipolygon","coordinates": [
    {
      "type": 7,"Geometry": {
        "Type": "polygon",

我将Type替换为type,将8替换为Multipolygon等。 有了上述情况,每个多边形都会出现以下错误

第5行:找到了应该在其中放置坐标数组的数字 发现:需要更深入地嵌套

我不确定要对格式进行哪些更改,以使其与验证程序保持一致。我认为导出格式可能很旧,但我不是构建该格式的人,因此手动替换某些字段可以解决此问题。

有什么提示吗?

解决方法

聚会有点晚了,但它似乎不是有效的 GeoJSON,您可以在此处找到描述规范的官方 JSON 模式: https://github.com/geojson/schema。 例如,指定特征的 type 应该是 JSON 对象而不是整数,对于每个特征,需要 typepropertiesgeometry 等.

  "$schema": "http://json-schema.org/draft-07/schema#","$id": "https://geojson.org/schema/Feature.json","title": "GeoJSON Feature","type": "object","required": [
    "type","properties","geometry"
  ]
(etc.)

对于 MultiPolygon,这里是架构:https://geojson.org/schema/MultiPolygon.json

坐标存储在文件中的方式也不是标准的 GeoJSON,因为它们应该写成数字数组:

"coordinates": {
      "type": "array","items": {
        "type": "array","items": {
          "type": "array","minItems": 4,"items": {
            "type": "array","minItems": 2,"items": {
              "type": "number"
            }
          }
        }
      }
    }