

arcgis图层数据查询
source link: https://segmentfault.com/a/1190000039959703
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

有时候我们需要根据发布的arcgis服务查询服务上的一些数据,比如点击地图上的某个位置,比如根据某个关键字进行要素查询等等,而arcgis关于这方面的api常用的有三个:find、query和identify。
一、find查询
查找操作在地图服务资源上执行。此操作的结果是查找结果资源。每个结果都包含其值,要素ID,字段名称,图层ID,图层名称,几何图形,几何类型以及名称 - 值对形式的属性。
api说明:http://xxx/arcgis/sdk/rest/in...
查询示范:http://xxx/arcgis/rest/servic...
查询条件:
查询示例:http://xxx/arcgis/rest/services/my_layer/MapServer/find?searchText=%E5%90%88&contains=true&searchFields=RNAME&sr=&layers=0%2C1%2C2%2C3%2C4%2C5&layerDefs=&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&dynamicLayers=&returnZ=false&returnM=false&gdbVersion=&f=pjson
查询说明:模糊查询RNAME属性带有合字的数据,结果不包含边界数据
查询结果:
二、query查询
查询操作在动态层/表资源上执行。此操作的结果是一个功能集。此功能集包含Feature对象,包括用户请求的字段的值。对于图层,如果请求几何图形信息,则每个要素的几何图形也会在要素集中返回。对于表,功能集不包括几何。
当输出格式f为kmz时,结果将始终包含Z值,而与returnZ属性值无关。如果要素几何不支持Z,则将为Z返回默认值0。
api说明:http://xxx/arcgis/sdk/rest/index.html#//02ss00000081000000
查询示范:http://xxx/arcgis/rest/services/my_layer/MapServer/93/query
其中93是具体的图层,在这个服务中表示县级行政区
查询条件:
查询示例:http://xxx/arcgis/rest/services/my_layer/MapServer/93/query?where=CODE=340102&f=json
查询说明:根据where查询CODE等于340102的行政地区,结果包含边界数据
查询结果:
查询示例:http://xxx/arcgis/rest/services/my_layer/MapServer/85/query?f=json&where=1=1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=1&outFields=*&outSR=102100
查询说明:查询85图层中objectid为1的数据,结果包含边界数据
查询结果:
三、identify查询
在地图服务资源上执行识别操作以发现地理位置处的特征。此操作的结果是识别结果资源。每个标识的结果包括其名称,图层ID,图层名称,几何和几何类型,以及作为名称 - 值对的结果的其他属性。
应用场景:点击地图,查询点击位置所具有的要素或图层
api说明:http://xxx/arcgis/sdk/rest/index.html#/Identify_Map_Service/02ss000000m7000000/
查询示范:http://xxx/arcgis/rest/services/my_layer/MapServer/identify
查询条件:
查询示例:http://xxx/arcgis/rest/services/my_layer/MapServer/identify?f=json&tolerance=5&returnGeometry=false&imageDisplay=1073,897,96&geometry={%22x%22:13095597.208668906,%22y%22:3709649.674951799}&geometryType=esriGeometryPoint&sr=102100&mapExtent=12937525.434175162,3602943.583465693,13265593.159575136,3877199.640952905&layers=all:77,74,73,52
查询说明:根据经纬度x,y查询数据,xy的坐标系和图层相关
查询结果:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK