如何使用lineString制作geojson格式

时间:2018-04-23 17:06:43

标签: java json geojson spring-jdbc

对不起,但我有一个问题,我不知道pojos要创造什么 格式为geojson类型的lineString及其点

{
        "type": "FeatureCollection",
        "features": [{
            "type": "Feature",
            "geometry": {
              "type": "LineString"
              "coordinates": [
                [
                  -87.72158863628451,
                  41.88857748226596
                ],
                [
                  -87.71467926585602,
                  41.88753117344939
                ]
              ],
            }
        }, {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-121.415061, 40.506229]
            }
        }, {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-121.505184, 40.488084]
            }
        }, {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-121.354465, 40.488737]
            }
        }]
    }

从我看到的时候我看到它很难看,因为坐标对象必须带有相同的名称Line String和Point。 我用下面的鸡用来获取点型坐标,我想知道在不必重载pojos的情况下我必须做什么

    private String type;

List<Double> coordinates = new ArrayList<>();

public String getType() {
    return type;
}

public void setType(String type) {
    this.type = type;
}

public List<Double> getCoordinates() {
    return coordinates;
}

0 个答案:

没有答案