Toolkit.GeoJsonToGeometry返回是null

0 投票
iobject java ,GeoJson字符串转换为Gemetry返回为null,是什么原因?我传递的是String类型的geojson数据

如下:

{
    "type": "FeatureCollection",
    "features": [{
        "geometry": {
            "coordinates": [
                [
                    [
                        [
                            112.4774,
                            24.8459
                        ],
                        [
                            112.4778,
                            24.8459
                        ],
                        [
                            112.4777,
                            24.8458
                        ],
                        [
                            112.4776,
                            24.8458
                        ],
                        [
                            112.4776,
                            24.8458
                        ],
                        [
                            112.4774,
                            24.8459
                        ]
                    ]
                ]
            ],
            "type": "MultiPolygon"
        },
        "id": "水系面.1",
        "type": "Feature",
        "properties": {
            "Id": 0
        }
    }]
}
3月 8 分类:  37次浏览 | 用户: Suns 初出茅庐 (36 分)

1个回答

0 投票
 
已采纳

你好,您的json参数设置,请参考范例:

String json2 = "{\"type\":\"Polygon\",\"coordinates\":[[[192.058133847925,450.239607082329],[362.877814602317,450.239607082329],[362.877814602317,13.1625292006452],[198.973910396686,28.377237607919],[187.908667918668,29.0688152627951],[192.058133847925,450.239607082329]]]}";
Geometry geo = Toolkit.GeoJsonToGeometry(json2);
System.out.println(geo);

3月 8 用户: 张亮 名扬四海 (2,232 分)
采纳于 3月 9 用户:Suns
...