Java Android GeoJsonPoint非标准/错误JSON?
如何从GeoJsonPoint中提取正确的JSON 我想要以下JSON:Java Android GeoJsonPoint非标准/错误JSON?,java,android,json,geojson,point,Java,Android,Json,Geojson,Point,如何从GeoJsonPoint中提取正确的JSON 我想要以下JSON: "location":{"type":"Point","coordinates":[35.850607,76.734215]} 但是 我得到的是: "location":"Point{\n coordinates=lat\/lng: (35.850607, -76.734215)\n}\n" 这是我的密码: JSONObject X = new JSONObject(); JSONObject location = n
"location":{"type":"Point","coordinates":[35.850607,76.734215]}
但是
我得到的是:
"location":"Point{\n coordinates=lat\/lng: (35.850607, -76.734215)\n}\n"
这是我的密码:
JSONObject X = new JSONObject();
JSONObject location = new JSONObject();
JSONArray coords = new JSONArray();
try{
X.put( "location", new GeoJsonPoint( new LatLng( 35.850607, -76.734215) ); );
}catch ( JSONException aE ){ aE.printStackTrace(); }
X.toString()
"location":"Point{\n coordinates=lat\/lng: (35.850607, -76.734215)\n}\n"
我可以通过以下方式得到我想要的:
JSONObject X = new JSONObject();
JSONObject location = new JSONObject();
JSONArray coords = new JSONArray();
try{
coords.put( 35.850607 )
.put( 76.734215 );
location
.put("type", "Point")
.put( "coordinates", coords);
X.put( .put( "location", location );
}catch ( JSONException aE ){ aE.printStackTrace(); }
X.toString()
"location":{"type":"Point","coordinates":[35.850607,76.734215]}
但是我想使用GeoJsonPoint数据类型
标准如下:
Point
Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates):
{ "type": "Point", "coordinates": [100.0, 0.0] }
发件人:
我的问题是什么?
我是否误解了GeoJson与Json的正确用法??
或者Android GeoJson/GeoJsonPoint是非标准GeoJson