Class: SearchView

SearchView

图层查询组件类。

new SearchView(options)

Usage
import { SearchView } from '@supermapgis/iclient-leaflet';

new SearchView(options);
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.Components.Search({paramsNames});
  // 弃用的写法

  L.supermap.components.search(options);
</script>
leaflet/components/search/SearchView.js, line 15
Name Type Description
options Object

参数。

Name Type Default Description
cityConfig Object | Array.<string> 可选

城市地址匹配配置,默认为全国城市,与 options.cityGeoCodingConfig 支持匹配的服务对应; 配置两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或 ["成都市","北京市"],用户可根据自己的项目需求进行配置。

cityGeoCodingConfig Object 可选

城市地址匹配服务配置,包括:{addressUrl:"",key:""} 默认为 online 地址匹配服务,与 options.cityConfig 对应。

isGeoCoding boolean true 可选

是否支持城市地址匹配功能。

pageSize number 10 可选

地址匹配查询返回记录结果数,最大设置为 20。

pageNum number 1 可选

地址匹配查询分页页码,默认 1 代表第一页。

perPageDataNum number 8 可选

每页显示个数,最大值为 8。

position string 'topright' 可选

组件在地图中显示的位置( 'topleft'|'topright'|'bottomleft'|'bottomright' )。

style function 可选

默认图层样式。点样式( maker|circleMaker);线和面样式( L.path )。

onEachFeature function 可选

给该元素绑定事件和弹窗。

Version:
  • 9.1.1
Fires

Extends

SearchView -> ComponentsViewBase -> L.Control

Events

geocodesucceeded

leaflet/components/search/SearchView.js, line 512

地址匹配服务成功后触发。

Properties:
Name Type Description
result Object

事件返回的 GeoJSON 格式数据对象。

searchfailed

leaflet/components/search/SearchView.js, line 533

图层属性查询失败后触发。

Properties:
Name Type Description
message string

失败原因。

searchlayersucceeded

leaflet/components/search/SearchView.js, line 483

图层查询成功后触发。

Properties:
Name Type Description
result Object

事件返回的 GeoJSON 格式数据对象。

Methods

addSearchLayer(layers)

leaflet/components/search/SearchView.js, line 74

添加可查询的图层。

Name Type Description
layers Array.<L.GeoJSON> | L.GeoJSON

可查询的图层。

clearSearchResult()

leaflet/components/search/SearchView.js, line 658

清空查询结果。

inherited off(eventType, callback)

leaflet/components/ComponentsViewBase.js, line 78

事件关闭。

Name Type Description
eventType string

监听的事件名。

callback function

监听事件的回调函数。

inherited on(eventType, callback)

leaflet/components/ComponentsViewBase.js, line 68

事件绑定。

Name Type Description
eventType string

监听的事件类型。

callback function

监听事件的回调函数。