Преобразование толчка для пространственных данных (от geo json до arcGIS json) - PullRequest
0 голосов
/ 16 марта 2020

Я новичок в преобразовании Джолта и пытаюсь написать spe c для пространственных данных. Я не могу получить ожидаемый результат, особенно с данными для координат. Любая помощь будет принята с благодарностью.

Ниже приведены данные, которые я получаю:

{
"type": "Feature Collection",
"c rs": {
    "type": "name",
    "properties": {
      "name": "4326"
    }
  },
  "features": [
    {
      "type": "Feature",
      "id": 1,
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.682207049,
          45.526159497
        ]
      },
      "properties": {
        "F ID": 1,
        "Place Name": "Boyd Coffee",
        "Place Address": "404 NW 11th Ave Portland Oregon",
        "Score": 100,
        "latitude": 45.526159497,
        "longitude": -122.682207049
      }
    },
    {
      "type": "Feature",
      "id": 2,
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.677518466,
          45.525246078
        ]
      },
      "properties": {
        "F ID": 2,
        "Place Name": "John's Coffee Shop",
        "Place Address": "301 NW Broadway St Portland Oregon",
        "Score": 100,
        "lat": 45.525246078,
        "l on": -122.677518466
      }
    },
    {
      "type": "Feature",
      "id": 3,
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.68287749,
          45.526496967
        ]
      },
      "properties": {
        "F ID": 3,
        "Place Name": "Starbucks",
        "Place Address": "1134 NW  St Portland Oregon",
        "Score": 100,
        "latitude": 45.526496967,
        "longitude": -122.68287749
      }
    }
  ]
}

Ожидаемый результат -

"features": [
        {
            "attributes": {
                "F ID": 1,
                "Place Name": "Boyd Coffee",
                "Place Address": "404 NW 11th Ave Portland Oregon",
                "Score": 100,
                "latitude": 45.526159497,
                "longitude": -122.682207049
            },
            "geometry": {
                "x": -122.68220704900002,
                "y": 45.526159496999998
            }
        },
        {
            "attributes": {
                "FID": 2,
                "Place Name": "John's Coffee Shop",
                "Place Address": "301 NW Broadway St Portland Oregon",
                "Score": 100,
                "latitude": 45.525246078,
                "longitude": -122.677518466
            },
            "geometry": {
                "x": -122.677518466,
                "y": 45.52524607799999
            }
        }

    ]

Я приду c как показано ниже, и не выводит ожидаемое. Может кто-нибудь помочь, пожалуйста? Спецификация c:

 [
      {
        "operation": "shift",
        "spec": {
          "features": {
            "*": {
              "properties": "features[&1].attributes",
              "geometry": {
                "coordinates": {
                  "0": "features[&].geometry.x",
                  "1": "features[&].geometry.y"
                }
              }
            }
          }
        }
      }
    ]

1 Ответ

0 голосов
/ 14 апреля 2020

Измените ниже в вашей спецификации c

"0": "features[&].geometry.x", -> "0": "features[&3].geometry.x",

"1": "features[&].geometry.y", -> "1": "features[&3].geometry.y",

 [
   {
     "operation": "shift",
     "spec": {
       "features": {
         "*": {
           "properties": "features[&1].attributes",
           "geometry": {
             "coordinates": {
               "0": "features[&3].geometry.x",
               "1": "features[&3].geometry.y"
             }
           }
         }
       }
     }
      }
    ]
...