static String getJSonStringFromGeometry(Geometry geomIn, SpatialReference sr) { String jsonStr4Geom = GeometryEngine.geometryToJson(sr, geomIn); String jsonStrNew = "{\"geometryType\":\"" + getGeometryType(geomIn) + "\",\"geometries\":[" + jsonStr4Geom + "]}"; return jsonStrNew; }
static Geometry getGeometryFromJSon(String jsonStr) { JsonFactory jf = new JsonFactory(); try { JsonParser jp = jf.createJsonParser(jsonStr); jp.nextToken(); Geometry geom = GeometryEngine.jsonToGeometry(jp).getGeometry(); return geom; } catch (Exception ex) { return null; } }