, :
" , , , , , geojson"
GeoJSON "" , GeoJSON " ",
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-179.99,
89.99
],
[
-179.99,
0
],
[
-179.99,
-89.99
],
[
0,
-89.99
],
[
179.99,
-89.99
],
[
179.99,
0
],
[
179.99,
89.99
],
[
0,
89.99
],
[
-179.99,
89.99
]
],
[
[
-0.191208,
51.509869
],
[
-0.158464,
51.513287
],
[
-0.151769,
51.50554
],
[
-0.174471,
51.502178
],
[
-0.187989,
51.502444
],
[
-0.191208,
51.509869
]
]
],
"properties": {
"Territoire": 2
}
},
"properties": {
"name": "Hyde Park"
}
}
]
}
- :

, GeoJSON, , " "
[
[
-179.99,
89.99
],
[
-179.99,
0
],
[
-179.99,
-89.99
],
[
0,
-89.99
],
[
179.99,
-89.99
],
[
179.99,
0
],
[
179.99,
89.99
],
[
0,
89.99
],
[
-179.99,
89.99
]
]
0 ( ) coordinates :
JSONObject featureCollection = geoJsonData;
JSONArray features = featureCollection.getJSONArray("features");
for(int i = 0; i < features.length(); i++) {
JSONObject feature = features.getJSONObject(i);
JSONObject geometry = feature.getJSONObject("geometry");
String geometryType = geometry.getString("type");
if ("Polygon".equals(geometryType)) {
JSONArray coordinates = geometry.getJSONArray("coordinates");
if (coordinates.length() == 1) {
coordinates.put(coordinates.get(0));
JSONArray wholeMap = new JSONArray(
"[\n" +
" [\n" +
" -179.99,\n" +
" 89.99\n" +
" ],\n" +
" [\n" +
" -179.99,\n" +
" 0\n" +
" ],\n" +
" [\n" +
" -179.99,\n" +
" -89.99\n" +
" ],\n" +
" [\n" +
" 0,\n" +
" -89.99\n" +
" ],\n" +
" [\n" +
" 179.99,\n" +
" -89.99\n" +
" ],\n" +
" [\n" +
" 179.99,\n" +
" 0\n" +
" ],\n" +
" [\n" +
" 179.99,\n" +
" 89.99\n" +
" ],\n" +
" [\n" +
" 0,\n" +
" 89.99\n" +
" ],\n" +
" [\n" +
" -179.99,\n" +
" 89.99\n" +
" ]\n" +
" ]"
);
coordinates.put(0, wholeMap);
} else {
Log.d("OAA", "No need insert");
}
}
}
geoJsonData - GeoJSON " ", :
JSONObject geoJsonData = new JSONObject(
"{\n" +
" \"type\": \"FeatureCollection\",\n" +
" \"features\": [\n" +
" {\n" +
" \"type\": \"Feature\",\n" +
" \"geometry\": {\n" +
" \"type\": \"Polygon\",\n" +
" \"coordinates\": [\n" +
" [\n" +
" [\n" +
" -0.191208,\n" +
" 51.509869\n" +
" ],\n" +
" [\n" +
" -0.158464,\n" +
" 51.513287\n" +
" ],\n" +
" [\n" +
" -0.151769,\n" +
" 51.50554\n" +
" ],\n" +
" [\n" +
" -0.174471,\n" +
" 51.502178\n" +
" ],\n" +
" [\n" +
" -0.187989,\n" +
" 51.502444\n" +
" ]\n" +
" ]\n" +
" ],\n" +
" \"properties\": {\n" +
" \"Territoire\": 2\n" +
" }\n" +
" },\n" +
" \"properties\": {\n" +
" \"name\": \"Hyde Park\"\n" +
" }\n" +
" }\n" +
" ]\n" +
"}"
);
GeoJSON "", GeoJSON 2 "" Hyde Regent:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-179.99,
89.99
],
[
-179.99,
0
],
[
-179.99,
-89.99
],
[
0,
-89.99
],
[
179.99,
-89.99
],
[
179.99,
0
],
[
179.99,
89.99
],
[
0,
89.99
],
[
-179.99,
89.99
]
],
[
[
-0.191208,
51.509869
],
[
-0.158464,
51.513287
],
[
-0.151769,
51.50554
],
[
-0.174471,
51.502178
],
[
-0.187989,
51.502444
],
[
-0.191208,
51.509869
]
],
[
[
-0.167685,
51.530226
],
[
-0.163737,
51.534924
],
[
-0.151849,
51.537566
],
[
-0.151849,
51.537566
],
[
-0.146914,
51.535964
],
[
-0.145625,
51.525325
],
[
-0.155538,
51.523589
],
[
-0.167685,
51.530226
]
]
],
"properties": {
"Territoire": 2
}
},
"properties": {
"name": "Hyde Park"
}
}
]
}