This example allows you to enter an address, then displays the location of matching addresses. This is commonly known as geocoding. In the ArcGIS JavaScript API, you use theLocator class to perform geocoding.
这个例子允许你输入一个地址,然后展现匹配的位置。这通常被叫做地理编码。
The Locator constructor requires the URL of an ArcGIS Server geocode service. A geocode service represents an address locator that has been made available on the server. This example uses the ESRI_Geocode_USA service on the ESRI sample server. You can use the Services Directory to discover the URL to your own geocode service.
Locator构造函数需要ArcGIS Server的geocode service的URL。geocode service代表一个在服务器上可用的位置定位器。
When the user clicks the Locate button, the locate function is called. This function parses the address text entered by the user into a four-item array. The four items (address, city, state, and zip) correspond to the address fields defined in the locator. You can discover these address fields by looking up the geocode service in the Services Directory. For example, this page shows the four address fields for the geocode service used in this example.
当用户点击Locate按钮,定位函数被调用。这个个函数解析用户输入的位置文本为四元素的数组。这个四个元素(address,city,state和zip)匹配locator中定义的字段。你可以发现这些地址字段通过查看在服务目录中的geocode service
The locator begins searching for matches when the addressToLocations method is called:
locator.addressToLocations(address);
Reverse geocoding determines the address of a given point on a map. This sample shows how to do reverse geocoding with the ArcGIS JavaScript API.
反地理编码决定地图上一个给定的点的地址。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从零实现富文本编辑器#3-基于Delta的线性数据结构模型
· 记一次 .NET某旅行社酒店管理系统 卡死分析
· 长文讲解 MCP 和案例实战
· Hangfire Redis 实现秒级定时任务,使用 CQRS 实现动态执行代码
· Android编译时动态插入代码原理与实践
· 一天 Star 破万的开源项目「GitHub 热点速览」
· 瞧瞧别人家的日期处理,那叫一个优雅!
· 使用TypeScript开发微信小程序(云开发)-入门篇
· 没几个人需要了解的JDK知识,我却花了3天时间研究
· 定时任务稳定性解决方案-healthchecks监控系统