第一步: 下载crossdomain.xml文件
从ArcGIS Server根目录下载crossdomain.xml文件
第二步:获取FeatrueLayer的元数据描述
请求地址:http://58.211.230.93:8399/arcgis/rest/services/ChinaRoad/MapServer/0
请求参数:?f=json
返回Json文本:
{"id" : 0,"name" : "roa_4m","type" : "Feature Layer","geometryType" : "esriGeometryPolyline","description" : "","definitionExpression" : "","copyrightText" : "","minScale" : 0.0,"maxScale" : 0.0,"extent" :{"xmin" : 80.3868560791016,"ymin" : 18.2823352813721,"xmax" : 132.514663696289,"ymax" : 49.6271781921387,"spatialReference" :{"wkid" : 4326}},"displayField" : "FNODE_","fields" : [{"name" : "FID", "type" : "esriFieldTypeOID", "alias" : "FID"},{"name" : "Shape", "type" : "esriFieldTypeGeometry", "alias" : "Shape"},{"name" : "FNODE_", "type" : "esriFieldTypeDouble", "alias" : "FNODE_"},{"name" : "TNODE_", "type" : "esriFieldTypeDouble", "alias" : "TNODE_"},{"name" : "LPOLY_", "type" : "esriFieldTypeDouble", "alias" : "LPOLY_"},{"name" : "RPOLY_", "type" : "esriFieldTypeDouble", "alias" : "RPOLY_"},{"name" : "LENGTH", "type" : "esriFieldTypeDouble", "alias" : "LENGTH"},{"name" : "ROA_4M_", "type" : "esriFieldTypeDouble", "alias" : "ROA_4M_"},{"name" : "ROA_4M_ID", "type" : "esriFieldTypeDouble", "alias" : "ROA_4M_ID"},{"name" : "GBCODE", "type" : "esriFieldTypeInteger", "alias" : "GBCODE"}],"parentLayer" : {"id" : -1, "name" : "-1"},"subLayers" : []}
第三步:第一次请求数据,根据元数据构造数据请求
http://58.211.230.93:8399/arcgis/rest/services/ChinaRoad/MapServer/0/Query
f | json |
geometryType | esriGeometryEnvelope |
outFields | * |
outSR | 102100 |
returnGeometry | true |
inSR | 102100 |
geometry | {"xmin":-50093770.85695993,"ymin":-25046885.428479966,"xmax":50093770.85695993,"ymax":25046885.428479966} |
spatialRel | esriSpatialRelIntersects |
返回数据:
JSON
displayFieldName=FNODE_
features
{}
attributes
FID=0
FNODE_=2
GBCODE=42220
geometry
paths
[]
[]
13097189.2402
6359951.5843
[]
13097189.2402
6359951.5843
[]
13097189.2402
6359951.5843
[]
13097189.2402
6359951.5843
[]
13097189.2402
6359951.5843
fieldAliases
FID=FID
FNODE_=FNODE_
LPOLY_=LPOLY_
RPOLY_=RPOLY_
geometryType=esriGeometryPolyline
spatialReference
wkid=102100
第四步:以后请求数据,根据元数据、第一次返回构造数据请求
http://58.211.230.93:8399/arcgis/rest/services/ChinaRoad/MapServer/0/query
f | json |
geometryType | esriGeometryEnvelope |
outFields | * |
where | FID NOT IN (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150) |
outSR | 102100 |
returnGeometry | true |
inSR | 102100 |
geometry | {"xmin":7983433.333824925,"ymin":-359488.2492525261,"xmax":20506876.048064873,"ymax":5902233.107867448} |
spatialRel | esriSpatialRelIntersects |