Do you have a code sample that you would care to share?
Thanks!
It's a ArcObjects code written in Java. I am not sure if it is appropriate to post here. Here is the code snippets (i appologize if someone feels offended).
while(feature !=null)
{
/*
* reproject feature to web mercator
*/
feature.project(webMercator); // webMercator is a SR defined as class property
if (getGeometryType()=="esriGeometryPoint") geometryStr=ServerUtilities.getJSONFromPoint((Point)feature.getShape()).toString();
else if (getGeometryType()=="esriGeometryMultipoint")
geometryStr=ServerUtilities.getJSONFromMultipoint((Multipoint)feature.getShape()).toString();
else if (getGeometryType()=="esriGeometryPolyline")
{
polyline=(Polyline)feature.getShape();
polyline.generalize(1);
geometryStr=ServerUtilities.getJSONFromPolyline(polyline).toString();
}
else if (getGeometryType()=="esriGeometryPolygon")
{
polygon =(Polygon)feature.getShape();
polygon.generalize(1); geometryStr=ServerUtilities.getJSONFromPolygon(polygon).toString();
}
else
geometryStr =JSONObject.NULL.toString();
attributesStr ="{";
/*
* create a JSON text of feature attributes
*/
for (int i=0; i<fldCount; i++)
{
field = fields.getField(i);
//SHAPE.LENGTH and SHPAE.AREA
if (field.getType()!=esriFieldType.esriFieldTypeGeometry &&
field.getType()!=esriFieldType.esriFieldTypeRaster &&
field.getType()!=esriFieldType.esriFieldTypeBlob && field.getName().indexOf("SHAPE.")==-1)
{
if (feature.getValue(i)==null)
attributesStr +="\""+field.getName()+"\":"+ JSONObject.NULL.toString()+",";
else if (field.getType()==esriFieldType.esriFieldTypeString ||field.getType()==esriFieldType.esriFieldTypeDate)
attributesStr +="\""+field.getName()+"\":\""+ feature.getValue(i).toString()+"\",";
else
attributesStr +="\""+field.getName()+"\":"+ feature.getValue(i).toString()+",";
}
}
/*
* add change type to the attributes
*/
attributesStr +="\"changeType\":"+ changeType +"}";
/*
* put geometry and attribute key/value pair together
* and form a JSON representation of feature
*/
featureJSON =new JSONObject();
featureJSON.put("attributes", new JSONObject(attributesStr));
featureJSON.put("geometry", new JSONObject(geometryStr));
//featuresArray is a JSONArray
featuresArray.put(featureJSON);
feature =(Feature)pCursor.nextFeature();
}