Hi, so far I didn't find any real Official JSON format (if that exist).
I've found the ESRI JSON input format expected by a geoprocessing service for ArcGIS 10.0.
http://help.arcgis.com/EN/arcgisserv...est/index.html
So I know exactly what the geoprocessing service expects.
I've also seen how a featureSet should be sent to a geoprocessing service through the submitJob function of the esri.tasks.Geoprocessor.
http://help.arcgis.com/en/webapi/jav...oprocessor.htm
My problem is to figure out, where does that geoprocessor find its toJson function for a featureSet.
ESRI says that the format expected should be some like this :
Code:
{
"geometryType" : "esriGeometryPoint",
"spatialReference" : {"wkid" : 4326},
"features" : [
{
"geometry" : {"x" : -104.44, "y" : 34.83},
"attributes" : {"Id" : 43, "Name" : "Feature 1"}
},
{
"geometry" : {"x" : -100.65, "y" : 33.69},
"attributes" : {"Id" : 67, "Name" : "Feature 2"}
}
]
}
But then, the geoprocessor object create the JSON from my featureSet like this:
Code:
{
"fields":[],
"geometryType":"esriGeometryPoint",
"features":[
{
"geometry":{"x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}},
"attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true}
}
],
"sr":{"wkid":3400}
}
Althought the JSON.stringify() method give me this :
Code:
{
"features":[
{
"geometry":{"type":"point","x":678731.422659788,"y":6221057.36591139,"spatialReference":{"wkid":3400}},
"symbol":null,
"attributes":{"ID":0,"NAME":"Main Camp","TYPE":"Permanent","LATITUDE":"56.123456","LONGITUDE":"-112.12345678","LOCAT_VALID":"Valid","isAlone":true},
"infoTemplate":{"title":"Main Camp","content":"Latitude: 56.123456<br>Longitude: -112.12345678"}
}
],
"geometryType":"esriGeometryPoint",
"spatialReference":{"wkid":3400}
}
I've tried to call the service from the rest end point with both JSON featureSet and I found out why the JSON object created by the geoprocessor does not work. It simply that, as you can notice, the spatial reference from the geoprocessor is noted as
while form the stringify method it is noted as
Code:
"spatialReference":{"wkid":3400}
which is the expected format.
I'm wondering if this is normal and there is just something I'm missing, or is it simply a bug from esri.tasks.geoprocessor.
That is why I'd like to know what does the esri.tasks.geoprocessor uses for the purpose of converting FeatureSet to JSON and how can I work around that problem.
If anyone has encountered that problem or has a hint on how to solve this, it'd be appreciated.
Thank you
Bookmarks