我需要帮助从GeoJSON文件中读取多边形,我知道如何阅读 一个简单的观点。这是我使用的GeoJSON文件和Java代码 为了阅读一点,现在我需要阅读多边形,有人可以帮助我吗?
GeoJSON文件:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
13.805694580078125,
40.79717741518766
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
13.77685546875,
40.823682398765996
],
[
13.77685546875,
40.60300547512703
],
[
14.085159301757812,
40.660847697284815
],
[
13.959503173828125,
40.854851176469666
],
[
13.77685546875,
40.823682398765996
]
]
]
}
}
]
}
Java代码
case GeoJSON.TYPE_POINT:
Point point=(Point) feature.getGeometry();
double lat = point.getPosition().getLatitude();
System.out.println(lat+"\n");
double lon = point.getPosition().getLongitude();
System.out.println(lon+"\n");
GeoPoint x = new GeoPoint(lat,lon);
mywaypoints.add(x);
break;